Skip to main content

ProtobufStore

This interface defines methods for reading and writing protobuf messages to and from a blob store. It provides functionality to retrieve an entire blob and unmarshal it into a protobuf message, as well as to serialize and store a protobuf message.

Methods


ReadProtobuf()

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

Retrieves the entire blob from blobstore and unmarshals it to the passed protobuf.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and deadlines.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The reference to the data blob in the blobstore.
msgproto.MessageThe protobuf message into which the retrieved data will be unmarshaled.

Returns

TypeDescription
errorAn error if the operation fails.

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

Serializes and stores the protobuf.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and deadlines.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The reference to the location where the protobuf message will be stored.
opts[Options](../../flyteplugins/go/tasks/pluginmachinery/k8s/options.md?sid=flyteplugins_go_tasks_pluginmachinery_k8s_options)Options for the write operation, such as encryption or compression settings.
msgproto.MessageThe protobuf message to be serialized and stored.

Returns

TypeDescription
errorAn error if the operation fails.