add raw_ overloads for prefix/from counting
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
ad117641b8
commit
ed76797b55
2 changed files with 27 additions and 0 deletions
|
@ -33,6 +33,9 @@ impl Database {
|
|||
#[inline]
|
||||
pub fn iter(&self) -> impl Iterator<Item = (&MapsKey, &MapsVal)> + Send + '_ { self.maps.iter() }
|
||||
|
||||
#[inline]
|
||||
pub fn keys(&self) -> impl Iterator<Item = &MapsKey> + Send + '_ { self.maps.keys() }
|
||||
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn is_read_only(&self) -> bool { self.db.secondary || self.db.read_only }
|
||||
|
|
|
@ -21,6 +21,18 @@ where
|
|||
self.keys_from_raw(from).count()
|
||||
}
|
||||
|
||||
/// Count the number of entries in the map starting from a lower-bound.
|
||||
///
|
||||
/// - From is a raw
|
||||
#[implement(super::Map)]
|
||||
#[inline]
|
||||
pub fn raw_count_from<'a, P>(&'a self, from: &'a P) -> impl Future<Output = usize> + Send + 'a
|
||||
where
|
||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||
{
|
||||
self.raw_keys_from(from).count()
|
||||
}
|
||||
|
||||
/// Count the number of entries in the map matching a prefix.
|
||||
///
|
||||
/// - Prefix is structured key
|
||||
|
@ -32,3 +44,15 @@ where
|
|||
{
|
||||
self.keys_prefix_raw(prefix).count()
|
||||
}
|
||||
|
||||
/// Count the number of entries in the map matching a prefix.
|
||||
///
|
||||
/// - Prefix is raw
|
||||
#[implement(super::Map)]
|
||||
#[inline]
|
||||
pub fn raw_count_prefix<'a, P>(&'a self, prefix: &'a P) -> impl Future<Output = usize> + Send + 'a
|
||||
where
|
||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||
{
|
||||
self.raw_keys_prefix(prefix).count()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue