Skip to main content

CHKSerializer

Struct CHKSerializer 

Source
pub struct CHKSerializer {
    pub format_num: Vec<u8>,
    pub maximum_size: usize,
    pub search_key_name: Vec<u8>,
}
Expand description

CHK-based inventory serializer. Same wire format as v8/v10 etc., but parameterised over format number, max page size and search-key name because CHK inventories live behind a content-addressable store and these settings select which on-disk layout is in use.

The plain (non-CHK) flat serializers above implement the “altered-by” hack — line-by-line regex scanning to discover per-text revisions. CHK inventories are stored differently (one CHK node per entry rather than one XML line) so that hack does not apply.

Fields§

§format_num: Vec<u8>§maximum_size: usize§search_key_name: Vec<u8>

Implementations§

Source§

impl CHKSerializer

Source

pub fn new( format_num: Vec<u8>, maximum_size: usize, search_key_name: Vec<u8>, ) -> Self

Trait Implementations§

Source§

impl InventorySerializer for CHKSerializer

Source§

fn format_num(&self) -> &[u8] ⓘ

Source§

fn support_altered_by_hack(&self) -> bool

Whether this serializer supports the “altered-by” hack — extracting per-text revision references by regex-scanning inventory lines without parsing the full XML. True for the flat XML formats (v5/v6/v7/v8); false for v4 and CHK serializers.
Source§

fn write_inventory_to_lines( &self, inv: &MutableInventory, working: bool, ) -> Result<Vec<Vec<u8>>, Error>

Serialize the inventory to a vector of byte chunks (one per line). Read more
Source§

fn read_inventory_from_lines( &self, lines: &[&[u8]], revision_id: Option<RevisionId>, ) -> Result<MutableInventory, Error>

Read an inventory from a sequence of byte-chunks (lines).
Source§

fn write_inventory_to_chunks( &self, inv: &MutableInventory, working: bool, ) -> Result<Vec<Vec<u8>>, Error>

Serialize the inventory to a vector of byte chunks (alias for lines).
Source§

fn write_inventory_to_string( &self, inv: &MutableInventory, working: bool, ) -> Result<Vec<u8>, Error>

Serialize the inventory to a single byte string.
Source§

fn write_inventory( &self, inv: &MutableInventory, f: &mut dyn Write, working: bool, ) -> Result<Vec<Vec<u8>>, Error>

Write the inventory directly to a writer.
Source§

fn read_inventory( &self, f: &mut dyn Read, revision_id: Option<RevisionId>, ) -> Result<MutableInventory, Error>

Read an inventory from a reader.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> Ungil for T
where T: Send,