UNPKG

@clickup/ent-framework

Version:

A PostgreSQL graph-database-alike library with microsharding and row-level security

35 lines 1.73 kB
/** * The reason why the decision that this replica timeline is "good enough" has * been made. */ export type TimelineCaughtUpReason = false | "replica-bc-master-state-unknown" | "replica-bc-caught-up" | "replica-bc-pos-expired"; /** * Tracks replication lag timeline position at master per "user" and Ent. * - serialization format: "pos:expiresAt" * - wipes expired records (expiration is calculated at assignment moment) * * How replication lag (timeline) tracking works: for each * microshard+Ent+"user", we know the “last write-ahead log write position” * which that user (typically, VC#principal) made recently. This info can be * propagated through e.g. user's session and push notifications/subscriptions * channels automatically (“serialized timeline” and “timelines merging”). So * the next time the same user tries to read the data from the same Ent on the * same microshard, Ent Framework makes a choice, whether the replica is “good * enough” for this already; if not, it falls back to master read. I.e. the data * is not granular to individual Ent ID, it’s granular to the * user+Ent+microshard, and thus it is decoupled from IDs. */ export declare class Timeline { private state; constructor(state?: "unknown" | { readonly pos: bigint; readonly expiresAt: number; }); static deserialize(data: string | undefined, prevTimeline: Timeline | null): Timeline; static cloneMap(timelines: ReadonlyMap<string, Timeline>): Map<string, Timeline>; serialize(): string | undefined; setPos(pos: bigint, maxLagMs: number): void; isCaughtUp(replicaPos: bigint): TimelineCaughtUpReason; reset(): void; } //# sourceMappingURL=Timeline.d.ts.map