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 to the data location in the store where the protobuf message is stored.
msgproto.MessageThe protobuf message object into which the read data will be unmarshaled.

Returns

TypeDescription
errorAn error if the read operation fails or if unmarshaling is unsuccessful.

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 before storage.

Parameters

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

Returns

TypeDescription
errorAn error if the write operation fails or if marshaling is unsuccessful.