pub struct MooncakeJsonlWriter { /* private fields */ }Expand description
JSONL writer for Mooncake rows plus an optional sidecar stream.
The sidecar stream is configured at construction time. Producers that do
not emit sidecar metadata pass None for sidecar_path and never call
Self::write_sidecar. When a sidecar path is configured, callers are
responsible for choosing the path – this writer does not enforce a naming
convention.
Implementations§
Source§impl MooncakeJsonlWriter
impl MooncakeJsonlWriter
Sourcepub fn create(output_path: &Path, sidecar_path: Option<&Path>) -> Result<Self>
pub fn create(output_path: &Path, sidecar_path: Option<&Path>) -> Result<Self>
Create a writer at output_path, optionally with a paired sidecar
JSONL file at sidecar_path. Parent directories are created as needed.
Sourcepub fn write_row(&mut self, row: &MooncakeRow) -> Result<()>
pub fn write_row(&mut self, row: &MooncakeRow) -> Result<()>
Append one Mooncake row.
Sourcepub fn write_agentic_row(&mut self, row: &AgenticMooncakeRow) -> Result<()>
pub fn write_agentic_row(&mut self, row: &AgenticMooncakeRow) -> Result<()>
Append one agentic Mooncake row.
Sourcepub fn write_sidecar<S: Serialize>(&mut self, sidecar: &S) -> Result<()>
pub fn write_sidecar<S: Serialize>(&mut self, sidecar: &S) -> Result<()>
Append one sidecar entry. Errors if no sidecar was configured.
Sourcepub fn has_sidecar(&self) -> bool
pub fn has_sidecar(&self) -> bool
True if a sidecar stream is configured.
Sourcepub fn stats(&self) -> WriterStats
pub fn stats(&self) -> WriterStats
Snapshot of how many rows and sidecar entries have been written so far.
Sourcepub fn finish(self) -> Result<WriterStats>
pub fn finish(self) -> Result<WriterStats>
Flush both streams and return the final stats.