Skip to main content

read_segment_json

Function read_segment_json 

Source
pub fn read_segment_json(dir: &Path, segment_id: &str) -> Result<String, String>
Expand description

单段事件直拼为 JSON 数组文本:jsonl 每行本身即合法 JSON,串接即可, 不做 serde_json::Value 往返(P19 D2)——省掉实测 2.9GB 的中间树与二次序列化。 调用方经 raw IPC 返回字节,JS 侧一次 JSON.parse。

只做「首尾必须是大括号」的廉价校验:跳过被截断的残行(进程中途退出的典型损坏), 不做逐行 parse(那正是本函数要避免的成本)。