Skip to main content

GenericStoredVec

Trait GenericStoredVec 

Source
pub trait GenericStoredVec<I, T>: AnyStoredVec
where I: VecIndex, T: VecValue,
{ const SIZE_OF_T: usize = _;
Show 50 methods // Required methods fn read_value_from_bytes(&self, bytes: &[u8]) -> Result<T>; fn write_value_to(&self, value: &T, buf: &mut Vec<u8>); fn pushed(&self) -> &[T]; fn mut_pushed(&mut self) -> &mut Vec<T>; fn reset(&mut self) -> Result<()>; // Provided methods fn create_reader(&self) -> Reader { ... } fn read(&self, index: I, reader: &Reader) -> Result<T> { ... } fn read_once(&self, index: I) -> Result<T> { ... } fn read_at(&self, index: usize, reader: &Reader) -> Result<T> { ... } fn write_values_to(&self, values: &[T], buf: &mut Vec<u8>) { ... } fn read_at_once(&self, index: usize) -> Result<T> { ... } fn read_unwrap(&self, index: I, reader: &Reader) -> T { ... } fn read_unwrap_once(&self, index: I) -> T { ... } fn read_at_unwrap(&self, index: usize, reader: &Reader) -> T { ... } fn read_at_unwrap_once(&self, index: usize) -> T { ... } fn get_pushed_or_read(&self, index: I, reader: &Reader) -> Result<Option<T>> { ... } fn get_pushed_or_read_once(&self, index: I) -> Result<Option<T>> { ... } fn get_pushed_or_read_unwrap(&self, index: I, reader: &Reader) -> T { ... } fn get_pushed_or_read_unwrap_once(&self, index: I) -> T { ... } fn get_pushed_or_read_at( &self, index: usize, reader: &Reader, ) -> Result<Option<T>> { ... } fn get_pushed_or_read_at_once(&self, index: usize) -> Result<Option<T>> { ... } fn get_pushed_or_read_at_unwrap(&self, index: usize, reader: &Reader) -> T { ... } fn get_pushed_or_read_at_unwrap_once(&self, index: usize) -> T { ... } fn get_pushed_at(&self, index: usize, stored_len: usize) -> Option<&T> { ... } fn len_(&self) -> usize { ... } fn pushed_len(&self) -> usize { ... } fn is_pushed_empty(&self) -> bool { ... } fn has(&self, index: I) -> bool { ... } fn has_at(&self, index: usize) -> bool { ... } fn push(&mut self, value: T) { ... } fn checked_push(&mut self, index: I, value: T) -> Result<()> { ... } fn checked_push_at(&mut self, index: usize, value: T) -> Result<()> { ... } fn truncate_push(&mut self, index: I, value: T) -> Result<()> { ... } fn truncate_push_at(&mut self, index: usize, value: T) -> Result<()> { ... } fn batch_limit_reached(&self) -> bool { ... } fn fill_to(&mut self, target_len: usize, value: T) -> Result<()> where T: Copy { ... } fn truncate_if_needed(&mut self, index: I) -> Result<()> { ... } fn truncate_if_needed_at(&mut self, index: usize) -> Result<()> { ... } fn truncate_if_needed_with_stamp( &mut self, index: I, stamp: Stamp, ) -> Result<()> { ... } fn clear(&mut self) -> Result<()> { ... } fn reset_unsaved(&mut self) { ... } fn validate_computed_version_or_reset( &mut self, dep_version: Version, ) -> Result<()> { ... } fn is_dirty(&self) -> bool { ... } fn changes_path(&self) -> PathBuf { ... } fn stamped_write_maybe_with_changes( &mut self, stamp: Stamp, with_changes: bool, ) -> Result<()> { ... } fn stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()> { ... } fn rollback_before(&mut self, stamp: Stamp) -> Result<Stamp> { ... } fn rollback(&mut self) -> Result<()> { ... } fn deserialize_then_undo_changes(&mut self, bytes: &[u8]) -> Result<()> { ... } fn vec_region_name(&self) -> String { ... }
}

Provided Associated Constants§

Required Methods§

Source

fn read_value_from_bytes(&self, bytes: &[u8]) -> Result<T>

Deserializes a value from bytes. Implementors use their strategy.

Source

fn write_value_to(&self, value: &T, buf: &mut Vec<u8>)

Writes a value to the provided buffer. Implementors use their strategy.

Source

fn pushed(&self) -> &[T]

Returns the current pushed (uncommitted) values.

Source

fn mut_pushed(&mut self) -> &mut Vec<T>

Returns a mutable reference to the current pushed (uncommitted) values.

Source

fn reset(&mut self) -> Result<()>

Resets the vector state.

Provided Methods§

Source

fn create_reader(&self) -> Reader

Creates a reader to the underlying region. Be careful with deadlocks - drop the reader before mutable ops.

Source

fn read(&self, index: I, reader: &Reader) -> Result<T>

Reads value at index using provided reader.

Source

fn read_once(&self, index: I) -> Result<T>

Reads value at index, creating a temporary reader. For multiple reads, prefer read() with a reused reader.

Source

fn read_at(&self, index: usize, reader: &Reader) -> Result<T>

Reads value at usize index using provided reader.

Source

fn write_values_to(&self, values: &[T], buf: &mut Vec<u8>)

Writes multiple values to the provided buffer.

Source

fn read_at_once(&self, index: usize) -> Result<T>

Reads value at usize index, creating a temporary reader. For multiple reads, prefer read_at() with a reused reader.

Source

fn read_unwrap(&self, index: I, reader: &Reader) -> T

Reads value at index using provided reader. Panics if read fails.

Source

fn read_unwrap_once(&self, index: I) -> T

Reads value at index, creating a temporary reader. Panics if read fails. For multiple reads, prefer read_unwrap() with a reused reader.

Source

fn read_at_unwrap(&self, index: usize, reader: &Reader) -> T

Reads value at usize index using provided reader. Panics if read fails.

Source

fn read_at_unwrap_once(&self, index: usize) -> T

Reads value at usize index, creating a temporary reader. Panics if read fails. For multiple reads, prefer read_at_unwrap() with a reused reader.

Source

fn get_pushed_or_read(&self, index: I, reader: &Reader) -> Result<Option<T>>

Gets value from pushed layer or storage using provided reader.

Source

fn get_pushed_or_read_once(&self, index: I) -> Result<Option<T>>

Gets value from pushed layer or storage, creating a temporary reader. For multiple reads, prefer get_pushed_or_read() with a reused reader.

Source

fn get_pushed_or_read_unwrap(&self, index: I, reader: &Reader) -> T

Gets value from pushed layer or storage using provided reader, unwrapping the result. Panics if the read fails or if the value doesn’t exist.

Source

fn get_pushed_or_read_unwrap_once(&self, index: I) -> T

Gets value from pushed layer or storage, unwrapping the result. Panics if the read fails or if the value doesn’t exist. For multiple reads, prefer get_pushed_or_read_unwrap() with a reused reader.

Source

fn get_pushed_or_read_at( &self, index: usize, reader: &Reader, ) -> Result<Option<T>>

Gets value from pushed layer or storage at usize index using provided reader. Does not check the updated layer.

Source

fn get_pushed_or_read_at_once(&self, index: usize) -> Result<Option<T>>

Gets value from pushed layer or storage at usize index, creating a temporary reader. For multiple reads, prefer get_pushed_or_read_at() with a reused reader.

Source

fn get_pushed_or_read_at_unwrap(&self, index: usize, reader: &Reader) -> T

Gets value from pushed layer or storage at usize index using provided reader, unwrapping the result. Panics if the read fails or if the value doesn’t exist.

Source

fn get_pushed_or_read_at_unwrap_once(&self, index: usize) -> T

Gets value from pushed layer or storage at usize index, unwrapping the result. Panics if the read fails or if the value doesn’t exist. For multiple reads, prefer get_pushed_or_read_at_unwrap() with a reused reader.

Source

fn get_pushed_at(&self, index: usize, stored_len: usize) -> Option<&T>

Gets value from pushed layer only (no disk reads).

Source

fn len_(&self) -> usize

Returns the length including both stored and pushed (uncommitted) values.

Named len_ to avoid conflict with AnyVec::len. Total length = stored_len() + pushed_len()

Source

fn pushed_len(&self) -> usize

Returns the number of pushed (uncommitted) values in the memory buffer.

Source

fn is_pushed_empty(&self) -> bool

Returns true if there are no pushed (uncommitted) values.

Source

fn has(&self, index: I) -> bool

Returns true if the index is within the length.

Source

fn has_at(&self, index: usize) -> bool

Returns true if the usize index is within the length.

Source

fn push(&mut self, value: T)

Pushes a new value to the end of the vector.

Source

fn checked_push(&mut self, index: I, value: T) -> Result<()>

Pushes a value at the given index, erroring if index != current length. Use this when you expect to always append in order.

Source

fn checked_push_at(&mut self, index: usize, value: T) -> Result<()>

Pushes a value at the given usize index, erroring if index != current length. Use this when you expect to always append in order.

Source

fn truncate_push(&mut self, index: I, value: T) -> Result<()>

Pushes a value at the given index, truncating if necessary.

Source

fn truncate_push_at(&mut self, index: usize, value: T) -> Result<()>

Pushes a value at the given usize index, truncating if necessary.

Source

fn batch_limit_reached(&self) -> bool

Returns true if the pushed cache has reached the batch limit (~1GiB).

When this limit is reached, the caller should flush to disk before continuing. This prevents excessive memory usage during bulk operations.

Source

fn fill_to(&mut self, target_len: usize, value: T) -> Result<()>
where T: Copy,

Extends the vector to target_len, filling with value. Batches writes in ~1GB chunks to avoid memory explosion.

Source

fn truncate_if_needed(&mut self, index: I) -> Result<()>

Truncates the vector to the given index if the current length exceeds it.

Source

fn truncate_if_needed_at(&mut self, index: usize) -> Result<()>

Truncates the vector to the given usize index if the current length exceeds it.

Source

fn truncate_if_needed_with_stamp( &mut self, index: I, stamp: Stamp, ) -> Result<()>

Truncates the vector to the given index if needed, updating the stamp.

Source

fn clear(&mut self) -> Result<()>

Clears all values from the vector.

Source

fn reset_unsaved(&mut self)

Resets uncommitted changes.

Source

fn validate_computed_version_or_reset( &mut self, dep_version: Version, ) -> Result<()>

Validates the computed version against the stored version, resetting if they don’t match. Automatically includes the vec’s own version - only pass dependency versions.

Source

fn is_dirty(&self) -> bool

Returns true if there are uncommitted changes (pushed values).

Source

fn changes_path(&self) -> PathBuf

Returns the path to the changes directory for this vector.

Source

fn stamped_write_maybe_with_changes( &mut self, stamp: Stamp, with_changes: bool, ) -> Result<()>

Flushes with the given stamp, optionally saving changes for rollback.

Source

fn stamped_write_with_changes(&mut self, stamp: Stamp) -> Result<()>

Flushes with the given stamp, saving changes to enable rollback.

Source

fn rollback_before(&mut self, stamp: Stamp) -> Result<Stamp>

Rolls back changes to before the given stamp.

Source

fn rollback(&mut self) -> Result<()>

Rolls back the most recent change set.

Source

fn deserialize_then_undo_changes(&mut self, bytes: &[u8]) -> Result<()>

Deserializes change data and undoes those changes. Base implementation handles pushed and truncated data. RawVecInner overrides for holes/updated.

Source

fn vec_region_name(&self) -> String

Returns the region name for this vector.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I, T> GenericStoredVec<I, T> for BytesVec<I, T>
where I: VecIndex, T: BytesVecValue,

Source§

impl<I, T> GenericStoredVec<I, T> for LZ4Vec<I, T>
where I: VecIndex, T: LZ4VecValue,

Source§

impl<I, T> GenericStoredVec<I, T> for PcoVec<I, T>
where I: VecIndex, T: PcoVecValue,

Source§

impl<I, T> GenericStoredVec<I, T> for ZeroCopyVec<I, T>

Source§

impl<I, T> GenericStoredVec<I, T> for ZstdVec<I, T>
where I: VecIndex, T: ZstdVecValue,

Source§

impl<I, T, S> GenericStoredVec<I, T> for RawVecInner<I, T, S>
where I: VecIndex, T: VecValue, S: RawStrategy<T>,

Source§

impl<V> GenericStoredVec<<V as TypedVec>::I, <V as TypedVec>::T> for EagerVec<V>
where V: StoredVec,