Physical v1 segment container. See the Phase 2 segment RFC for the byte contract.
Checksums, framing, and sequence continuity establish physical integrity only. No result authorizes repair, semantic replay, or an applied checkpoint.
Summary
Functions
Validates a complete in-memory segment without retaining its records.
Physical reduction; accumulator is returned only on complete success.
Halt-aware physical traversal; errors never return a successful prefix accumulator.
Validates a segment through bounded positional reads. No writes occur.
Types
@type header_decode_error() :: store_decode_error() | :invalid_first_sequence | :invalid_segment_id | {:mismatch, :id | :store_id, term(), <<_::128>> | pos_integer()}
@type header_decode_result() :: {:ok, %Tay.Storage.Segment{ bytes: term(), count: term(), crc_state: term(), digest: term(), first_sequence: term(), footer: term(), id: term(), identity: term(), last_sequence: term(), state: term(), store_id: term() }} | {:incomplete, 44} | {:error, header_decode_error()}
@type parse_result() :: {:error, map()} | {:ok, %Tay.Storage.Segment{ bytes: term(), count: term(), crc_state: term(), digest: term(), first_sequence: term(), footer: term(), id: term(), identity: term(), last_sequence: term(), state: term(), store_id: term() }} | {:ok, %Tay.Storage.Segment{ bytes: term(), count: term(), crc_state: term(), digest: term(), first_sequence: term(), footer: term(), id: term(), identity: term(), last_sequence: term(), state: term(), store_id: term() }, term()}
Functions
@spec decode_header(term(), term()) :: header_decode_result()
@spec decode_store(term()) :: {:ok, <<_::128>>} | {:incomplete, 28} | {:error, store_decode_error()}
@spec encode_header(any()) :: {:error, :invalid_argument | :invalid_first_sequence | :invalid_segment_id | :invalid_store_id} | {:ok, <<_::32, _::_*8>>}
@spec encode_store(any()) :: {:error, :invalid_store_id} | {:ok, <<_::32, _::_*8>>}
@spec filename(any()) :: {:error, :invalid_segment_id} | {:ok, <<_::32, _::_*8>>}
@spec max_bytes() :: pos_integer()
@spec max_count() :: pos_integer()
@spec max_id() :: pos_integer()
@spec min_rotation_bytes() :: pos_integer()
@spec parse(binary(), keyword()) :: parse_result()
Validates a complete in-memory segment without retaining its records.
@spec reduce(term(), term(), acc, term(), keyword()) :: reduce_result(acc) when acc: var
Physical reduction; accumulator is returned only on complete success.
Halt-aware physical traversal; errors never return a successful prefix accumulator.
@spec scan(term(), term(), keyword()) :: parse_result()
Validates a segment through bounded positional reads. No writes occur.