Skip to main content

RedisStore

RedisStore implements RawStore on top of a Redis server. Each object is a single Redis string value whose key is the path portion of the DataReference, verbatim: redis://< addr >/< key >. Directories are emulated as key prefixes (a SCAN match on "< prefix >/*"). It is intended for metadata-sized objects (inputs/outputs protobufs); Redis caps a string value at 512MiB and keeps it in memory, so large raw data should stay in a blob store.

Methods


key()

@classmethod
def key(
ctx: context.Context,
reference: [DataReference](datareference.md?sid=flytestdlib_storage_datareference),
allowEmpty: bool
) - > (string, error)

Generates a key for a given data reference, optionally allowing empty references.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, carrying deadlines, cancellation signals, and other request-scoped values.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The data reference for which to generate a key.
allowEmptyboolA boolean indicating whether an empty reference is allowed.

Returns

TypeDescription
(string, error)A string representing the key and an error if the operation fails.

GetBaseContainerFQN()

@classmethod
def GetBaseContainerFQN(
ctx: context.Context
) - > [DataReference](datareference.md?sid=flytestdlib_storage_datareference)

Retrieves the fully qualified name of the base container.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, carrying deadlines, cancellation signals, and other request-scoped values.

Returns

TypeDescription
[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The DataReference representing the base container's fully qualified name.

CreateSignedURL()

@classmethod
def CreateSignedURL(
ctx: context.Context,
reference: [DataReference](datareference.md?sid=flytestdlib_storage_datareference),
properties: [SignedURLProperties](signedurlproperties.md?sid=flytestdlib_storage_signedurlproperties)
) - > ([SignedURLResponse](signedurlresponse.md?sid=flytestdlib_storage_signedurlresponse), error)

Creates a signed URL for a given data reference with specified properties. This allows temporary, secure access to the data without exposing credentials.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, carrying deadlines, cancellation signals, and other request-scoped values.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The data reference for which to create a signed URL.
properties[SignedURLProperties](signedurlproperties.md?sid=flytestdlib_storage_signedurlproperties)The properties to configure the signed URL, such as expiration time and permissions.

Returns

TypeDescription
([SignedURLResponse](signedurlresponse.md?sid=flytestdlib_storage_signedurlresponse), error)A SignedURLResponse containing the generated URL and an error if the operation fails.

@classmethod
def Head(
ctx: context.Context,
reference: [DataReference](datareference.md?sid=flytestdlib_storage_datareference)
) - > ([Metadata](../../flyteplugins/go/tasks/pluginmachinery/catalog/metadata.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_metadata), error)

Fetches the metadata for a given data reference without retrieving the actual data. This is useful for checking existence and properties of an object.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, carrying deadlines, cancellation signals, and other request-scoped values.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The data reference for which to retrieve metadata.

Returns

TypeDescription
([Metadata](../../flyteplugins/go/tasks/pluginmachinery/catalog/metadata.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_metadata), error)The Metadata associated with the data reference and an error if the operation fails or the reference does not exist.

List()

@classmethod
def List(
ctx: context.Context,
reference: [DataReference](datareference.md?sid=flytestdlib_storage_datareference),
maxItems: int,
cursor: [Cursor](cursor.md?sid=flytestdlib_storage_cursor)
) - > ([][DataReference](datareference.md?sid=flytestdlib_storage_datareference), [Cursor](cursor.md?sid=flytestdlib_storage_cursor), error)

Lists data references within a specified path, with options for pagination. This allows callers to browse the contents of a 'directory' within the store.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, carrying deadlines, cancellation signals, and other request-scoped values.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The base data reference (path) from which to start listing.
maxItemsintThe maximum number of items to return in a single list operation.
cursor[Cursor](cursor.md?sid=flytestdlib_storage_cursor)A cursor for pagination, indicating where to resume listing from a previous call.

Returns

TypeDescription
([][DataReference](datareference.md?sid=flytestdlib_storage_datareference), [Cursor](cursor.md?sid=flytestdlib_storage_cursor), error)A slice of DataReferences found, a cursor for subsequent pagination, and an error if the operation fails.

ReadRaw()

@classmethod
def ReadRaw(
ctx: context.Context,
reference: [DataReference](datareference.md?sid=flytestdlib_storage_datareference)
) - > (io.ReadCloser, error)

Reads the raw content of a data reference. This method is used to retrieve the actual data stored at the given reference.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, carrying deadlines, cancellation signals, and other request-scoped values.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The data reference pointing to the raw data to be read.

Returns

TypeDescription
(io.ReadCloser, error)An io.ReadCloser for streaming the raw data and an error if the operation fails.

WriteRaw()

@classmethod
def WriteRaw(
ctx: context.Context,
reference: [DataReference](datareference.md?sid=flytestdlib_storage_datareference),
size: int64,
opts: [Options](../../flyteplugins/go/tasks/pluginmachinery/k8s/options.md?sid=flyteplugins_go_tasks_pluginmachinery_k8s_options),
raw: io.Reader
) - > error

Writes raw data to a specified data reference. This method is used to store new data or overwrite existing data at the given reference.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, carrying deadlines, cancellation signals, and other request-scoped values.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The data reference where the raw data will be written.
sizeint64The size of the raw data in bytes.
opts[Options](../../flyteplugins/go/tasks/pluginmachinery/k8s/options.md?sid=flyteplugins_go_tasks_pluginmachinery_k8s_options)Additional options for the write operation, such as content type or metadata.
rawio.ReaderAn io.Reader providing the raw data to be written.

Returns

TypeDescription
errorAn error if the write operation fails.

Delete()

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

Deletes the data associated with a given data reference. This permanently removes the object from the store.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, carrying deadlines, cancellation signals, and other request-scoped values.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)The data reference pointing to the object to be deleted.

Returns

TypeDescription
errorAn error if the delete operation fails.