Skip to main content

DefaultProtobufStore

Implements ProtobufStore to marshal and unmarshal protobufs to/from a RawStore

Methods​


ReadProtobuf()​

@classmethod
def ReadProtobuf(
ctx: context.Context,
reference: [DataReference](datareference.md?sid=flytestdlib_storage_datareference),
msg: proto.Message
) - > error

Reads a protobuf message from the store using the provided reference and unmarshals it into the given message object.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The reference identifying the location of the protobuf data to be read.
msgproto.MessageThe protobuf message object into which the read data will be unmarshaled.

Returns​

TypeDescription
errorAn error if the read or unmarshaling fails, otherwise nil.

WriteProtobuf()​

@classmethod
def WriteProtobuf(
ctx: context.Context,
reference: [DataReference](datareference.md?sid=flytestdlib_storage_datareference),
opts: [Options](../../flyteplugins/go/tasks/pluginmachinery/k8s/options.md?sid=flyteplugins_go_tasks_pluginmachinery_k8s_options),
msg: proto.Message
) - > error

Writes a protobuf message to the store using the provided reference and options, marshaling the message into raw data.

Parameters​

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The reference identifying the location where the protobuf data will be written.
opts[Options](../../flyteplugins/go/tasks/pluginmachinery/k8s/options.md?sid=flyteplugins_go_tasks_pluginmachinery_k8s_options)Options controlling the write operation, such as consistency levels or metadata.
msgproto.MessageThe protobuf message object to be marshaled and written to the store.

Returns​

TypeDescription
errorAn error if the marshaling or write operation fails, otherwise nil.