@electric-sql/d2ts
Version:
D2TS is a TypeScript implementation of Differential Dataflow.
57 lines (56 loc) • 1.9 kB
TypeScript
/**
* Factory function for creating cached Version objects.
* Ensures only one object exists for each unique version, these can then safely be
* used as keys in maps etc.
*/
export declare function v(version: number | number[]): Version;
/**
* A partially, or totally ordered version (time), consisting of a tuple of integers.
*
* All versions within a scope of a dataflow must have the same dimension/number
* of coordinates. One dimensional versions are totally ordered. Multidimensional
* versions are partially ordered by the product partial order.
*/
export declare class Version {
#private;
constructor(version: number | number[]);
toString(): string;
toJSON(): string;
static fromJSON(json: string): Version;
equals(other: Version): boolean;
lessThan(other: Version): boolean;
lessEqual(other: Version): boolean;
join(other: Version): Version;
meet(other: Version): Version;
advanceBy(frontier: Antichain): Version;
extend(): Version;
truncate(): Version;
applyStep(step: number): Version;
getInner(): number[];
}
/**
* A minimal set of incomparable versions.
*
* This keeps the min antichain.
*/
export declare class Antichain {
#private;
constructor(elements: Version[]);
static create(value: Antichain | Version[] | Version | number | number[]): Antichain;
toString(): string;
meet(other: Antichain): Antichain;
equals(other: Antichain): boolean;
lessThan(other: Antichain): boolean;
lessEqual(other: Antichain): boolean;
lessEqualVersion(version: Version): boolean;
isEmpty(): boolean;
extend(): Antichain;
truncate(): Antichain;
applyStep(step: number): Antichain;
get elements(): Version[];
toJSON(): string;
static fromJSON(json: string): Antichain;
}
export declare class Frontier extends Antichain {
constructor(...elements: Version[]);
}