FromOffset

data class FromOffset(val offset: Long) : ReplayScope

Every frame at or after offset — the resume cursor.

Hand back AppendResult.Written.endOffset, or Archived.endOffset of the last frame you consumed, to continue exactly where you stopped. An offset that falls inside a frame rather than on its boundary yields that frame from its start, so a cursor can never be left pointing at half a record.

Samples

// Consume what the archive holds now, remembering where each frame ended. `.frames()`
// deliberately drops the terminal verdict — fine for a cursor walk, not for anything
// that acts on the history being complete.
var cursor = 0L
bolt.replay(ReplayScope.All).frames().collect { frame ->
    ship(frame.ops)
    cursor = frame.endOffset
}

// Later — after more appends — pick up exactly there. An offset that falls inside a frame
// yields that frame from its start, so a cursor can never point at half a record.
bolt.replay(ReplayScope.FromOffset(cursor)).frames().collect { frame ->
    ship(frame.ops)
    cursor = frame.endOffset
}

Constructors

Link copied to clipboard
constructor(offset: Long)

Properties

Link copied to clipboard