Skip to main content

SegmentStore

Struct SegmentStore 

Source
pub struct SegmentStore { /* private fields */ }
Expand description

The on-disk spill area: numbered segment files plus their in-RAM metadata.

Implementations§

Source§

impl SegmentStore

Source

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.

Source

pub fn dir(&self) -> &Path

The spill directory (for disk-headroom checks against its volume).

Source

pub fn len(&self) -> usize

Number of segments written so far.

Source

pub fn is_empty(&self) -> bool

True when nothing has been spilled.

Source

pub fn ids(&self) -> impl Iterator<Item = SegmentId>

The segment ids in spill (= document) order.

Source

pub fn segment_path(&self, id: SegmentId) -> PathBuf

The path of a segment’s file (exists only after write_segment).

Source

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).

Source

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.

Source

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).

Source

pub fn read_segment(&self, id: SegmentId) -> Result<String>

The file’s current content, whichever lifecycle stage it is in.

Source

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).

Source

pub fn is_retired(&self, id: SegmentId) -> bool

Was this segment inlined into an enclosing one?

Source

pub fn meta(&self, id: SegmentId) -> Result<&SegmentMeta>

The metadata recorded when the segment was spilled.

Trait Implementations§

Source§

impl Debug for SegmentStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for SegmentStore

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.