Files
continuwuity/src/database/map/keys.rs
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
618 B
Rust
Raw Normal View History

2024-12-14 21:58:01 -05:00
use conduwuit::{implement, Result};
2024-08-08 17:18:30 +00:00
use futures::{Stream, StreamExt};
use serde::Deserialize;
use crate::{keyval, keyval::Key, stream, stream::Cursor};
2024-08-08 17:18:30 +00:00
#[implement(super::Map)]
pub fn keys<'a, K>(&'a self) -> impl Stream<Item = Result<Key<'_, K>>> + Send
where
K: Deserialize<'a> + Send,
{
self.raw_keys().map(keyval::result_deserialize_key::<K>)
}
#[implement(super::Map)]
#[tracing::instrument(skip(self), fields(%self), level = "trace")]
pub fn raw_keys(&self) -> impl Stream<Item = Result<Key<'_>>> + Send {
2024-12-08 03:02:28 +00:00
let opts = super::iter_options_default();
stream::Keys::new(&self.db, &self.cf, opts).init(None)
2024-08-08 17:18:30 +00:00
}