Skip to main content

Module mooncake

Module mooncake 

Source
Expand description

Mooncake JSONL primitives.

This module is producer- and consumer-agnostic: it defines the row schema, the block-hash-to-id mapping, the token-block hashing helper, and the JSONL writer. Workload-specific orchestration such as scheduling, tokenization, and parsing lives elsewhere.

The MooncakeRow schema deliberately matches the externally-authored Mooncake trace format: timestamp and delay are f64 milliseconds, and input_length/output_length/timestamp/delay accept the upstream aliases (input_tokens, output_tokens, created_time, delay_ms) on deserialization. Serialization emits the canonical names.

Structs§

AgenticMooncakeRow
One row of an agentic Mooncake replay trace.
AgenticToolEvent
Harness tool span attributed to the LLM request that consumed it.
MooncakeJsonlWriter
JSONL writer for Mooncake rows plus an optional sidecar stream.
MooncakeRow
One row of a Mooncake replay trace.
RollingHashIdMapper
Maps sequence-aware block hashes to compact, stable u64 ids.
WriterStats
Counters for what a MooncakeJsonlWriter has emitted.

Functions§

hash_token_blocks
Token-block hashing helper for the Mooncake replay schema.
ids_for_sequence_hashes
Map stable sequence hashes to compact Mooncake IDs with a shared mapper.
require_positive
Sentinel used by callers that want to bail when neither block_size nor worker count is allowed to be zero. Producers may also enforce this on their own configuration types.
sequence_hashes_for_tokens
Derive the sequence-aware block hashes recorded by Dynamo request traces.
try_hash_token_blocks
Fallible token-block hashing helper for callers that want to surface invalid block-size or request-shape errors.
write_empty_files
Create both files empty (touch-equivalent), preserving directory creation semantics for callers that want a “no rows produced” outcome to still emit well-formed (empty) JSONL files.