harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
38 lines (37 loc) • 1.45 kB
TypeScript
import { IterableEventQueue } from './IterableEventQueue.ts';
import type { Id } from './ResourceInterface.ts';
/**
* This module/function is responsible for the main work of tracking subscriptions and listening for new transactions
* that have occurred on any thread, and then reading through the transaction log to notify listeners. This is
* responsible for cleanup of subscriptions as well.
* @param table
* @param key
* @param listener
* @param startTime
* @param options
*/
export declare function addSubscription(table: any, key: any, listener?: (key: any) => any, startTime?: number, options?: any): Subscription;
/**
* This is the class that is returned from subscribe calls and provide the interface to set a callback, end the
* subscription and get the initial state.
*/
declare class Subscription extends IterableEventQueue {
listener: (recordId: Id, auditEntry: any, localTime: number, beginTxn: boolean) => void;
subscriptions: [];
startTime?: number;
includeDescendants?: boolean;
supportsTransactions?: boolean;
onlyChildren?: boolean;
constructor(listener: any);
end(): void;
toJSON(): {
name: string;
};
}
/**
* Interface with lmdb-js to listen for commits and traverse the audit log.
* @param primaryStore
*/
export declare function listenToCommits(primaryStore: any, auditStore: any): void;
export declare function whenNextTransaction(auditStore: any): any;
export {};