Skip to main content

HotArchive

Struct HotArchive 

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

A znippy archive in its hot phase: blobs appended in place, index rows in a journal beside it.

open reads the journal once (O(rows)); every append after that is O(what is appended). Holding the rows in memory is what buys that, and it is the same set of rows the old path decoded per append.

Implementations§

Source§

impl HotArchive

Source

pub fn open(archive: &Path, level: i32, policy: SkipPolicy) -> Result<Self>

Open archive for hot appends, creating it if absent.

Three entry states, all handled here so no caller has to know which it is:

  • already hot — journal segments exist; their rows are loaded and the blob cursor is taken from the last one.
  • sealed — a static .znippy; its rows are recovered into a fresh segment and the (rebuildable) metadata tail is dropped. O(rows), once.
  • absent — a new archive at blob offset 0.
Source

pub fn is_hot(archive: &Path) -> bool

Whether archive currently has a journal — i.e. is in its hot phase.

Source

pub fn archive(&self) -> &Path

The archive path.

Source

pub fn rows(&self) -> u64

Live index rows.

Source

pub fn blob_end(&self) -> u64

Byte offset one past the last blob.

Source

pub fn append(&mut self, files: &[(String, Vec<u8>)]) -> Result<HotAppendReport>

Append files, paying only for files.

Replace semantics match append_files: a relative_path already present is superseded and its old blob bytes become dead payload.

Source

pub fn seal( self, reserved: Option<ReservedSectionBuilder>, ) -> Result<HotSealReport>

Freeze the hot archive into a static .znippy and drop the journal.

The blobs are already in place and are not touched: the seal writes the metadata tail only. reserved is the same hook ArrowIpcSink::with_reserved_builder offers, so a caller with its own sections (gunnar’s __gunnar_refs__) seals them here rather than needing a second seal.

Trait Implementations§

Source§

impl ZnippyReader for HotArchive

The hot archive reads without being sealed — that is the other half of “worth having”. Same trait the static ZnippyArchive implements, so a caller does not branch on phase.

Source§

fn list_files(&self) -> Result<Vec<String>>

Source§

fn contains(&self, relative_path: &str) -> bool

Source§

fn file_size(&self, relative_path: &str) -> Option<u64>

Source§

fn extract_file(&self, relative_path: &str) -> Result<Vec<u8>>

Source§

fn extract_files(&self, paths: &[&str]) -> Vec<Result<Vec<u8>>>

Batch extract multiple files. Default impl calls extract_file sequentially.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.