struct

C0::Stream::Reader

Inherits Struct / Value / Object

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

Constructors

new(buf : Bytes)
Source
read(path : Path | String) : Reader

Read a log file into a Reader.

Source

Instance methods

block(i : Int32) : Bytes

Committed block by index: the bytes between the previous commit and this block's ETB (marker and payload excluded).

Source
block_count

Number of committed blocks.

Source
committed

The committed region of the buffer.

Source
committed_end

Offset just past the last commit marker and its payload. Zero if the buffer contains no commits.

Source
each_block

Iterate committed blocks.

Source
each_record

Iterate committed records.

Source
table

The committed region as a Table (handles an optional GS name and SOH header, then RS records).

Source
tail

Uncommitted trailing bytes — residue of an interrupted append.

Source
torn?

True if uncommitted bytes trail the last commit marker.

Source