VerifyResult

sealed interface VerifyResult

Result of a SagaJournal.verify call.

All variants are fail-soft: verify never throws. Errors (tampering, bad input, misconfiguration) are surfaced through Broken.

Variants

  • Valid — every entry in the requested range re-hashed and matched its stored hash.

  • Broken — the first entry whose recomputed hash differed from the stored hash, or a pre-condition that prevents meaningful verification (bad input range, hashing disabled, no codec attached).

  • Incomplete — the requested range was larger than pageSize (or the chain itself); the caller should resume from Incomplete.resumeFromSeq to continue paginating.

Pagination contract

verify(runId, 0, Long.MAX_VALUE, pageSize = 5000) on a run of N entries produces a sequence of Incomplete results (one per page) until the final page returns either Valid or Broken. Successive calls chain as:

val r1 = journal.verify(runId, 0, Long.MAX_VALUE, 5000)       // Incomplete(resumeFromSeq = 5000, ...)
val r2 = journal.verify(runId, 5000, Long.MAX_VALUE, 5000) // Incomplete(resumeFromSeq = 10000, ...)
val r3 = journal.verify(runId, 10000, Long.MAX_VALUE, 5000) // Valid(...)

Inheritors

Types

Link copied to clipboard
data class Broken(val firstBadSeq: Long, val expected: String, val actual: String) : VerifyResult

A tamper, corruption, or precondition failure was detected.

Link copied to clipboard
data class Incomplete(val resumeFromSeq: Long, val headHash: String) : VerifyResult

The verified range was larger than one pageSize window; the caller should resume.

Link copied to clipboard
data class Valid(val headHash: String, val verifiedSeqs: LongRange) : VerifyResult

Every entry in verifiedSeqs re-hashed cleanly — no tampering detected.