Skip to content

WorkerAdapter

Signature

export declare class WorkerAdapter implements Adapter

Properties

increment?: Adapter['increment'];

Available after start() only when the manager's backend supports atomic increments. Accepted increments wait for the backend's result without a local timeout.

promises: Map<string, {    resolve: (value: unknown) => void;    reject: (error: unknown) => void;    timeout: NodeJS.Timeout | undefined;}>;

Methods

start(): Promise<void>;

Discovers optional backend capabilities before gateway packets are handled.

postMessage(body: any): unknown;

Transport failures must mean the request was not delivered. After delivery, completion or failure is reported by CACHE_RESULT; a transport must not reject while the manager may still apply the request.

scan(...rest: any[]): Promise<any>;
bulkGet(...rest: any[]): Promise<any>;
get(...rest: any[]): Promise<any>;
bulkSet(entries: AdapterEntry[]): Promise<any>;

Stores every entry atomically. The batch itself is not atomic and implementations may execute entries concurrently or out of order. If the operation rejects, any subset may already be committed, but no writes remain pending after the returned promise settles.

set(key: string, value: any, relationship: AdapterRelationship): Promise<any>;

Stores the value and relationship as one atomic operation.

bulkPatch(entries: AdapterEntry[]): Promise<any>;

Patches every entry atomically. The batch itself is not atomic and implementations may execute entries concurrently or out of order. If the operation rejects, any subset may already be committed, but no writes remain pending after the returned promise settles.

patch(key: string, value: any, relationship: AdapterRelationship): Promise<any>;

Patches the value and stores its relationship as one atomic operation.

values(...rest: any[]): Promise<any>;
keys(...rest: any[]): Promise<any>;
count(...rest: any[]): Promise<any>;
bulkRemove(...rest: any[]): Promise<any>;

Removes every entry atomically. The batch itself is not atomic and implementations may execute entries concurrently or out of order. If the operation rejects, any subset may already be committed, but no removals remain pending after the returned promise settles.

remove(...rest: any[]): Promise<any>;

Removes the value and its owning relationship as one logical operation.

contains(...rest: any[]): Promise<any>;
removeToRelationship(...rest: any[]): Promise<any>;

Removes the selected values and relationships owned by `to`.

removeRelationship(...rest: any[]): Promise<any>;

Removes every value and relationship owned by the supplied relationships.