MemoryStorageBackend
Implements
Index
Constructors
constructor
Parameters
options: MemoryStorageOptions = {}
Returns MemoryStorageBackend
Properties
optionalreadonlylogger
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
options: 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
options: 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
options: StorageIdentifier = {}
Returns Promise<RequestQueueBackend>
getStorageBackendCacheKey
Return a per-instance unique cache key so that distinct
MemoryStorageBackendinstances get separate cache partitions in the storage backend cache.Returns string
purge
Cleans up the run-scoped storages before the run starts. For the in-memory storage this simply resets the in-memory state of the cached backends.
Returns Promise<void>
storageExists
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>
teardown
This method should be called at the end of the process. The in-memory storage holds no resources that outlive the process (no file handles, no cross-process locks), so there is nothing to do.
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.