Skip to main content

StowStore

This class implements DataStore to interact with a stow location store. It manages a base container and can dynamically load other containers if enabled, recording them in a map. It also includes metrics for tracking operations.

Methods


CreateContainer()

@classmethod
def CreateContainer(
ctx: context.Context,
container: string
) - > stow.Container, error

Creates a new container in the stow store. This method is used to provision storage containers for data.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
containerstringThe name of the container to create.

Returns

TypeDescription
stow.Container, errorThe newly created stow container and an error if the operation failed.

createContainer()

@classmethod
def createContainer(
ctx: context.Context,
locID: locationID,
container: string
) - > stow.Container, error

Creates a new container in the stow store for a specific location ID. This internal method is used to provision storage containers for data.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
locIDlocationIDThe identifier of the location where the container should be created.
containerstringThe name of the container to create.

Returns

TypeDescription
stow.Container, errorThe newly created stow container and an error if the operation failed.

LoadContainer()

@classmethod
def LoadContainer(
ctx: context.Context,
container: string,
createIfNotFound: bool
) - > stow.Container, error

Loads an existing container from the stow store. If the container does not exist and createIfNotFound is true, it will be created.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
containerstringThe name of the container to load.
createIfNotFoundboolA boolean indicating whether to create the container if it does not already exist.

Returns

TypeDescription
stow.Container, errorThe loaded or newly created stow container and an error if the operation failed.

loadContainer()

@classmethod
def loadContainer(
ctx: context.Context,
locID: locationID,
container: string,
createIfNotFound: bool
) - > stow.Container, error

Loads an existing container from the stow store for a specific location ID. If the container does not exist and createIfNotFound is true, it will be created.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
locIDlocationIDThe identifier of the location from which to load the container.
containerstringThe name of the container to load.
createIfNotFoundboolA boolean indicating whether to create the container if it does not already exist.

Returns

TypeDescription
stow.Container, errorThe loaded or newly created stow container and an error if the operation failed.

getContainer()

@classmethod
def getContainer(
ctx: context.Context,
locID: locationID,
container: string
) - > c stow.Container, err error

Retrieves a container from the stow store for a specific location ID. This internal method is used to access existing containers.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
locIDlocationIDThe identifier of the location from which to get the container.
containerstringThe name of the container to retrieve.

Returns

TypeDescription
c stow.Container, err errorThe retrieved stow container and an error if the container could not be found or accessed.

@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 metadata for a data reference without retrieving the actual data. This is useful for checking existence or properties of an object.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)A reference to the data object for which to retrieve metadata.

Returns

TypeDescription
[Metadata](../../flyteplugins/go/tasks/pluginmachinery/catalog/metadata.md?sid=flyteplugins_go_tasks_pluginmachinery_catalog_metadata), errorThe metadata associated with the data reference and an error if the operation failed.

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 container or prefix. This allows for pagination through large sets of objects.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)A reference to the container or prefix within which to list items.
maxItemsintThe maximum number of items to return in a single listing operation.
cursor[Cursor](cursor.md?sid=flytestdlib_storage_cursor)A cursor indicating the starting point for the listing operation, used for pagination.

Returns

TypeDescription
[][DataReference](datareference.md?sid=flytestdlib_storage_datareference), [Cursor](cursor.md?sid=flytestdlib_storage_cursor), errorA slice of data references, a cursor for the next page of results, and an error if the operation failed.

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 object. This method returns an io.ReadCloser for streaming the object's data.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)A reference to the data object to read.

Returns

TypeDescription
io.ReadCloser, errorAn io.ReadCloser to stream the object's content and an error if the operation failed.

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 content to a data object. This method allows for streaming data to a specified reference.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)A reference to the data object where the content will be written.
sizeint64The size of the data being written in bytes.
opts[Options](../../flyteplugins/go/tasks/pluginmachinery/k8s/options.md?sid=flyteplugins_go_tasks_pluginmachinery_k8s_options)Options for the write operation, such as content type or metadata.
rawio.ReaderAn io.Reader providing the raw content to write.

Returns

TypeDescription
errorAn error if the write operation failed.

Delete()

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

Deletes a data object specified by its reference. This permanently removes the object from the store.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)A reference to the data object to delete.

Returns

TypeDescription
errorAn error if the delete operation failed.

GetBaseContainerFQN()

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

Retrieves the fully qualified name of the base container. This is useful for identifying the default storage location.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.

Returns

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

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

Generates a pre-signed URL for a data object, allowing temporary access without requiring direct authentication. This is useful for sharing private objects securely.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, allowing for cancellation and timeouts.
reference[DataReference](datareference.md?sid=flytestdlib_storage_datareference)A reference to the data object for which to create a signed URL.
properties[SignedURLProperties](signedurlproperties.md?sid=flytestdlib_storage_signedurlproperties)Properties for the signed URL, such as expiration time and allowed HTTP methods.

Returns

TypeDescription
[SignedURLResponse](signedurlresponse.md?sid=flytestdlib_storage_signedurlresponse), errorA response containing the signed URL and an error if the operation failed.

getLocation()

@classmethod
def getLocation(
id: locationID
) - > stow.Location

Retrieves a stow location by its identifier. This internal method is used to access configured storage locations.

Parameters

NameTypeDescription
idlocationIDThe identifier of the location to retrieve.

Returns

TypeDescription
stow.LocationThe stow location corresponding to the provided ID.