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 location store. This method is used to provision new storage containers.

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 location store for a specific location ID. This method is used to provision new storage containers.

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 location store. If the container does not exist and createIfNotFound is true, it will create a new container.

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 location store for a specific location ID. If the container does not exist and createIfNotFound is true, it will create a new container.

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 location store for a specific location ID. This method is used to access an existing container.

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, error

Fetches metadata for a data reference without retrieving the actual data. This is useful for checking existence or properties of an item.

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 item for which to retrieve metadata.

Returns

TypeDescription
Metadata, errorThe metadata associated with the data reference and an error if the item does not exist or cannot be accessed.

List()

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

Lists data references within a specified container or prefix, with pagination support. This allows callers to browse the contents of a storage location.

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 to list items from.
maxItemsintThe maximum number of items to return in a single listing operation.
cursorCursorA cursor token to continue listing from a previous point, used for pagination.

Returns

TypeDescription
[][DataReference](datareference.md?sid=flytestdlib_storage_datareference), Cursor, errorA slice of data references, a cursor for the next page of results, and an error if the listing 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 item. This method provides direct access to the stored 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 item whose raw content is to be read.

Returns

TypeDescription
io.ReadCloser, errorA ReadCloser for the item's content and an error if the item cannot be read or found. The caller is responsible for closing the ReadCloser.

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 item, creating or overwriting it. This method is used to store data in the stow location.

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 item where the raw content will be written.
sizeint64The size of the raw content in bytes.
opts[Options](../../flyteplugins/go/tasks/pluginmachinery/k8s/options.md?sid=flyteplugins_go_tasks_pluginmachinery_k8s_options)Optional parameters for the write operation, such as content type or metadata.
rawio.ReaderThe raw content to be written to the data item.

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 item from the stow location store. This method removes the specified item permanently.

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 item to be deleted.

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 configured for this StowStore. This provides information about 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 DataReference representing 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 item, allowing temporary access without requiring direct authentication. This is useful for sharing private content 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 item for which to create a signed URL.
properties[SignedURLProperties](signedurlproperties.md?sid=flytestdlib_storage_signedurlproperties)Properties defining the signed URL, such as expiration time and permissions.

Returns

TypeDescription
[SignedURLResponse](signedurlresponse.md?sid=flytestdlib_storage_signedurlresponse), errorA SignedURLResponse containing the generated 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 specific storage locations.

Parameters

NameTypeDescription
idlocationIDThe identifier of the location to retrieve.

Returns

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