mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-09 19:13:03 +02:00
fix: Resolve Clippy CI failures from elided lifetime warnings
The latest Rust nightly compiler (2025-08-27) introduced the elided-named-lifetimes lint which causes Clippy CI checks to fail when an elided lifetime ('_) resolves to a named lifetime that's already in scope. This commit fixes the Clippy warnings by: - Making lifetime relationships explicit where 'a is already in scope - Keeping elided lifetimes ('_) in functions without explicit lifetime parameters - Ensuring proper lifetime handling in the database pool module Affected files (17 total): - Database map modules: Handle, Key, and KeyVal references in get, qry, keys, and stream operations - Database pool module: into_recv_seek function This change resolves the CI build failures without changing any functionality, ensuring the codebase remains compatible with the latest nightly Clippy checks.
This commit is contained in:
parent
37248a4f68
commit
b5a2e49ae4
28 changed files with 72 additions and 70 deletions
|
@ -19,7 +19,7 @@ where
|
||||||
S: Stream<Item = K> + Send + 'a,
|
S: Stream<Item = K> + Send + 'a,
|
||||||
K: AsRef<[u8]> + Send + Sync + 'a,
|
K: AsRef<[u8]> + Send + Sync + 'a,
|
||||||
{
|
{
|
||||||
fn get(self, map: &'a Arc<super::Map>) -> impl Stream<Item = Result<Handle<'_>>> + Send + 'a;
|
fn get(self, map: &'a Arc<super::Map>) -> impl Stream<Item = Result<Handle<'a>>> + Send + 'a;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K, S> Get<'a, K, S> for S
|
impl<'a, K, S> Get<'a, K, S> for S
|
||||||
|
@ -29,7 +29,7 @@ where
|
||||||
K: AsRef<[u8]> + Send + Sync + 'a,
|
K: AsRef<[u8]> + Send + Sync + 'a,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get(self, map: &'a Arc<super::Map>) -> impl Stream<Item = Result<Handle<'_>>> + Send + 'a {
|
fn get(self, map: &'a Arc<super::Map>) -> impl Stream<Item = Result<Handle<'a>>> + Send + 'a {
|
||||||
map.get_batch(self)
|
map.get_batch(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ where
|
||||||
pub(crate) fn get_batch<'a, S, K>(
|
pub(crate) fn get_batch<'a, S, K>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
keys: S,
|
keys: S,
|
||||||
) -> impl Stream<Item = Result<Handle<'_>>> + Send + 'a
|
) -> impl Stream<Item = Result<Handle<'a>>> + Send + 'a
|
||||||
where
|
where
|
||||||
S: Stream<Item = K> + Send + 'a,
|
S: Stream<Item = K> + Send + 'a,
|
||||||
K: AsRef<[u8]> + Send + Sync + 'a,
|
K: AsRef<[u8]> + Send + Sync + 'a,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use super::stream::is_cached;
|
||||||
use crate::{keyval, keyval::Key, stream};
|
use crate::{keyval, keyval::Key, stream};
|
||||||
|
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
pub fn keys<'a, K>(self: &'a Arc<Self>) -> impl Stream<Item = Result<Key<'_, K>>> + Send
|
pub fn keys<'a, K>(self: &'a Arc<Self>) -> impl Stream<Item = Result<Key<'a, K>>> + Send
|
||||||
where
|
where
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::{
|
||||||
pub fn keys_from<'a, K, P>(
|
pub fn keys_from<'a, K, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
from: &P,
|
from: &P,
|
||||||
) -> impl Stream<Item = Result<Key<'_, K>>> + Send + use<'a, K, P>
|
) -> impl Stream<Item = Result<Key<'a, K>>> + Send + use<'a, K, P>
|
||||||
where
|
where
|
||||||
P: Serialize + ?Sized + Debug,
|
P: Serialize + ?Sized + Debug,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
@ -40,7 +40,7 @@ where
|
||||||
pub fn keys_raw_from<'a, K, P>(
|
pub fn keys_raw_from<'a, K, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
from: &P,
|
from: &P,
|
||||||
) -> impl Stream<Item = Result<Key<'_, K>>> + Send + use<'a, K, P>
|
) -> impl Stream<Item = Result<Key<'a, K>>> + Send + use<'a, K, P>
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::keyval::{Key, result_deserialize_key, serialize_key};
|
||||||
pub fn keys_prefix<'a, K, P>(
|
pub fn keys_prefix<'a, K, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &P,
|
prefix: &P,
|
||||||
) -> impl Stream<Item = Result<Key<'_, K>>> + Send + use<'a, K, P>
|
) -> impl Stream<Item = Result<Key<'a, K>>> + Send + use<'a, K, P>
|
||||||
where
|
where
|
||||||
P: Serialize + ?Sized + Debug,
|
P: Serialize + ?Sized + Debug,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
@ -37,7 +37,7 @@ where
|
||||||
pub fn keys_raw_prefix<'a, K, P>(
|
pub fn keys_raw_prefix<'a, K, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &'a P,
|
prefix: &'a P,
|
||||||
) -> impl Stream<Item = Result<Key<'_, K>>> + Send + 'a
|
) -> impl Stream<Item = Result<Key<'a, K>>> + Send + 'a
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||||
K: Deserialize<'a> + Send + 'a,
|
K: Deserialize<'a> + Send + 'a,
|
||||||
|
@ -50,7 +50,7 @@ where
|
||||||
pub fn raw_keys_prefix<'a, P>(
|
pub fn raw_keys_prefix<'a, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &'a P,
|
prefix: &'a P,
|
||||||
) -> impl Stream<Item = Result<Key<'_>>> + Send + 'a
|
) -> impl Stream<Item = Result<Key<'a>>> + Send + 'a
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@ where
|
||||||
S: Stream<Item = K> + Send + 'a,
|
S: Stream<Item = K> + Send + 'a,
|
||||||
K: Serialize + Debug,
|
K: Serialize + Debug,
|
||||||
{
|
{
|
||||||
fn qry(self, map: &'a Arc<super::Map>) -> impl Stream<Item = Result<Handle<'_>>> + Send + 'a;
|
fn qry(self, map: &'a Arc<super::Map>) -> impl Stream<Item = Result<Handle<'a>>> + Send + 'a;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, K, S> Qry<'a, K, S> for S
|
impl<'a, K, S> Qry<'a, K, S> for S
|
||||||
|
@ -27,7 +27,7 @@ where
|
||||||
K: Serialize + Debug + 'a,
|
K: Serialize + Debug + 'a,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn qry(self, map: &'a Arc<super::Map>) -> impl Stream<Item = Result<Handle<'_>>> + Send + 'a {
|
fn qry(self, map: &'a Arc<super::Map>) -> impl Stream<Item = Result<Handle<'a>>> + Send + 'a {
|
||||||
map.qry_batch(self)
|
map.qry_batch(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ where
|
||||||
pub(crate) fn qry_batch<'a, S, K>(
|
pub(crate) fn qry_batch<'a, S, K>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
keys: S,
|
keys: S,
|
||||||
) -> impl Stream<Item = Result<Handle<'_>>> + Send + 'a
|
) -> impl Stream<Item = Result<Handle<'a>>> + Send + 'a
|
||||||
where
|
where
|
||||||
S: Stream<Item = K> + Send + 'a,
|
S: Stream<Item = K> + Send + 'a,
|
||||||
K: Serialize + Debug + 'a,
|
K: Serialize + Debug + 'a,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use super::rev_stream::is_cached;
|
||||||
use crate::{keyval, keyval::Key, stream};
|
use crate::{keyval, keyval::Key, stream};
|
||||||
|
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
pub fn rev_keys<'a, K>(self: &'a Arc<Self>) -> impl Stream<Item = Result<Key<'_, K>>> + Send
|
pub fn rev_keys<'a, K>(self: &'a Arc<Self>) -> impl Stream<Item = Result<Key<'a, K>>> + Send
|
||||||
where
|
where
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::{
|
||||||
pub fn rev_keys_from<'a, K, P>(
|
pub fn rev_keys_from<'a, K, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
from: &P,
|
from: &P,
|
||||||
) -> impl Stream<Item = Result<Key<'_, K>>> + Send + use<'a, K, P>
|
) -> impl Stream<Item = Result<Key<'a, K>>> + Send + use<'a, K, P>
|
||||||
where
|
where
|
||||||
P: Serialize + ?Sized + Debug,
|
P: Serialize + ?Sized + Debug,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
@ -41,7 +41,7 @@ where
|
||||||
pub fn rev_keys_raw_from<'a, K, P>(
|
pub fn rev_keys_raw_from<'a, K, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
from: &P,
|
from: &P,
|
||||||
) -> impl Stream<Item = Result<Key<'_, K>>> + Send + use<'a, K, P>
|
) -> impl Stream<Item = Result<Key<'a, K>>> + Send + use<'a, K, P>
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::keyval::{Key, result_deserialize_key, serialize_key};
|
||||||
pub fn rev_keys_prefix<'a, K, P>(
|
pub fn rev_keys_prefix<'a, K, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &P,
|
prefix: &P,
|
||||||
) -> impl Stream<Item = Result<Key<'_, K>>> + Send + use<'a, K, P>
|
) -> impl Stream<Item = Result<Key<'a, K>>> + Send + use<'a, K, P>
|
||||||
where
|
where
|
||||||
P: Serialize + ?Sized + Debug,
|
P: Serialize + ?Sized + Debug,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
@ -37,7 +37,7 @@ where
|
||||||
pub fn rev_keys_raw_prefix<'a, K, P>(
|
pub fn rev_keys_raw_prefix<'a, K, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &'a P,
|
prefix: &'a P,
|
||||||
) -> impl Stream<Item = Result<Key<'_, K>>> + Send + 'a
|
) -> impl Stream<Item = Result<Key<'a, K>>> + Send + 'a
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||||
K: Deserialize<'a> + Send + 'a,
|
K: Deserialize<'a> + Send + 'a,
|
||||||
|
@ -50,7 +50,7 @@ where
|
||||||
pub fn rev_raw_keys_prefix<'a, P>(
|
pub fn rev_raw_keys_prefix<'a, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &'a P,
|
prefix: &'a P,
|
||||||
) -> impl Stream<Item = Result<Key<'_>>> + Send + 'a
|
) -> impl Stream<Item = Result<Key<'a>>> + Send + 'a
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::{keyval, keyval::KeyVal, stream};
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
pub fn rev_stream<'a, K, V>(
|
pub fn rev_stream<'a, K, V>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send
|
||||||
where
|
where
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
V: Deserialize<'a> + Send,
|
V: Deserialize<'a> + Send,
|
||||||
|
|
|
@ -20,7 +20,7 @@ use crate::{
|
||||||
pub fn rev_stream_from<'a, K, V, P>(
|
pub fn rev_stream_from<'a, K, V, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
from: &P,
|
from: &P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + use<'a, K, V, P>
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send + use<'a, K, V, P>
|
||||||
where
|
where
|
||||||
P: Serialize + ?Sized + Debug,
|
P: Serialize + ?Sized + Debug,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
@ -55,7 +55,7 @@ where
|
||||||
pub fn rev_stream_raw_from<'a, K, V, P>(
|
pub fn rev_stream_raw_from<'a, K, V, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
from: &P,
|
from: &P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + use<'a, K, V, P>
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send + use<'a, K, V, P>
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::keyval::{KeyVal, result_deserialize, serialize_key};
|
||||||
pub fn rev_stream_prefix<'a, K, V, P>(
|
pub fn rev_stream_prefix<'a, K, V, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &P,
|
prefix: &P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + use<'a, K, V, P>
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send + use<'a, K, V, P>
|
||||||
where
|
where
|
||||||
P: Serialize + ?Sized + Debug,
|
P: Serialize + ?Sized + Debug,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
@ -50,7 +50,7 @@ where
|
||||||
pub fn rev_stream_raw_prefix<'a, K, V, P>(
|
pub fn rev_stream_raw_prefix<'a, K, V, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &'a P,
|
prefix: &'a P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + 'a
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send + 'a
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||||
K: Deserialize<'a> + Send + 'a,
|
K: Deserialize<'a> + Send + 'a,
|
||||||
|
@ -68,7 +68,7 @@ where
|
||||||
pub fn rev_raw_stream_prefix<'a, P>(
|
pub fn rev_raw_stream_prefix<'a, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &'a P,
|
prefix: &'a P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_>>> + Send + 'a
|
) -> impl Stream<Item = Result<KeyVal<'a>>> + Send + 'a
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::{keyval, keyval::KeyVal, stream};
|
||||||
#[implement(super::Map)]
|
#[implement(super::Map)]
|
||||||
pub fn stream<'a, K, V>(
|
pub fn stream<'a, K, V>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send
|
||||||
where
|
where
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
V: Deserialize<'a> + Send,
|
V: Deserialize<'a> + Send,
|
||||||
|
|
|
@ -19,7 +19,7 @@ use crate::{
|
||||||
pub fn stream_from<'a, K, V, P>(
|
pub fn stream_from<'a, K, V, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
from: &P,
|
from: &P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + use<'a, K, V, P>
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send + use<'a, K, V, P>
|
||||||
where
|
where
|
||||||
P: Serialize + ?Sized + Debug,
|
P: Serialize + ?Sized + Debug,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
@ -53,7 +53,7 @@ where
|
||||||
pub fn stream_raw_from<'a, K, V, P>(
|
pub fn stream_raw_from<'a, K, V, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
from: &P,
|
from: &P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + use<'a, K, V, P>
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send + use<'a, K, V, P>
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
|
|
@ -14,7 +14,7 @@ use crate::keyval::{KeyVal, result_deserialize, serialize_key};
|
||||||
pub fn stream_prefix<'a, K, V, P>(
|
pub fn stream_prefix<'a, K, V, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &P,
|
prefix: &P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + use<'a, K, V, P>
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send + use<'a, K, V, P>
|
||||||
where
|
where
|
||||||
P: Serialize + ?Sized + Debug,
|
P: Serialize + ?Sized + Debug,
|
||||||
K: Deserialize<'a> + Send,
|
K: Deserialize<'a> + Send,
|
||||||
|
@ -50,7 +50,7 @@ where
|
||||||
pub fn stream_raw_prefix<'a, K, V, P>(
|
pub fn stream_raw_prefix<'a, K, V, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &'a P,
|
prefix: &'a P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_, K, V>>> + Send + 'a
|
) -> impl Stream<Item = Result<KeyVal<'a, K, V>>> + Send + 'a
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||||
K: Deserialize<'a> + Send + 'a,
|
K: Deserialize<'a> + Send + 'a,
|
||||||
|
@ -68,7 +68,7 @@ where
|
||||||
pub fn raw_stream_prefix<'a, P>(
|
pub fn raw_stream_prefix<'a, P>(
|
||||||
self: &'a Arc<Self>,
|
self: &'a Arc<Self>,
|
||||||
prefix: &'a P,
|
prefix: &'a P,
|
||||||
) -> impl Stream<Item = Result<KeyVal<'_>>> + Send + 'a
|
) -> impl Stream<Item = Result<KeyVal<'a>>> + Send + 'a
|
||||||
where
|
where
|
||||||
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
P: AsRef<[u8]> + ?Sized + Debug + Sync + 'a,
|
||||||
{
|
{
|
||||||
|
|
|
@ -443,7 +443,7 @@ pub(crate) fn into_send_seek(result: stream::State<'_>) -> stream::State<'static
|
||||||
unsafe { std::mem::transmute(result) }
|
unsafe { std::mem::transmute(result) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_recv_seek(result: stream::State<'static>) -> stream::State<'_> {
|
fn into_recv_seek(result: stream::State<'static>) -> stream::State<'static> {
|
||||||
// SAFETY: This is to receive the State from the channel; see above.
|
// SAFETY: This is to receive the State from the channel; see above.
|
||||||
unsafe { std::mem::transmute(result) }
|
unsafe { std::mem::transmute(result) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,8 +215,8 @@ async fn db_lt_12(services: &Services) -> Result<()> {
|
||||||
for username in &services
|
for username in &services
|
||||||
.users
|
.users
|
||||||
.list_local_users()
|
.list_local_users()
|
||||||
.map(UserId::to_owned)
|
.map(ToOwned::to_owned)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<OwnedUserId>>()
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
let user = match UserId::parse_with_server_name(username.as_str(), &services.server.name)
|
let user = match UserId::parse_with_server_name(username.as_str(), &services.server.name)
|
||||||
|
@ -295,8 +295,8 @@ async fn db_lt_13(services: &Services) -> Result<()> {
|
||||||
for username in &services
|
for username in &services
|
||||||
.users
|
.users
|
||||||
.list_local_users()
|
.list_local_users()
|
||||||
.map(UserId::to_owned)
|
.map(ToOwned::to_owned)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<OwnedUserId>>()
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
let user = match UserId::parse_with_server_name(username.as_str(), &services.server.name)
|
let user = match UserId::parse_with_server_name(username.as_str(), &services.server.name)
|
||||||
|
|
|
@ -183,8 +183,8 @@ impl Service {
|
||||||
.services
|
.services
|
||||||
.users
|
.users
|
||||||
.list_local_users()
|
.list_local_users()
|
||||||
.map(UserId::to_owned)
|
.map(ToOwned::to_owned)
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<OwnedUserId>>()
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
let presence = self.db.get_presence(user_id).await;
|
let presence = self.db.get_presence(user_id).await;
|
||||||
|
|
|
@ -178,7 +178,7 @@ impl Service {
|
||||||
pub fn get_pushkeys<'a>(
|
pub fn get_pushkeys<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
sender: &'a UserId,
|
sender: &'a UserId,
|
||||||
) -> impl Stream<Item = &str> + Send + 'a {
|
) -> impl Stream<Item = &'a str> + Send + 'a {
|
||||||
let prefix = (sender, Interfix);
|
let prefix = (sender, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.senderkey_pusher
|
.senderkey_pusher
|
||||||
|
|
|
@ -178,7 +178,7 @@ impl Service {
|
||||||
pub fn local_aliases_for_room<'a>(
|
pub fn local_aliases_for_room<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &RoomAliasId> + Send + 'a {
|
) -> impl Stream<Item = &'a RoomAliasId> + Send + 'a {
|
||||||
let prefix = (room_id, Interfix);
|
let prefix = (room_id, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.aliasid_alias
|
.aliasid_alias
|
||||||
|
@ -188,7 +188,9 @@ impl Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self), level = "debug")]
|
#[tracing::instrument(skip(self), level = "debug")]
|
||||||
pub fn all_local_aliases<'a>(&'a self) -> impl Stream<Item = (&RoomId, &str)> + Send + 'a {
|
pub fn all_local_aliases<'a>(
|
||||||
|
&'a self,
|
||||||
|
) -> impl Stream<Item = (&'a RoomId, &'a str)> + Send + 'a {
|
||||||
self.db
|
self.db
|
||||||
.alias_roomid
|
.alias_roomid
|
||||||
.stream()
|
.stream()
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl Data {
|
||||||
target: ShortEventId,
|
target: ShortEventId,
|
||||||
from: PduCount,
|
from: PduCount,
|
||||||
dir: Direction,
|
dir: Direction,
|
||||||
) -> impl Stream<Item = (PduCount, impl Event)> + Send + '_ {
|
) -> impl Stream<Item = (PduCount, impl Event)> + Send + 'a {
|
||||||
// Query from exact position then filter excludes it (saturating_inc could skip
|
// Query from exact position then filter excludes it (saturating_inc could skip
|
||||||
// events at min/max boundaries)
|
// events at min/max boundaries)
|
||||||
let from_unsigned = from.into_unsigned();
|
let from_unsigned = from.into_unsigned();
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl Data {
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
since: u64,
|
since: u64,
|
||||||
) -> impl Stream<Item = ReceiptItem<'_>> + Send + 'a {
|
) -> impl Stream<Item = ReceiptItem<'a>> + Send + 'a {
|
||||||
type Key<'a> = (&'a RoomId, u64, &'a UserId);
|
type Key<'a> = (&'a RoomId, u64, &'a UserId);
|
||||||
type KeyVal<'a> = (Key<'a>, CanonicalJsonObject);
|
type KeyVal<'a> = (Key<'a>, CanonicalJsonObject);
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ impl Service {
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
since: u64,
|
since: u64,
|
||||||
) -> impl Stream<Item = ReceiptItem<'_>> + Send + 'a {
|
) -> impl Stream<Item = ReceiptItem<'a>> + Send + 'a {
|
||||||
self.db.readreceipts_since(room_id, since)
|
self.db.readreceipts_since(room_id, since)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ pub fn deindex_pdu(&self, shortroomid: ShortRoomId, pdu_id: &RawPduId, message_b
|
||||||
pub async fn search_pdus<'a>(
|
pub async fn search_pdus<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
query: &'a RoomQuery<'a>,
|
query: &'a RoomQuery<'a>,
|
||||||
) -> Result<(usize, impl Stream<Item = impl Event + use<>> + Send + '_)> {
|
) -> Result<(usize, impl Stream<Item = impl Event + use<>> + Send + 'a)> {
|
||||||
let pdu_ids: Vec<_> = self.search_pdu_ids(query).await?.collect().await;
|
let pdu_ids: Vec<_> = self.search_pdu_ids(query).await?.collect().await;
|
||||||
|
|
||||||
let filter = &query.criteria.filter;
|
let filter = &query.criteria.filter;
|
||||||
|
@ -137,10 +137,10 @@ pub async fn search_pdus<'a>(
|
||||||
// result is modeled as a stream such that callers don't have to be refactored
|
// result is modeled as a stream such that callers don't have to be refactored
|
||||||
// though an additional async/wrap still exists for now
|
// though an additional async/wrap still exists for now
|
||||||
#[implement(Service)]
|
#[implement(Service)]
|
||||||
pub async fn search_pdu_ids(
|
pub async fn search_pdu_ids<'a>(
|
||||||
&self,
|
&'a self,
|
||||||
query: &RoomQuery<'_>,
|
query: &'a RoomQuery<'_>,
|
||||||
) -> Result<impl Stream<Item = RawPduId> + Send + '_ + use<'_>> {
|
) -> Result<impl Stream<Item = RawPduId> + Send + 'a + use<'a>> {
|
||||||
let shortroomid = self.services.short.get_shortroomid(query.room_id).await?;
|
let shortroomid = self.services.short.get_shortroomid(query.room_id).await?;
|
||||||
|
|
||||||
let pdu_ids = self.search_pdu_ids_query_room(query, shortroomid).await;
|
let pdu_ids = self.search_pdu_ids_query_room(query, shortroomid).await;
|
||||||
|
@ -173,7 +173,7 @@ fn search_pdu_ids_query_words<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
shortroomid: ShortRoomId,
|
shortroomid: ShortRoomId,
|
||||||
word: &'a str,
|
word: &'a str,
|
||||||
) -> impl Stream<Item = RawPduId> + Send + '_ {
|
) -> impl Stream<Item = RawPduId> + Send + 'a {
|
||||||
self.search_pdu_ids_query_word(shortroomid, word)
|
self.search_pdu_ids_query_word(shortroomid, word)
|
||||||
.map(move |key| -> RawPduId {
|
.map(move |key| -> RawPduId {
|
||||||
let key = &key[prefix_len(word)..];
|
let key = &key[prefix_len(word)..];
|
||||||
|
@ -183,11 +183,11 @@ fn search_pdu_ids_query_words<'a>(
|
||||||
|
|
||||||
/// Iterate over raw database results for a word
|
/// Iterate over raw database results for a word
|
||||||
#[implement(Service)]
|
#[implement(Service)]
|
||||||
fn search_pdu_ids_query_word(
|
fn search_pdu_ids_query_word<'a>(
|
||||||
&self,
|
&'a self,
|
||||||
shortroomid: ShortRoomId,
|
shortroomid: ShortRoomId,
|
||||||
word: &str,
|
word: &'a str,
|
||||||
) -> impl Stream<Item = Val<'_>> + Send + '_ + use<'_> {
|
) -> impl Stream<Item = Val<'a>> + Send + 'a + use<'a> {
|
||||||
// rustc says const'ing this not yet stable
|
// rustc says const'ing this not yet stable
|
||||||
let end_id: RawPduId = PduId {
|
let end_id: RawPduId = PduId {
|
||||||
shortroomid,
|
shortroomid,
|
||||||
|
|
|
@ -62,7 +62,7 @@ pub async fn get_or_create_shorteventid(&self, event_id: &EventId) -> ShortEvent
|
||||||
pub fn multi_get_or_create_shorteventid<'a, I>(
|
pub fn multi_get_or_create_shorteventid<'a, I>(
|
||||||
&'a self,
|
&'a self,
|
||||||
event_ids: I,
|
event_ids: I,
|
||||||
) -> impl Stream<Item = ShortEventId> + Send + '_
|
) -> impl Stream<Item = ShortEventId> + Send + 'a
|
||||||
where
|
where
|
||||||
I: Iterator<Item = &'a EventId> + Clone + Debug + Send + 'a,
|
I: Iterator<Item = &'a EventId> + Clone + Debug + Send + 'a,
|
||||||
{
|
{
|
||||||
|
|
|
@ -388,7 +388,7 @@ impl Service {
|
||||||
pub fn get_forward_extremities<'a>(
|
pub fn get_forward_extremities<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &EventId> + Send + '_ {
|
) -> impl Stream<Item = &'a EventId> + Send + 'a {
|
||||||
let prefix = (room_id, Interfix);
|
let prefix = (room_id, Interfix);
|
||||||
|
|
||||||
self.db
|
self.db
|
||||||
|
|
|
@ -144,7 +144,7 @@ pub fn clear_appservice_in_room_cache(&self) { self.appservice_in_room_cache.wri
|
||||||
pub fn room_servers<'a>(
|
pub fn room_servers<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &ServerName> + Send + 'a {
|
) -> impl Stream<Item = &'a ServerName> + Send + 'a {
|
||||||
let prefix = (room_id, Interfix);
|
let prefix = (room_id, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.roomserverids
|
.roomserverids
|
||||||
|
@ -167,7 +167,7 @@ pub async fn server_in_room<'a>(&'a self, server: &'a ServerName, room_id: &'a R
|
||||||
pub fn server_rooms<'a>(
|
pub fn server_rooms<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
server: &'a ServerName,
|
server: &'a ServerName,
|
||||||
) -> impl Stream<Item = &RoomId> + Send + 'a {
|
) -> impl Stream<Item = &'a RoomId> + Send + 'a {
|
||||||
let prefix = (server, Interfix);
|
let prefix = (server, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.serverroomids
|
.serverroomids
|
||||||
|
@ -202,7 +202,7 @@ pub fn get_shared_rooms<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
user_a: &'a UserId,
|
user_a: &'a UserId,
|
||||||
user_b: &'a UserId,
|
user_b: &'a UserId,
|
||||||
) -> impl Stream<Item = &RoomId> + Send + 'a {
|
) -> impl Stream<Item = &'a RoomId> + Send + 'a {
|
||||||
use conduwuit::utils::set;
|
use conduwuit::utils::set;
|
||||||
|
|
||||||
let a = self.rooms_joined(user_a);
|
let a = self.rooms_joined(user_a);
|
||||||
|
@ -216,7 +216,7 @@ pub fn get_shared_rooms<'a>(
|
||||||
pub fn room_members<'a>(
|
pub fn room_members<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &UserId> + Send + 'a {
|
) -> impl Stream<Item = &'a UserId> + Send + 'a {
|
||||||
let prefix = (room_id, Interfix);
|
let prefix = (room_id, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.roomuserid_joined
|
.roomuserid_joined
|
||||||
|
@ -239,7 +239,7 @@ pub async fn room_joined_count(&self, room_id: &RoomId) -> Result<u64> {
|
||||||
pub fn local_users_in_room<'a>(
|
pub fn local_users_in_room<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &UserId> + Send + 'a {
|
) -> impl Stream<Item = &'a UserId> + Send + 'a {
|
||||||
self.room_members(room_id)
|
self.room_members(room_id)
|
||||||
.ready_filter(|user| self.services.globals.user_is_local(user))
|
.ready_filter(|user| self.services.globals.user_is_local(user))
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ pub fn local_users_in_room<'a>(
|
||||||
pub fn active_local_users_in_room<'a>(
|
pub fn active_local_users_in_room<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &UserId> + Send + 'a {
|
) -> impl Stream<Item = &'a UserId> + Send + 'a {
|
||||||
self.local_users_in_room(room_id)
|
self.local_users_in_room(room_id)
|
||||||
.filter(|user| self.services.users.is_active(user))
|
.filter(|user| self.services.users.is_active(user))
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ pub async fn room_invited_count(&self, room_id: &RoomId) -> Result<u64> {
|
||||||
pub fn room_useroncejoined<'a>(
|
pub fn room_useroncejoined<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &UserId> + Send + 'a {
|
) -> impl Stream<Item = &'a UserId> + Send + 'a {
|
||||||
let prefix = (room_id, Interfix);
|
let prefix = (room_id, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.roomuseroncejoinedids
|
.roomuseroncejoinedids
|
||||||
|
@ -288,7 +288,7 @@ pub fn room_useroncejoined<'a>(
|
||||||
pub fn room_members_invited<'a>(
|
pub fn room_members_invited<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &UserId> + Send + 'a {
|
) -> impl Stream<Item = &'a UserId> + Send + 'a {
|
||||||
let prefix = (room_id, Interfix);
|
let prefix = (room_id, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.roomuserid_invitecount
|
.roomuserid_invitecount
|
||||||
|
@ -303,7 +303,7 @@ pub fn room_members_invited<'a>(
|
||||||
pub fn room_members_knocked<'a>(
|
pub fn room_members_knocked<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &UserId> + Send + 'a {
|
) -> impl Stream<Item = &'a UserId> + Send + 'a {
|
||||||
let prefix = (room_id, Interfix);
|
let prefix = (room_id, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.roomuserid_knockedcount
|
.roomuserid_knockedcount
|
||||||
|
@ -347,7 +347,7 @@ pub async fn get_left_count(&self, room_id: &RoomId, user_id: &UserId) -> Result
|
||||||
pub fn rooms_joined<'a>(
|
pub fn rooms_joined<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
user_id: &'a UserId,
|
user_id: &'a UserId,
|
||||||
) -> impl Stream<Item = &RoomId> + Send + 'a {
|
) -> impl Stream<Item = &'a RoomId> + Send + 'a {
|
||||||
self.db
|
self.db
|
||||||
.userroomid_joined
|
.userroomid_joined
|
||||||
.keys_raw_prefix(user_id)
|
.keys_raw_prefix(user_id)
|
||||||
|
|
|
@ -81,7 +81,7 @@ pub async fn servers_route_via(&self, room_id: &RoomId) -> Result<Vec<OwnedServe
|
||||||
pub fn servers_invite_via<'a>(
|
pub fn servers_invite_via<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
) -> impl Stream<Item = &ServerName> + Send + 'a {
|
) -> impl Stream<Item = &'a ServerName> + Send + 'a {
|
||||||
type KeyVal<'a> = (Ignore, Vec<&'a ServerName>);
|
type KeyVal<'a> = (Ignore, Vec<&'a ServerName>);
|
||||||
|
|
||||||
self.db
|
self.db
|
||||||
|
|
|
@ -422,7 +422,7 @@ impl Service {
|
||||||
pub fn all_device_ids<'a>(
|
pub fn all_device_ids<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
user_id: &'a UserId,
|
user_id: &'a UserId,
|
||||||
) -> impl Stream<Item = &DeviceId> + Send + 'a {
|
) -> impl Stream<Item = &'a DeviceId> + Send + 'a {
|
||||||
let prefix = (user_id, Interfix);
|
let prefix = (user_id, Interfix);
|
||||||
self.db
|
self.db
|
||||||
.userdeviceid_metadata
|
.userdeviceid_metadata
|
||||||
|
@ -770,7 +770,7 @@ impl Service {
|
||||||
user_id: &'a UserId,
|
user_id: &'a UserId,
|
||||||
from: u64,
|
from: u64,
|
||||||
to: Option<u64>,
|
to: Option<u64>,
|
||||||
) -> impl Stream<Item = &UserId> + Send + 'a {
|
) -> impl Stream<Item = &'a UserId> + Send + 'a {
|
||||||
self.keys_changed_user_or_room(user_id.as_str(), from, to)
|
self.keys_changed_user_or_room(user_id.as_str(), from, to)
|
||||||
.map(|(user_id, ..)| user_id)
|
.map(|(user_id, ..)| user_id)
|
||||||
}
|
}
|
||||||
|
@ -781,7 +781,7 @@ impl Service {
|
||||||
room_id: &'a RoomId,
|
room_id: &'a RoomId,
|
||||||
from: u64,
|
from: u64,
|
||||||
to: Option<u64>,
|
to: Option<u64>,
|
||||||
) -> impl Stream<Item = (&UserId, u64)> + Send + 'a {
|
) -> impl Stream<Item = (&'a UserId, u64)> + Send + 'a {
|
||||||
self.keys_changed_user_or_room(room_id.as_str(), from, to)
|
self.keys_changed_user_or_room(room_id.as_str(), from, to)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,7 +790,7 @@ impl Service {
|
||||||
user_or_room_id: &'a str,
|
user_or_room_id: &'a str,
|
||||||
from: u64,
|
from: u64,
|
||||||
to: Option<u64>,
|
to: Option<u64>,
|
||||||
) -> impl Stream<Item = (&UserId, u64)> + Send + 'a {
|
) -> impl Stream<Item = (&'a UserId, u64)> + Send + 'a {
|
||||||
type KeyVal<'a> = ((&'a str, u64), &'a UserId);
|
type KeyVal<'a> = ((&'a str, u64), &'a UserId);
|
||||||
|
|
||||||
let to = to.unwrap_or(u64::MAX);
|
let to = to.unwrap_or(u64::MAX);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue