EditsJournalOptions.documentId
property · packages/sync/src/journal.ts:589
readonly documentId: stringThe document whose edits the table reads.
Sync / foldkit-sync/journal
interface · packages/sync/src/journal.ts:587
interface EditsJournalOptions<Shared, Principal, Change, Absorbed = never> {
readonly documentId: string
readonly journal: Journal<Operation, Shared, Principal, WrittenOperation>
readonly editsOf: (operation: Operation) => Option.Option<{
readonly changes: ReadonlyArray<Change>
readonly at: Option.Option<number>
}>
readonly apply: (change: Change, at: number) => Effect.Effect<void, unknown>
readonly tableRevision: Effect.Effect<number, unknown>
readonly holdsThrough: (snapshot: Shared, through: number) => boolean
readonly asServer?:
| {
readonly journal: ServerJournal<Absorbed, any>
readonly absorbed: (through: number) => Absorbed
}
| undefined
readonly absorbed?:
((through: number, cursor: number) => WrittenOperation) | undefined
readonly server?: Principal | undefined
}EditsJournalOptions.documentIdproperty · packages/sync/src/journal.ts:589
readonly documentId: stringThe document whose edits the table reads.
EditsJournalOptions.journalproperty · packages/sync/src/journal.ts:591
readonly journal: Journal<Operation, Shared, Principal, WrittenOperation>The journal the edits commit to.
EditsJournalOptions.editsOfproperty · packages/sync/src/journal.ts:597
readonly editsOf: (operation: Operation) => Option.Option<{
readonly changes: ReadonlyArray<Change>
readonly at: Option.Option<number>
}>The cells an operation edits, with the sequence its stamp wrote in; none for an operation that edits nothing. An edit committed without a sequence is not this journal's: its intents fail rather than write revision 0.
EditsJournalOptions.applyproperty · packages/sync/src/journal.ts:612
readonly apply: (change: Change, at: number) => Effect.Effect<void, unknown>Writes one committed change to the table, with the sequence it committed
at. It runs as a recovery intent, so it may run again after a crash: it
must never move a row back (revision <= at). A failure stops recovery
there, and the next settle tries it again.
It cannot refuse an edit: the edit has committed. One naming a row the
table lacks is refused at commit instead, by the journal's validate,
so its sender is told; let through, it would change nothing and vanish
once absorbed.
EditsJournalOptions.tableRevisionproperty · packages/sync/src/journal.ts:619
readonly tableRevision: Effect.Effect<number, unknown>The highest revision the table holds. Settling refuses to start while it
is past the journal's cursor (TableAheadOfJournalError), since every
edit would then be skipped and counted absorbed; it asks again on each
settle until the two agree.
EditsJournalOptions.holdsThroughproperty · packages/sync/src/journal.ts:621
readonly holdsThrough: (snapshot: Shared, through: number) => booleanWhether the snapshot still keeps an edit committed through through: whether to absorb.
EditsJournalOptions.asServerproperty · packages/sync/src/journal.ts:629
readonly asServer?:
| {
readonly journal: ServerJournal<Absorbed, any>
readonly absorbed: (through: number) => Absorbed
}
| undefinedRecords that the table holds every edit through through, as the
server: absorbed(through) is the server-only Message the replicas drop
those edits on hearing, appended under the key absorbed/<through>. The
log is compacted no further than the server journal's settledThrough,
so its reactions see every commit first.
EditsJournalOptions.absorbedproperty · packages/sync/src/journal.ts:641
readonly absorbed?:
((through: number, cursor: number) => WrittenOperation) | undefinedDeclare the Message serverOnly and pass asServer; removed
in the next release. The server's operation saying the table holds every
edit through through, sequenced from cursor, the journal's, appended
as written.
EditsJournalOptions.serverproperty · packages/sync/src/journal.ts:643
readonly server?: Principal | undefinedWith absorbed: who the server commits it as.