mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2025-12-15 03:38:56 -05:00
bit of code dedupe as well Co-authored-by: strawberry <strawberry@puppygock.gay> Signed-off-by: strawberry <strawberry@puppygock.gay>
31 lines
769 B
Rust
31 lines
769 B
Rust
mod data;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use data::Data;
|
|
use ruma::RoomId;
|
|
|
|
use crate::Result;
|
|
|
|
pub struct Service {
|
|
pub db: Arc<dyn Data>,
|
|
}
|
|
|
|
impl Service {
|
|
#[tracing::instrument(skip(self))]
|
|
pub fn index_pdu(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()> {
|
|
self.db.index_pdu(shortroomid, pdu_id, message_body)
|
|
}
|
|
|
|
#[tracing::instrument(skip(self))]
|
|
pub fn deindex_pdu(&self, shortroomid: u64, pdu_id: &[u8], message_body: &str) -> Result<()> {
|
|
self.db.deindex_pdu(shortroomid, pdu_id, message_body)
|
|
}
|
|
|
|
#[tracing::instrument(skip(self))]
|
|
pub fn search_pdus<'a>(
|
|
&'a self, room_id: &RoomId, search_string: &str,
|
|
) -> Result<Option<(impl Iterator<Item = Vec<u8>> + 'a, Vec<String>)>> {
|
|
self.db.search_pdus(room_id, search_string)
|
|
}
|
|
}
|