Skip to main content

Module parser

Module parser 

Source
Expand description

Zero-copy TSJSON line parser.

Parses TSJSON (tab-separated fields with JSON payload) event lines into Event structs or partially-parsed PartialEvent records. Designed for high-throughput scanning of event shard files.

§TSJSON Format (v1, 8-field)

wall_ts_us \t agent \t itc \t parents \t type \t item_id \t data \t event_hash
  • Comment lines start with # and are returned as ParsedLine::Comment.
  • Blank/whitespace-only lines are returned as ParsedLine::Blank.
  • Data lines are split on exactly 7 tab characters (yielding 8 fields).

§Zero-copy

PartialEvent borrows &str slices from the input line wherever possible. Full parse (parse_line) copies into owned Event only after validation succeeds.

Structs§

EventParser
Streaming event parser.
PartialEvent
A partially-parsed event that borrows from the input line.

Enums§

ParseError
Errors that can occur while parsing a TSJSON line.
ParsedLine
The result of parsing a single line from a TSJSON shard file.
PartialParsedLine
The result of partially parsing a single line.

Constants§

CURRENT_VERSION
The current event log format version understood by this build of bones.
FIELD_COMMENT
The field comment line that follows the shard header.
SHARD_HEADER
The shard header line written at the top of every .events file.

Functions§

detect_version
Detect the event log format version from the first line of a shard file.
parse_line
Fully parse and validate a TSJSON line into a ParsedLine.
parse_line_partial
Parse a TSJSON line into a PartialParsedLine without deserializing the JSON payload or verifying the event hash.
parse_lines
Parse multiple TSJSON lines, skipping comments and blanks.