LocalAsyncStoreBackend
OCP App SDK / LocalAsyncStoreBackend
LocalAsyncStoreBackend<T>
Simulates access to a remote data store by performing operations asynchronously.
Used as a backend for local dev and testing to the local stores
Type parameters
T
Index
Constructors
Methods
Constructors
constructor()
Signature
new LocalAsyncStoreBackend<T>(avgDelay: number = 0, sourceData?: object, changeHandler?: Function): LocalAsyncStoreBackend<T>;
Type parameters
T
Parameters
Name | Type | Default value | Description |
---|---|---|---|
avgDelay | number | 0 | Average delay per request in miliseconds |
sourceData? | {} | undefined | - |
changeHandler? | (data : {}) => Promise <void > | undefined | - |
Returns
Defined in: src/store/LocalAsyncStoreBackend.ts:29
Methods
atomicPatch()
Normal KV patch is not atomic without CAS and potentially retries. This implementation
is specifically for operations that are atomic on the data store side, such as mutating a list.
Signature
atomicPatch<O>(key: string, updater: PatchUpdater<O>): Promise<O>;
Type parameters
O
Parameters
Name | Type | Description |
---|---|---|
key | string | to update |
updater | PatchUpdater <O > | callback to perform atomic update |
Returns
Promise
<O
>
Defined in: src/store/LocalAsyncStoreBackend.ts:82
delete()
Signature
delete<O>(key: string): Promise<O>;
Type parameters
O
Parameters
Name | Type |
---|---|
key | string |
Returns
Promise
<O
>
Defined in: src/store/LocalAsyncStoreBackend.ts:111
exists()
Signature
exists(key: string): Promise<boolean>;
Parameters
Name | Type |
---|---|
key | string |
Returns
Promise
<boolean
>
Defined in: src/store/LocalAsyncStoreBackend.ts:123
get()
Signature
get<O>(key: string): Promise<StoreEntry<O>>;
Type parameters
O
Parameters
Name | Type |
---|---|
key | string |
Returns
Promise
<StoreEntry
<O
>>
Defined in: src/store/LocalAsyncStoreBackend.ts:37
put()
Signature
put<O>(
key: string,
value: O,
ttl?: number,
cas?: number): Promise<O>;
Type parameters
O
Parameters
Name | Type |
---|---|
key | string |
value | O |
ttl? | number |
cas? | number |
Returns
Promise
<O
>
Defined in: src/store/LocalAsyncStoreBackend.ts:48
reset()
Signature
reset(): void;
Returns
void
Defined in: src/store/LocalAsyncStoreBackend.ts:130
Updated 3 months ago