optimize with SmallString; consolidate related re-exports

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2025-02-08 00:16:37 +00:00 committed by strawberry
commit b872f8e593
39 changed files with 113 additions and 96 deletions

View file

@ -1,7 +1,7 @@
use std::{borrow::Borrow, fmt::Debug, mem::size_of_val, sync::Arc};
pub use conduwuit::pdu::{ShortEventId, ShortId, ShortRoomId};
use conduwuit::{err, implement, utils, utils::IterStream, Result};
pub use conduwuit::pdu::{ShortEventId, ShortId, ShortRoomId, ShortStateKey};
use conduwuit::{err, implement, utils, utils::IterStream, Result, StateKey};
use database::{Deserialized, Get, Map, Qry};
use futures::{Stream, StreamExt};
use ruma::{events::StateEventType, EventId, RoomId};
@ -28,7 +28,6 @@ struct Services {
}
pub type ShortStateHash = ShortId;
pub type ShortStateKey = ShortId;
impl crate::Service for Service {
fn build(args: crate::Args<'_>) -> Result<Arc<Self>> {
@ -181,7 +180,7 @@ where
pub async fn get_statekey_from_short(
&self,
shortstatekey: ShortStateKey,
) -> Result<(StateEventType, String)> {
) -> Result<(StateEventType, StateKey)> {
const BUFSIZE: usize = size_of::<ShortStateKey>();
self.db
@ -200,7 +199,7 @@ pub async fn get_statekey_from_short(
pub fn multi_get_statekey_from_short<'a, S>(
&'a self,
shortstatekey: S,
) -> impl Stream<Item = Result<(StateEventType, String)>> + Send + 'a
) -> impl Stream<Item = Result<(StateEventType, StateKey)>> + Send + 'a
where
S: Stream<Item = ShortStateKey> + Send + 'a,
{