conduwuit/src/service/rooms/search/mod.rs

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

25 lines
598 B
Rust
Raw Normal View History

2022-07-10 16:28:43 +02:00
mod data;
2022-10-08 13:04:55 +02:00
pub(crate) use data::Data;
use ruma::RoomId;
2022-09-07 13:25:51 +02:00
use crate::Result;
2022-07-10 16:28:43 +02:00
pub(crate) struct Service {
pub(crate) db: &'static dyn Data,
2022-07-10 16:28:43 +02:00
}
2022-10-05 12:45:54 +02:00
impl Service {
#[tracing::instrument(skip(self))]
pub(crate) fn index_pdu(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()> {
2022-10-05 12:45:54 +02:00
self.db.index_pdu(shortroomid, pdu_id, message_body)
}
#[tracing::instrument(skip(self))]
pub(crate) fn search_pdus<'a>(
2020-08-18 12:15:27 +02:00
&'a self, room_id: &RoomId, search_string: &str,
2022-02-04 17:15:21 +01:00
) -> Result<Option<(impl Iterator<Item = Vec<u8>> + 'a, Vec<String>)>> {
2022-07-10 16:28:43 +02:00
self.db.search_pdus(room_id, search_string)
}
2022-07-10 16:28:43 +02:00
}