Dev Guide
Dev GuideUser GuideGitHubNuGetDevCommunitySubmit a ticketLog In
GitHubNuGetDevCommunitySubmit a ticket

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

NameTypeDefault valueDescription
avgDelaynumber0Average delay per request in miliseconds
sourceData?{}undefined-
changeHandler?(data: {}) => Promise<void>undefined-

Returns

LocalAsyncStoreBackend<T>

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

NameTypeDescription
keystringto update
updaterPatchUpdater<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

NameType
keystring

Returns

Promise<O>

Defined in: src/store/LocalAsyncStoreBackend.ts:111

exists()

Signature

exists(key: string): Promise<boolean>;

Parameters

NameType
keystring

Returns

Promise<boolean>

Defined in: src/store/LocalAsyncStoreBackend.ts:123

get()

Signature

get<O>(key: string): Promise<StoreEntry<O>>;

Type parameters

  • O

Parameters

NameType
keystring

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

NameType
keystring
valueO
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