UNPKG

mute-structs

Version:

NodeJS module providing an implementation of the LogootSplit CRDT algorithm

45 lines (44 loc) 1.75 kB
import { Ordering } from "./ordering"; export declare class IdentifierTuple { static fromPlain(o: unknown): IdentifierTuple | null; /** * Generate a new IdentifierTuple with the same base as the provided one but with a different offset * * @param {tuple} IdentifierTuple The tuple to partly copy * @param {number} offset The offset of the new IdentifierTuple * @return {IdentifierTuple} The generated IdentifierTuple */ static fromBase(tuple: IdentifierTuple, offset: number): IdentifierTuple; readonly random: number; readonly replicaNumber: number; readonly clock: number; readonly offset: number; constructor(random: number, replicaNumber: number, clock: number, offset: number); /** * Compare this tuple to another one to order them * Ordering.Less means that this is less than other * Ordering.Greater means that this is greater than other * Ordering.Equal means that this is equals to other * * @param {IdentifierTuple} other The tuple to compare * @return {Ordering} The order of the two tuples */ compareTo(other: IdentifierTuple): Ordering; equals(other: IdentifierTuple): boolean; /** * Check if this tuple and another one share the same base * The base is composed of a random number, a replicaNumber and a clock * * @param {IdentifierTuple} other The tuple to compare * @return {boolean} Are the two tuple sharing the same base */ equalsBase(other: IdentifierTuple): boolean; /** * Map the tuple to an array, making it easier to browse * * @return {number[]} The tuple as an array */ asArray(): number[]; digest(): number; toString(): string; }