Class WalRecord

java.lang.Object
dev.frostlake.persistence.WalRecord

public final class WalRecord extends Object
One record in the write-ahead log. A WalRecordType.TRANSACTION record carries the mutating SQL statements of a single committed transaction (replayed together, as a unit); a WalRecordType.CHECKPOINT record carries the reference of a durable state snapshot that supersedes every record written before it. See WriteAheadLog.
  • Method Details

    • transaction

      public static WalRecord transaction(List<String> statements)
      A committed-transaction record holding the given statements (in execution order).
    • transaction

      public static WalRecord transaction(List<String> statements, List<Instant> statementInstants)
      A committed-transaction record that also remembers what EACH of its statements called "now". Replay puts those instants back, so a re-executed CURRENT_TIMESTAMP resolves to the value the row was originally written with rather than to the recovery time.

      One instant per statement, not one per record: live, two statements inside a single BEGIN…COMMIT get different times, so a per-record instant would flatten them together.

    • checkpoint

      public static WalRecord checkpoint(String checkpointRef)
      A checkpoint marker referencing a durable state snapshot.
    • getStatementInstant

      public Instant getStatementInstant(int index)
      What the statement at index called "now", or null when the record predates v3 and carried no instants — those replay at the wall clock, exactly as they did before.
    • getType

      public WalRecordType getType()
    • getStatements

      public List<String> getStatements()
      The transaction's statements (empty for a checkpoint record).
    • getCheckpointRef

      public String getCheckpointRef()
      The snapshot reference (null for a transaction record).