Struct reth_nippy_jar::NippyJar

source ·
pub struct NippyJar<H = ()> { /* private fields */ }
Expand description

NippyJar is a specialized storage format designed for immutable data.

Data is organized into a columnar format, enabling column-based compression. Data retrieval entails consulting an offset list and fetching the data from file via mmap.

Implementations§

source§

impl NippyJar<()>

source

pub fn new_without_header(columns: usize, path: &Path) -> Self

Creates a new NippyJar without an user-defined header data.

source

pub fn load_without_header(path: &Path) -> Result<Self, NippyJarError>

Loads the file configuration and returns Self on a jar without user-defined header data.

source§

impl<H: NippyJarHeader> NippyJar<H>

source

pub fn new(columns: usize, path: &Path, user_header: H) -> Self

Creates a new NippyJar with a user-defined header data.

source

pub fn with_zstd(self, use_dict: bool, max_dict_size: usize) -> Self

Adds compression::Zstd compression.

source

pub fn with_lz4(self) -> Self

Adds compression::Lz4 compression.

source

pub const fn user_header(&self) -> &H

Gets a reference to the user header.

source

pub const fn columns(&self) -> usize

Gets total columns in jar.

source

pub const fn rows(&self) -> usize

Gets total rows in jar.

source

pub const fn compressor(&self) -> Option<&Compressors>

Gets a reference to the compressor.

source

pub fn compressor_mut(&mut self) -> Option<&mut Compressors>

Gets a mutable reference to the compressor.

source

pub fn load(path: &Path) -> Result<Self, NippyJarError>

Loads the file configuration and returns Self.

The user must ensure the header type matches the one used during the jar’s creation.

source

pub fn data_path(&self) -> &Path

Returns the path for the data file

source

pub fn index_path(&self) -> PathBuf

Returns the path for the index file

source

pub fn offsets_path(&self) -> PathBuf

Returns the path for the offsets file

source

pub fn config_path(&self) -> PathBuf

Returns the path for the config file

source

pub fn delete(self) -> Result<(), NippyJarError>

Deletes from disk this NippyJar alongside every satellite file.

source

pub fn open_data_reader(&self) -> Result<DataReader, NippyJarError>

Returns a DataReader of the data and offset file

Trait Implementations§

source§

impl<H: NippyJarHeader> Debug for NippyJar<H>

source§

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

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

impl<'de, H> Deserialize<'de> for NippyJar<H>
where H: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<H> Serialize for NippyJar<H>
where H: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<H> Freeze for NippyJar<H>
where H: Freeze,

§

impl<H> RefUnwindSafe for NippyJar<H>
where H: RefUnwindSafe,

§

impl<H> Send for NippyJar<H>
where H: Send,

§

impl<H> Sync for NippyJar<H>
where H: Sync,

§

impl<H> Unpin for NippyJar<H>
where H: Unpin,

§

impl<H> UnwindSafe for NippyJar<H>
where H: UnwindSafe,

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> NippyJarHeader for T
where T: Send + Sync + Serialize + for<'b> Deserialize<'b> + Debug + 'static,

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.