pub struct IoSetSuber<C: ValueCodec = Utf8Codec> {
pub base: SuberBase<C>,
}Expand description
Represents an Insertion Ordered Set Suber.
Fields§
§base: SuberBase<C>Implementations§
Source§impl<C: ValueCodec> IoSetSuber<C>
impl<C: ValueCodec> IoSetSuber<C>
Sourcepub fn new(
db: Arc<LMDBer>,
subkey: &str,
sep: Option<u8>,
verify: bool,
) -> Result<Self, SuberError>
pub fn new( db: Arc<LMDBer>, subkey: &str, sep: Option<u8>, verify: bool, ) -> Result<Self, SuberError>
Creates a new IoSetSuber.
Sourcepub fn put<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>(
&self,
keys: &[K],
vals: &[&V],
) -> Result<bool, SuberError>
pub fn put<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>( &self, keys: &[K], vals: &[&V], ) -> Result<bool, SuberError>
Puts multiple values into the set associated with the given keys.
Adds only values that are not already present in the set for the effective key. Does not overwrite existing identical values. Values are appended in insertion order.
§Arguments
keys: An array slice of key parts.vals: An array slice of values to put.
§Returns
Ok(true) if the operation was successful (note: underlying LMDB operation might always return true here).
Ok(false) if the operation failed at the LMDB level.
Returns Err(SuberError) on key/value processing or database errors.
Sourcepub fn add<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>(
&self,
keys: &[K],
val: &V,
) -> Result<bool, SuberError>
pub fn add<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>( &self, keys: &[K], val: &V, ) -> Result<bool, SuberError>
Adds a single value idempotently to the set associated with the given keys.
If the value already exists in the set for the effective key, it is not added again.
§Arguments
keys: An array slice of key parts.val: The value to add.
§Returns
Ok(true) if the value was added (i.e., it was not already present).
Ok(false) if the value was already present.
Returns Err(SuberError) on key/value processing or database errors.
Sourcepub fn pin<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>(
&self,
keys: &[K],
vals: &[&V],
) -> Result<bool, SuberError>
pub fn pin<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>( &self, keys: &[K], vals: &[&V], ) -> Result<bool, SuberError>
Pins (sets/replaces) the values associated with the given keys.
Removes all pre-existing values for the effective key and replaces them with the provided vals.
§Arguments
keys: An array slice of key parts.vals: An array slice of the new values to set.
§Returns
Ok(true) if the operation was successful.
Ok(false) if the operation failed at the LMDB level.
Returns Err(SuberError) on key/value processing or database errors.
Pins (sets/replaces) the values associated with the given keys.
Removes all pre-existing values for the effective key and replaces them with the provided vals.
Each value is serialized using the configured ValueCodec before storage.
§Arguments
keys: An array slice of key parts.vals: An array slice of the new values to set.
§Returns
Ok(true) if the operation was successful.
Ok(false) if the operation failed at the LMDB level.
Returns Err(SuberError) on key/value processing or database errors.
Sourcepub fn get<K: AsRef<[u8]>, R: TryFrom<Vec<u8>>>(
&self,
keys: &[K],
) -> Result<Vec<R>, SuberError>
pub fn get<K: AsRef<[u8]>, R: TryFrom<Vec<u8>>>( &self, keys: &[K], ) -> Result<Vec<R>, SuberError>
Sourcepub fn get_iter<K: AsRef<[u8]>, R: TryFrom<Vec<u8>> + 'static>(
&self,
keys: &[K],
) -> Result<impl Iterator<Item = Result<R, SuberError>>, SuberError>
pub fn get_iter<K: AsRef<[u8]>, R: TryFrom<Vec<u8>> + 'static>( &self, keys: &[K], ) -> Result<impl Iterator<Item = Result<R, SuberError>>, SuberError>
Gets an iterator over the values in the set associated with the given keys.
Values are yielded in insertion order. Note: This implementation collects into a Vec first due to the underlying callback mechanism. A true iterator might require a more complex setup or modification to LMDBer.
§Arguments
keys: An array slice of key parts.
§Returns
Ok(impl Iterator<Item = Result<R, SuberError>>) yielding deserialized values.
Err(SuberError) on key processing or initial database errors.
Sourcepub fn get_last<K: AsRef<[u8]>, R: TryFrom<Vec<u8>>>(
&self,
keys: &[K],
) -> Result<Option<R>, SuberError>
pub fn get_last<K: AsRef<[u8]>, R: TryFrom<Vec<u8>>>( &self, keys: &[K], ) -> Result<Option<R>, SuberError>
Gets the last value inserted into the set for the given keys.
§Arguments
keys: An array slice of key parts.
§Returns
Ok(Some(R)) containing the deserialized last value if found.
Ok(None) if the key does not exist or the set is empty.
Err(SuberError) on key processing or database/deserialization errors.
Sourcepub fn rem<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>(
&self,
keys: &[K],
val: Option<&V>,
) -> Result<bool, SuberError>
pub fn rem<K: AsRef<[u8]>, V: ?Sized + Clone + Into<Vec<u8>>>( &self, keys: &[K], val: Option<&V>, ) -> Result<bool, SuberError>
Removes entries associated with the given keys.
If val is Some, removes the specific value from the set if it exists.
If val is None, removes all values associated with the effective key.
§Arguments
keys: An array slice of key parts.val: AnOptioncontaining the specific value to remove, orNoneto remove all.
§Returns
Ok(true) if the specified value or the entire key entry was found and removed.
Ok(false) if the specified value or key was not found.
Err(SuberError) on key/value processing or database errors.
Sourcepub fn get_item_iter<K: AsRef<[u8]>, R: TryFrom<Vec<u8>>>(
&self,
keys: &[K],
topive: bool,
) -> Result<Vec<(Vec<Vec<u8>>, R)>, SuberError>
pub fn get_item_iter<K: AsRef<[u8]>, R: TryFrom<Vec<u8>>>( &self, keys: &[K], topive: bool, ) -> Result<Vec<(Vec<Vec<u8>>, R)>, SuberError>
Returns an iterator over (keys, value) items whose effective key starts with the prefix derived from keys.
Note: Similar to get_iter, this collects results first due to the callback mechanism.
The keys returned in the tuple are split based on the separator.
§Arguments
keys: An array slice of key parts forming the prefix.topive: If true, treatkeysas a partial prefix (appends separator).
§Returns
Ok(Vec<(Vec<Vec<u8>>, R)>) containing tuples of (split key parts, deserialized value).
Err(SuberError) on key processing or database/deserialization errors.
Sourcepub fn get_full_item_iter<K: AsRef<[u8]>>(
&self,
keys: &[K],
topive: bool,
) -> Result<Vec<(Vec<Vec<u8>>, Vec<u8>)>, SuberError>
pub fn get_full_item_iter<K: AsRef<[u8]>>( &self, keys: &[K], topive: bool, ) -> Result<Vec<(Vec<Vec<u8>>, Vec<u8>)>, SuberError>
Returns an iterator over all the items including all raw items for all keys in top branch defined by keys where keys may be truncation of full branch. Returns full raw values with ordinal suffixes.
§Arguments
keys- Slice of key parts, potentially a partial keytopive- If true, treat as partial key tuple ending with separator
§Returns
Result<Vec<(Vec<Vec<u8>>, Vec<u8>)>, SuberError>- Vector of key-value pairs with raw values
Sourcepub fn trim<K: AsRef<[u8]>>(
&self,
keys: &[K],
topive: bool,
) -> Result<bool, SuberError>
pub fn trim<K: AsRef<[u8]>>( &self, keys: &[K], topive: bool, ) -> Result<bool, SuberError>
Removes all entries at keys that are in top branch with key prefix matching keys where keys may be truncation of full branch.
Sourcepub fn _tokey<K: AsRef<[u8]>>(&self, keys: &[K]) -> Vec<u8> ⓘ
pub fn _tokey<K: AsRef<[u8]>>(&self, keys: &[K]) -> Vec<u8> ⓘ
Converts a collection of keys to a single key byte vector
Sourcepub fn _ser<T: ?Sized + Clone + Into<Vec<u8>>>(
&self,
val: &T,
) -> Result<Vec<u8>, SuberError>
pub fn _ser<T: ?Sized + Clone + Into<Vec<u8>>>( &self, val: &T, ) -> Result<Vec<u8>, SuberError>
Serialize a value to bytes
Sourcepub fn _des<T: TryFrom<Vec<u8>>>(&self, val: &[u8]) -> Result<T, SuberError>
pub fn _des<T: TryFrom<Vec<u8>>>(&self, val: &[u8]) -> Result<T, SuberError>
Deserialize bytes to a value
Sourcepub fn cntAll(&self) -> Result<usize, SuberError>
pub fn cntAll(&self) -> Result<usize, SuberError>
Count all items in the database