The state of a replica: a set of version rows and a set of blobs, and nothing derived is part of it. What a path holds is a view of the rows: the heads of a path are its versions that no other version replaced, the winner is the head with the greatest id, and the other heads are its siblings; a winner that is a tombstone means the path is not there. The union of two states is their rows and blobs together, which is the same in any order, however grouped and however often, and the view is a function of the rows alone, so replicas that hold the same rows hold the same files.
type MergeState = {
readonly replica: ReplicaId;
readonly config: MergeConfig;
/** The rows, by `id|sum`: the prim…(822 characters)
typeMergeState= {
readonlyreplica:ReplicaId;
readonlyconfig:MergeConfig;
/** The rows, by `id|sum`: the primary key of the row. */readonlyversions:ReadonlyMap<string, Version>;
/** The blobs, by the SHA-256 of their bytes. */readonlyblobs:ReadonlyMap<string, Uint8Array>;
readonlylast:IdTime|undefined;
readonlypending:readonlyDelta[];
/** The rows of each path: an index of the rows, made again from them. */readonlybyPath:ReadonlyMap<string, readonlyVersion[]>;
/** The ids some row replaced: what makes a version no longer a head. */readonlyreplaced:ReadonlySet<VersionId>;
/** The numbers held of each replica's rows. */readonlyseqs:ReadonlyMap<string, ReadonlySet<number>>;
/** The highest number of the rows of this replica. */readonlyownSeq:number;
};
A replica: its rows and blobs, who it is, the last id time it made or took, and the deltas it holds back until what they wait for arrives.
The changes of one transaction made to a replica, as one delta: every change is a new row with its own id, after the last, that replaces the heads of its path that the replica sees. The bytes of the blobs named are given.