struct
C0::Stream::Reader
- C0::Stream::Reader
- Struct
- Value
- Object
Overview
Scans a buffer for ETB commit markers and exposes only the committed region. Zero-copy: all accessors return slices into the original buffer.
reader = C0::Stream::Reader.new(buf) reader.torn? # => true if an uncommitted tail trails reader.each_record { |rec| ... } # committed records only
Defined in:
c0/stream.crConstructors
- .new(buf : Bytes)
-
.read(path : Path | String) : Reader
Read a log file into a Reader.
Instance Method Summary
-
#block(i : Int32) : Bytes
Committed block by index: the bytes between the previous commit and this block's ETB (marker and payload excluded).
-
#block_count : Int32
Number of committed blocks.
- #buf : Bytes
-
#committed : Bytes
The committed region of the buffer.
-
#committed_end : Int32
Offset just past the last commit marker and its payload.
-
#each_block(& : Bytes -> ) : Nil
Iterate committed blocks.
-
#each_record(& : Record -> ) : Nil
Iterate committed records.
-
#table : Table
The committed region as a Table (handles an optional GS name and SOH header, then RS records).
-
#tail : Bytes
Uncommitted trailing bytes — residue of an interrupted append.
-
#torn? : Bool
True if uncommitted bytes trail the last commit marker.
Constructor Detail
Instance Method Detail
Committed block by index: the bytes between the previous commit and this block's ETB (marker and payload excluded).
Offset just past the last commit marker and its payload. Zero if the buffer contains no commits.
The committed region as a Table (handles an optional GS name and SOH header, then RS records).