Skip to main content

SlabView

Struct SlabView 

Source
pub struct SlabView<'a> { /* private fields */ }
Expand description

Parsed slab: header + drop records + view onto the solid window.

bytes borrows the underlying slab buffer for lifetime 'a. The plaintext_for accessor returns slices that borrow from bytes, so callers can keep those slices around as long as the slab buffer itself stays alive.

Implementations§

Source§

impl SlabView<'_>

Source

pub const fn header(&self) -> SlabHeader

The slab header.

Source

pub fn drop_records(&self) -> &[DropRecord]

All drop records in this slab, in declaration order.

Source

pub const fn solid_window_offset(&self) -> usize

Byte offset where the solid window begins (i.e. immediately after the last drop record). Useful for diagnostics.

Source

pub fn find_record(&self, drop_id: &[u8; 32]) -> Option<&DropRecord>

Find a drop record by its DropId. Linear scan.

Source

pub fn plaintext_for( &self, drop_id: &[u8; 32], ) -> Option<Result<Vec<u8>, CoreError>>

Return the plaintext bytes for drop_id, or None if no drop in this slab carries that id.

Supports both store (0x00) and LZ4 (0x01) codecs. LZ4 drops are decompressed on read. Non-plaintext AEADs and non-zero solid_window_index are still rejected (v0.1 limitations).

Returns owned bytes (not a borrowed slice) because LZ4 decompression produces new data that does not live in the slab buffer.

§Errors
Source

pub fn plaintext_for_with_dict_lookup( &self, drop_id: &[u8; 32], dict_lookup: &dyn Fn(u8) -> Option<Vec<u8>>, ) -> Option<Result<Vec<u8>, CoreError>>

Same as plaintext_for but with a callback to resolve dict_id → dictionary bytes. Used by SlabStore when the manifest’s dictionary_section is populated. For drops with dict_id == NO_DICT (0xFF), the callback is not consulted.

The callback returns the raw dictionary bytes for the given dict_id, or None if the dict is unknown (which makes the drop undecodable).

Source

pub fn plaintext_range( &self, drop_id: &[u8; 32], off: u64, len: usize, ) -> Option<Result<Vec<u8>, CoreError>>

Decompress only the plaintext bytes at [off, off+len) of drop_id.

Seekable (slab v2) drops decode only the covering container frames — a cold 8 KiB window costs at most one 256 KiB frame. Non-seekable drops decode the full payload and slice (the caller-side cache makes repeat windows cheap; see crate::slab_cache).

Returns None if no drop in this slab carries that id. off + len beyond the drop’s plaintext is Corrupt.

Trait Implementations§

Source§

impl<'a> Clone for SlabView<'a>

Source§

fn clone(&self) -> SlabView<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for SlabView<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SlabView<'a>

§

impl<'a> RefUnwindSafe for SlabView<'a>

§

impl<'a> Send for SlabView<'a>

§

impl<'a> Sync for SlabView<'a>

§

impl<'a> Unpin for SlabView<'a>

§

impl<'a> UnsafeUnpin for SlabView<'a>

§

impl<'a> UnwindSafe for SlabView<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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, <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.