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
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The 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. |
| msg | proto.Message | The protobuf message object into which the read data will be unmarshaled. |
Returns
| Type | Description |
|---|---|
error | An 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
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The 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. |
| msg | proto.Message | The protobuf message object to be marshaled and written to the store. |
Returns
| Type | Description |
|---|---|
error | An error if the write operation fails or if marshaling is unsuccessful. |