UNPKG

@x5e/gink

Version:

an eventually consistent database

47 lines (46 loc) 2.35 kB
import { Value, ScalarKey, Muid, AsOf, Meta } from "./typedefs"; import { Deletion } from "./Deletion"; import { Inclusion } from "./Inclusion"; import { Database } from "./Database"; import { Behavior } from "./builders"; import { Addressable } from "./Addressable"; import { inspectSymbol } from "./utils"; export declare abstract class Container extends Addressable { readonly database: Database; readonly behavior: Behavior; protected static readonly DELETION: Deletion; protected static readonly INCLUSION: Inclusion; protected static globalPropertyMuid: { medallion: number; timestamp: number; offset: Behavior; }; protected constructor(database: Database, address: Muid, behavior: Behavior); [inspectSymbol](depth: any, opts: any): string; whatAmI(): string; protected static addContainer({ database, behavior, meta, }: { database: Database; behavior: Behavior; meta?: Meta; }): Promise<Muid>; abstract toJson(indent: number | boolean, asOf?: AsOf, seen?: Set<string>): Promise<string>; setName(name: string, meta?: Meta): Promise<Muid>; getName(asOf?: AsOf): Promise<string | undefined>; clear(purge?: boolean, meta?: Meta): Promise<Muid>; /** * Reset this Container to a previous time. If no time is specified, the container will * be cleared. * @argument toTime Optional time to reset to. If absent, the container will be cleared. * @argument recurse Recursively reset all child containers held by this container at reset time? * @argument meta Metadata to be used in the reset. */ abstract reset(toTime?: AsOf, recurse?: any, meta?: Meta): Promise<void>; abstract size(asOf?: AsOf): Promise<number>; protected addEntry(key?: ScalarKey | Addressable | [Addressable, Addressable] | Muid | [Muid, Muid], value?: Container | Value | Deletion | Inclusion, meta?: Meta, onContainer?: Muid): Promise<Muid>; /** * Reset the properties associated with this container to a previous time. * @param toTime optional timestamp to reset to. If not provided, the properties will be deleted. * @param bundlerOrComment optional bundler to add this change to, or a string to add a comment to a new bundle. */ resetProperties(toTime?: AsOf, meta?: Meta): Promise<void>; }