Skip to main content

DupSuber

Struct DupSuber 

Source
pub struct DupSuber<C: ValueCodec = Utf8Codec> {
    pub base: SuberBase<C>,
}
Expand description

Represents a Duplicate Suber, allowing multiple values (duplicates) at each key.

Do not use if serialized value is greater than 511 bytes. This is a limitation of dupsort==True sub dbs in LMDB.

Fields§

§base: SuberBase<C>

Implementations§

Source§

impl<C: ValueCodec> DupSuber<C>

Source

pub fn new( db: Arc<LMDBer>, subkey: &str, sep: Option<u8>, verify: bool, ) -> Result<Self, SuberError>

Creates a new DupSuber.

Source

pub fn is_dupsort(&self) -> bool

Source

pub fn put<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>( &self, keys: &[K], vals: &[&V], ) -> Result<bool, SuberError>

Puts all vals at key made from keys. Does not overwrite. Adds to existing dup values at key if any. Duplicate means another entry at the same key but the entry is still a unique value. Duplicates are inserted in lexicographic order not insertion order. LMDB does not insert a duplicate unless it is a unique value for that key.

Source

pub fn add<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>( &self, keys: &[K], val: &V, ) -> Result<bool, SuberError>

Add val to vals at key made from keys. Does not overwrite. Adds to existing dup values at key if any. Duplicate means another entry at the same key but the entry is still a unique value. Duplicates are inserted in lexicographic order not insertion order. LMDB does not insert a duplicate unless it is a unique value for that key.

Source

pub fn pin<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>( &self, keys: &[K], vals: &[&V], ) -> Result<bool, SuberError>

Pins (sets) vals at key made from keys. Overwrites. Removes all pre-existing dup vals and replaces them with vals.

Source

pub fn get<K: AsRef<[u8]>, R: TryFrom<Vec<u8>>>( &self, keys: &[K], ) -> Result<Vec<R>, SuberError>
where <R as TryFrom<Vec<u8>>>::Error: Debug,

Gets dup vals list at key made from keys.

Source

pub fn get_last<K: AsRef<[u8]>, R: TryFrom<Vec<u8>>>( &self, keys: &[K], ) -> Result<Option<R>, SuberError>
where <R as TryFrom<Vec<u8>>>::Error: Debug,

Gets the last duplicate value at key made from keys

§Arguments
  • keys: An array slice of key parts to be combined to form key
§Returns

Result<Option<R>, SuberError> - Deserialized value if found, None if no value at key, or an error if deserialization fails

Source

pub fn get_iter<K: AsRef<[u8]>, R: TryFrom<Vec<u8>> + 'static>( &self, keys: &[K], ) -> Result<impl Iterator<Item = Result<R, SuberError>>, SuberError>
where <R as TryFrom<Vec<u8>>>::Error: Debug, SuberError: From<<R as TryFrom<Vec<u8>>>::Error>,

Gets dup vals iterator at key made from keys. Duplicates are retrieved in lexicographic order not insertion order.

Source

pub fn get_item_iter<K: AsRef<[u8]>>( &self, keys: &[K], topive: bool, ) -> Result<Vec<(Vec<Vec<u8>>, Vec<u8>)>, SuberError>

Source

pub fn cnt<K: AsRef<[u8]>>(&self, keys: &[K]) -> Result<usize, SuberError>

Return count of dup values at key made from keys, zero otherwise

Source

pub fn rem<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>( &self, keys: &[K], val: Option<&V>, ) -> Result<bool, SuberError>

Removes entry or specific value at keys

If val is provided, remove only that value at the key. If val is None, remove all values at the key.

Auto Trait Implementations§

§

impl<C> Freeze for DupSuber<C>

§

impl<C> RefUnwindSafe for DupSuber<C>
where C: RefUnwindSafe,

§

impl<C> Send for DupSuber<C>
where C: Send,

§

impl<C> Sync for DupSuber<C>
where C: Sync,

§

impl<C> Unpin for DupSuber<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for DupSuber<C>

§

impl<C> UnwindSafe for DupSuber<C>
where C: 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> 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 = 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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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