Sync / foldkit-durable
Cursors interface · packages/durable/src/journal.ts:311
interface Cursors {
readonly track : (
key: DocumentId ,
name: string ,
options?: {
readonly from?: 'cursor' | 'floor'
},
) => Effect . Effect < void , JournalError >
readonly settled : (
key: DocumentId ,
name: string ,
) => Effect . Effect < Option . Option < TrackedCursor >, JournalError >
readonly advance : (
key: DocumentId ,
name: string ,
epoch: string ,
cursor: Cursor ,
) => Effect . Effect < void , JournalError >
readonly stalled : (
key: DocumentId ,
name: string ,
epoch: string ,
at: number ,
) => Effect . Effect < void , JournalError >
readonly park : (
key: DocumentId ,
run: ParkedRun ,
) => Effect . Effect < void , JournalError >
readonly parked : (
key: DocumentId ,
) => Effect . Effect < ReadonlyArray < ParkedRun >, JournalError >
readonly unpark : (
key: DocumentId ,
name: string ,
opId: OpId ,
) => Effect . Effect < void , JournalError >
} Show all 37 lines Named cursors over documents and the runs parked behind them, stored beside
the effect ledger. Every write names the epoch it was decided in and does
nothing once that epoch is gone, so a runner holding a reset history cannot
write over the new one. reset deletes none of it: a row of another epoch
reads as 0, or as stale.
Members Cursors.track# property · packages/durable/src/journal.ts:317
readonly track: (
key: DocumentId,
name: string,
options?: {
readonly from?: 'cursor' | 'floor'
},
) => Effect. Effect<void , JournalError> Starts a cursor at the document's current cursor (or at its compaction
floor, from: 'floor') unless it exists in this epoch; one of another
epoch starts again at 0. Work tracked from here sees every later commit.
Cursors.settled# property · packages/durable/src/journal.ts:323
readonly settled: (
key: DocumentId,
name: string,
) => Effect. Effect< Option. Option< TrackedCursor> , JournalError> The cursor in the current epoch: 0 for one tracked in another, none when never tracked.
Cursors.advance# property · packages/durable/src/journal.ts:328
readonly advance: (
key: DocumentId,
name: string,
epoch: string,
cursor: Cursor,
) => Effect. Effect<void , JournalError> Moves the cursor forward, never back, clearing its failures when it moves.
Cursors.stalled# property · packages/durable/src/journal.ts:335
readonly stalled: (
key: DocumentId,
name: string,
epoch: string,
at: number,
) => Effect. Effect<void , JournalError> Counts a failed run at the commit after the cursor, at at (ms since the Unix epoch).
Cursors.park# property · packages/durable/src/journal.ts:345
readonly park: (
key: DocumentId,
run: ParkedRun,
) => Effect. Effect<void , JournalError> Sets a run aside; a run already parked in this epoch stays as it was, and
one naming an epoch that is no longer the document's is not written.
Cursors.parked# property · packages/durable/src/journal.ts:347
readonly parked: (
key: DocumentId,
) => Effect. Effect< ReadonlyArray< ParkedRun> , JournalError> The document's parked runs, every epoch's, by name and sequence.
Cursors.unpark# property · packages/durable/src/journal.ts:349
readonly unpark: (
key: DocumentId,
name: string,
opId: OpId,
) => Effect. Effect<void , JournalError> Forgets a parked run.