pub struct SegmentStore { /* private fields */ }Expand description
The on-disk spill area: numbered segment files plus their in-RAM metadata.
Implementations§
Source§impl SegmentStore
impl SegmentStore
Sourcepub fn create(dest: &Path) -> Result<Self>
pub fn create(dest: &Path) -> Result<Self>
Create the spill directory beside dest (the conversion’s output file or
directory), so disk-headroom checks and the spill share a volume.
Sourcepub fn ids(&self) -> impl Iterator<Item = SegmentId>
pub fn ids(&self) -> impl Iterator<Item = SegmentId>
The segment ids in spill (= document) order.
Sourcepub fn segment_path(&self, id: SegmentId) -> PathBuf
pub fn segment_path(&self, id: SegmentId) -> PathBuf
The path of a segment’s file (exists only after write_segment).
Sourcepub fn write_segment(
&mut self,
xml: &str,
meta: SegmentMeta,
) -> Result<SegmentId>
pub fn write_segment( &mut self, xml: &str, meta: SegmentMeta, ) -> Result<SegmentId>
Spill one or more serialized sibling subtrees as a new segment (raw, splice-ready text — see the module doc for why no wrapper is written).
Sourcepub fn wrapped_segment(&self, id: SegmentId) -> Result<String>
pub fn wrapped_segment(&self, id: SegmentId) -> Result<String>
The segment’s content wrapped for stand-alone PARSING: a _lxfragment
root carrying the namespace declarations recorded at spill time. Built
in memory — the file itself stays raw and splice-ready.
Sourcepub fn finalize_segment(&mut self, id: SegmentId, output: &str) -> Result<()>
pub fn finalize_segment(&mut self, id: SegmentId, output: &str) -> Result<()>
Replace a spilled segment with its processed, splice-ready output text (raw — no wrapper; appended verbatim at the placeholder during assembly).
Sourcepub fn read_segment(&self, id: SegmentId) -> Result<String>
pub fn read_segment(&self, id: SegmentId) -> Result<String>
The file’s current content, whichever lifecycle stage it is in.
Sourcepub fn retire_segment(&mut self, id: SegmentId) -> Result<()>
pub fn retire_segment(&mut self, id: SegmentId) -> Result<()>
Mark a segment retired: its text was inlined into an enclosing segment, so pass 2 skips it and assembly never asks for it. The file is truncated (the content lives in the outer segment now).
Sourcepub fn is_retired(&self, id: SegmentId) -> bool
pub fn is_retired(&self, id: SegmentId) -> bool
Was this segment inlined into an enclosing one?
Sourcepub fn meta(&self, id: SegmentId) -> Result<&SegmentMeta>
pub fn meta(&self, id: SegmentId) -> Result<&SegmentMeta>
The metadata recorded when the segment was spilled.