re-scheme naming of stream iterator overloads

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-10-09 05:08:22 +00:00 committed by strawberry
parent 19880ce12b
commit 8258d16a94
18 changed files with 42 additions and 44 deletions

View file

@ -4,12 +4,10 @@ use conduit::implement;
use futures::stream::StreamExt;
use serde::Serialize;
use crate::de::Ignore;
/// Count the total number of entries in the map.
#[implement(super::Map)]
#[inline]
pub fn count(&self) -> impl Future<Output = usize> + Send + '_ { self.keys::<Ignore>().count() }
pub fn count(&self) -> impl Future<Output = usize> + Send + '_ { self.raw_keys().count() }
/// Count the number of entries in the map starting from a lower-bound.
///
@ -20,7 +18,7 @@ pub fn count_from<'a, P>(&'a self, from: &P) -> impl Future<Output = usize> + Se
where
P: Serialize + ?Sized + Debug + 'a,
{
self.keys_from::<Ignore, P>(from).count()
self.keys_from_raw(from).count()
}
/// Count the number of entries in the map matching a prefix.
@ -32,5 +30,5 @@ pub fn count_prefix<'a, P>(&'a self, prefix: &P) -> impl Future<Output = usize>
where
P: Serialize + ?Sized + Debug + 'a,
{
self.keys_prefix::<Ignore, P>(prefix).count()
self.keys_prefix_raw(prefix).count()
}

View file

@ -13,13 +13,13 @@ where
P: Serialize + ?Sized + Debug,
K: Deserialize<'a> + Send,
{
self.keys_raw_from(from)
self.keys_from_raw(from)
.map(keyval::result_deserialize_key::<K>)
}
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn keys_raw_from<P>(&self, from: &P) -> impl Stream<Item = Result<Key<'_>>> + Send
pub fn keys_from_raw<P>(&self, from: &P) -> impl Stream<Item = Result<Key<'_>>> + Send
where
P: Serialize + ?Sized + Debug,
{
@ -29,7 +29,7 @@ where
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn keys_from_raw<'a, K, P>(&'a self, from: &P) -> impl Stream<Item = Result<Key<'_, K>>> + Send
pub fn keys_raw_from<'a, K, P>(&'a self, from: &P) -> impl Stream<Item = Result<Key<'_, K>>> + Send
where
P: AsRef<[u8]> + ?Sized + Debug + Sync,
K: Deserialize<'a> + Send,

View file

@ -17,13 +17,13 @@ where
P: Serialize + ?Sized + Debug,
K: Deserialize<'a> + Send,
{
self.keys_raw_prefix(prefix)
self.keys_prefix_raw(prefix)
.map(keyval::result_deserialize_key::<K>)
}
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn keys_raw_prefix<P>(&self, prefix: &P) -> impl Stream<Item = Result<Key<'_>>> + Send
pub fn keys_prefix_raw<P>(&self, prefix: &P) -> impl Stream<Item = Result<Key<'_>>> + Send
where
P: Serialize + ?Sized + Debug,
{
@ -34,7 +34,7 @@ where
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn keys_prefix_raw<'a, K, P>(&'a self, prefix: &'a P) -> impl Stream<Item = Result<Key<'_, K>>> + Send + 'a
pub fn keys_raw_prefix<'a, K, P>(&'a self, prefix: &'a P) -> impl Stream<Item = Result<Key<'_, K>>> + Send + 'a
where
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
K: Deserialize<'a> + Send + 'a,

View file

@ -13,13 +13,13 @@ where
P: Serialize + ?Sized + Debug,
K: Deserialize<'a> + Send,
{
self.rev_keys_raw_from(from)
self.rev_keys_from_raw(from)
.map(keyval::result_deserialize_key::<K>)
}
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn rev_keys_raw_from<P>(&self, from: &P) -> impl Stream<Item = Result<Key<'_>>> + Send
pub fn rev_keys_from_raw<P>(&self, from: &P) -> impl Stream<Item = Result<Key<'_>>> + Send
where
P: Serialize + ?Sized + Debug,
{
@ -29,7 +29,7 @@ where
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn rev_keys_from_raw<'a, K, P>(&'a self, from: &P) -> impl Stream<Item = Result<Key<'_, K>>> + Send
pub fn rev_keys_raw_from<'a, K, P>(&'a self, from: &P) -> impl Stream<Item = Result<Key<'_, K>>> + Send
where
P: AsRef<[u8]> + ?Sized + Debug + Sync,
K: Deserialize<'a> + Send,

View file

@ -17,13 +17,13 @@ where
P: Serialize + ?Sized + Debug,
K: Deserialize<'a> + Send,
{
self.rev_keys_raw_prefix(prefix)
self.rev_keys_prefix_raw(prefix)
.map(keyval::result_deserialize_key::<K>)
}
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn rev_keys_raw_prefix<P>(&self, prefix: &P) -> impl Stream<Item = Result<Key<'_>>> + Send
pub fn rev_keys_prefix_raw<P>(&self, prefix: &P) -> impl Stream<Item = Result<Key<'_>>> + Send
where
P: Serialize + ?Sized + Debug,
{
@ -34,7 +34,7 @@ where
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn rev_keys_prefix_raw<'a, K, P>(&'a self, prefix: &'a P) -> impl Stream<Item = Result<Key<'_, K>>> + Send + 'a
pub fn rev_keys_raw_prefix<'a, K, P>(&'a self, prefix: &'a P) -> impl Stream<Item = Result<Key<'_, K>>> + Send + 'a
where
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
K: Deserialize<'a> + Send + 'a,

View file

@ -18,7 +18,7 @@ where
K: Deserialize<'a> + Send,
V: Deserialize<'a> + Send,
{
self.rev_stream_raw_from(from)
self.rev_stream_from_raw(from)
.map(keyval::result_deserialize::<K, V>)
}
@ -28,7 +28,7 @@ where
/// - Result is raw
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn rev_stream_raw_from<P>(&self, from: &P) -> impl Stream<Item = Result<KeyVal<'_>>> + Send
pub fn rev_stream_from_raw<P>(&self, from: &P) -> impl Stream<Item = Result<KeyVal<'_>>> + Send
where
P: Serialize + ?Sized + Debug,
{
@ -42,7 +42,7 @@ where
/// - Result is deserialized
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn rev_stream_from_raw<'a, K, V, P>(&'a self, from: &P) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send
pub fn rev_stream_raw_from<'a, K, V, P>(&'a self, from: &P) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send
where
P: AsRef<[u8]> + ?Sized + Debug + Sync,
K: Deserialize<'a> + Send,

View file

@ -22,7 +22,7 @@ where
K: Deserialize<'a> + Send,
V: Deserialize<'a> + Send,
{
self.rev_stream_raw_prefix(prefix)
self.rev_stream_prefix_raw(prefix)
.map(keyval::result_deserialize::<K, V>)
}
@ -32,7 +32,7 @@ where
/// - Result is raw
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn rev_stream_raw_prefix<P>(&self, prefix: &P) -> impl Stream<Item = Result<KeyVal<'_>>> + Send
pub fn rev_stream_prefix_raw<P>(&self, prefix: &P) -> impl Stream<Item = Result<KeyVal<'_>>> + Send
where
P: Serialize + ?Sized + Debug,
{
@ -47,7 +47,7 @@ where
/// - Result is deserialized
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn rev_stream_prefix_raw<'a, K, V, P>(
pub fn rev_stream_raw_prefix<'a, K, V, P>(
&'a self, prefix: &'a P,
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + 'a
where

View file

@ -18,7 +18,7 @@ where
K: Deserialize<'a> + Send,
V: Deserialize<'a> + Send,
{
self.stream_raw_from(from)
self.stream_from_raw(from)
.map(keyval::result_deserialize::<K, V>)
}
@ -28,7 +28,7 @@ where
/// - Result is raw
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn stream_raw_from<P>(&self, from: &P) -> impl Stream<Item = Result<KeyVal<'_>>> + Send
pub fn stream_from_raw<P>(&self, from: &P) -> impl Stream<Item = Result<KeyVal<'_>>> + Send
where
P: Serialize + ?Sized + Debug,
{
@ -42,7 +42,7 @@ where
/// - Result is deserialized
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn stream_from_raw<'a, K, V, P>(&'a self, from: &P) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send
pub fn stream_raw_from<'a, K, V, P>(&'a self, from: &P) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send
where
P: AsRef<[u8]> + ?Sized + Debug + Sync,
K: Deserialize<'a> + Send,

View file

@ -22,7 +22,7 @@ where
K: Deserialize<'a> + Send,
V: Deserialize<'a> + Send,
{
self.stream_raw_prefix(prefix)
self.stream_prefix_raw(prefix)
.map(keyval::result_deserialize::<K, V>)
}
@ -32,7 +32,7 @@ where
/// - Result is raw
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn stream_raw_prefix<P>(&self, prefix: &P) -> impl Stream<Item = Result<KeyVal<'_>>> + Send
pub fn stream_prefix_raw<P>(&self, prefix: &P) -> impl Stream<Item = Result<KeyVal<'_>>> + Send
where
P: Serialize + ?Sized + Debug,
{
@ -47,7 +47,7 @@ where
/// - Result is deserialized
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn stream_prefix_raw<'a, K, V, P>(
pub fn stream_raw_prefix<'a, K, V, P>(
&'a self, prefix: &'a P,
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + 'a
where