Skip to main content

IStorageManager<T>

Defined in: atomiq-base/src/storage/IStorageManager.ts:11

Interface for storage managers that persist StorageObject instances. Provides basic CRUD operations with in-memory caching via the data property.

Type Parameters

Type ParameterDescription
T extends StorageObjectType of StorageObject to manage

Properties

data

data: object;

Defined in: atomiq-base/src/storage/IStorageManager.ts:14

In-memory cache of stored objects, keyed by hash

Index Signature

[key: string]: T

Methods

init()

init(): Promise<void>;

Defined in: atomiq-base/src/storage/IStorageManager.ts:19

Initializes the storage backend

Returns

Promise<void>


loadData()

loadData(type): Promise<T[]>;

Defined in: atomiq-base/src/storage/IStorageManager.ts:42

Loads all stored objects and deserializes them using the provided constructor

Parameters

ParameterTypeDescription
type(data) => TConstructor function to instantiate each object

Returns

Promise<T[]>

Array of deserialized objects


removeData()

removeData(hash): Promise<void>;

Defined in: atomiq-base/src/storage/IStorageManager.ts:34

Removes an object from storage

Parameters

ParameterTypeDescription
hashstringIdentifier of the object to remove

Returns

Promise<void>


removeDataArr()?

optional removeDataArr(keys): Promise<void>;

Defined in: atomiq-base/src/storage/IStorageManager.ts:49

Removes multiple objects from storage (optional batch operation)

Parameters

ParameterTypeDescription
keysstring[]Array of identifiers to remove

Returns

Promise<void>


saveData()

saveData(hash, object): Promise<void>;

Defined in: atomiq-base/src/storage/IStorageManager.ts:27

Saves an object to storage

Parameters

ParameterTypeDescription
hashstringUnique identifier for the object
objectTObject to save

Returns

Promise<void>


saveDataArr()?

optional saveDataArr(values): Promise<void>;

Defined in: atomiq-base/src/storage/IStorageManager.ts:56

Saves multiple objects to storage (optional batch operation)

Parameters

ParameterTypeDescription
valuesobject[]Array of id-object pairs to save

Returns

Promise<void>