StorageBackend
Implemented by
Index
Properties
optionalstats
Type declaration
rateLimitErrors: number[]
Methods
createDatasetBackend
Create (or open) a dataset backend. If
idis provided, opens the dataset with that ID. Ifnameis provided, opens an existing dataset with that name or creates a new one. If neither is provided, opens or creates the default dataset.Parameters
optionaloptions: StorageIdentifier
Returns Promise<DatasetBackend<Dictionary>>
createKeyValueStoreBackend
Create (or open) a key-value store backend. If
idis provided, opens the key-value store with that ID. Ifnameis provided, opens an existing store with that name or creates a new one. If neither is provided, opens or creates the default key-value store.Parameters
optionaloptions: StorageIdentifier
Returns Promise<KeyValueStoreBackend>
createRequestQueueBackend
Create (or open) a request queue backend. If
idis provided, opens the request queue with that ID. Ifnameis provided, opens an existing queue with that name or creates a new one. If neither is provided, opens or creates the default request queue.Parameters
optionaloptions: StorageIdentifier
Returns Promise<RequestQueueBackend>
optionalgetStorageBackendCacheKey
Return an opaque key that uniquely identifies this storage backend instance.
The key is used by
StorageInstanceManagerto partition the storage cache per-backend, so that two storages with the same name but backed by different clients (e.g. a localMemoryStorageBackendand a cloudApifyClient) are cached as separate instances.When not provided, the fallback uses the client's constructor name, so different
StorageBackendimplementations automatically get separate cache partitions.Returns string
optionalpurge
Empty the run-scoped storages — the default one and every alias-keyed one, including any left behind by a previous run. Named storages persist across runs, as does the default store's
INPUT.Returns Promise<void>
optionalstorageExists
Check whether a storage with the given ID exists.
Used internally to resolve ambiguous
idOrNamestrings passed toDataset.open(),KeyValueStore.open(), andRequestQueue.open().Parameters
id: string
type: Dataset | KeyValueStore | RequestQueue
Returns Promise<boolean>
optionalteardown
Returns Promise<void>
Represents a storage backend capable of working with datasets, key-value stores and request queues.
A new storage backend needs to implement 4 classes:
StorageBackend- the factory that creates sub-backendsDatasetBackend- operations on a single datasetKeyValueStoreBackend- operations on a single key-value storeRequestQueueBackend- operations on a single request queueThe
StorageBackendacts as an async factory: eachcreate*method either opens an existing storage or creates a new one, returning a sub-backend bound to that storage instance.