1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-08-01 17:38:36 +00:00
conduit/src/service/rooms/outlier/mod.rs

28 lines
794 B
Rust
Raw Normal View History

mod data;
pub use data::Data;
use ruma::{EventId, signatures::CanonicalJsonObject};
2022-09-07 13:25:51 +02:00
use crate::{Result, PduEvent};
2022-10-05 12:45:54 +02:00
pub struct Service {
db: Box<dyn Data>,
}
2022-10-05 12:45:54 +02:00
impl Service {
2022-06-20 11:31:27 +02:00
/// Returns the pdu from the outlier tree.
pub fn get_outlier_pdu_json(&self, event_id: &EventId) -> Result<Option<CanonicalJsonObject>> {
self.db.get_outlier_pdu_json(event_id)
2022-06-20 11:31:27 +02:00
}
/// Returns the pdu from the outlier tree.
pub fn get_pdu_outlier(&self, event_id: &EventId) -> Result<Option<PduEvent>> {
self.db.get_outlier_pdu(event_id)
}
/// Append the PDU as an outlier.
#[tracing::instrument(skip(self, pdu))]
pub fn add_pdu_outlier(&self, event_id: &EventId, pdu: &CanonicalJsonObject) -> Result<()> {
self.db.add_pdu_outlier(event_id, pdu)
2021-08-28 11:39:33 +02:00
}
}