UNPKG

harperdb

Version:

HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.

34 lines (33 loc) 2.08 kB
/** * This module is responsible for handling metadata encoding and decoding in database records, which is * used for local timestamps (that lmdb-js can assign during a transaction for guaranteed monotonic * assignment across threads) and can be used for storing residency information as well. This * patches the primary store to properly get the metadata and assign it to the entries. */ import { Encoder } from 'msgpackr'; import './blob'; export declare const TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>; export declare const LAST_TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>; export declare const PREVIOUS_TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>; export declare const NEW_TIMESTAMP_PLACEHOLDER: Uint8Array<ArrayBuffer>; export declare const LOCAL_TIMESTAMP: unique symbol; export declare const METADATA: unique symbol; export declare const NO_TIMESTAMP = 0; export declare const TIMESTAMP_ASSIGN_NEW = 0; export declare const TIMESTAMP_ASSIGN_LAST = 1; export declare const TIMESTAMP_ASSIGN_PREVIOUS = 3; export declare const TIMESTAMP_RECORD_PREVIOUS = 4; export declare const HAS_EXPIRATION = 16; export declare const HAS_RESIDENCY_ID = 32; export declare const PENDING_LOCAL_TIME = 1; export declare const HAS_STRUCTURE_UPDATE = 256; export declare class RecordEncoder extends Encoder { constructor(options: any); decode(buffer: any, options: any): any; } export declare function handleLocalTimeForGets(store: any, root_store: any): any; export declare function recordUpdater(store: any, table_id: any, audit_store: any): (id: any, record: any, existing_entry: any, new_version: any, assign_metadata?: number, // when positive, this has a set of metadata flags for the record audit?: boolean, // true -> audit this record. false -> do not. null -> retain any audit timestamp options?: any, type?: string, resolve_record?: boolean, // indicates that we are resolving (from source) record that was previously invalidated audit_record?: any) => Promise<void>; export declare function removeEntry(store: any, entry: any, existing_version?: number): any;