2022-06-25 16:12:23 +02:00
|
|
|
mod data;
|
|
|
|
pub use data::Data;
|
|
|
|
|
|
|
|
use crate::service::*;
|
|
|
|
|
|
|
|
pub struct Service<D: Data> {
|
|
|
|
db: D,
|
|
|
|
}
|
|
|
|
|
|
|
|
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>> {
|
2022-06-25 16:12:23 +02:00
|
|
|
self.db.get_outlier_pdu_json(event_id)
|
2022-06-20 11:31:27 +02:00
|
|
|
}
|
|
|
|
|
2021-01-14 21:32:22 -05:00
|
|
|
/// Returns the pdu from the outlier tree.
|
|
|
|
pub fn get_pdu_outlier(&self, event_id: &EventId) -> Result<Option<PduEvent>> {
|
2022-06-25 16:12:23 +02:00
|
|
|
self.db.get_outlier_pdu(event_id)
|
2021-01-14 21:32:22 -05:00
|
|
|
}
|
|
|
|
|
2021-02-03 20:00:01 -05:00
|
|
|
/// Append the PDU as an outlier.
|
2021-07-29 08:36:01 +02:00
|
|
|
#[tracing::instrument(skip(self, pdu))]
|
2021-04-16 18:18:29 +02:00
|
|
|
pub fn add_pdu_outlier(&self, event_id: &EventId, pdu: &CanonicalJsonObject) -> Result<()> {
|
2022-06-25 16:12:23 +02:00
|
|
|
self.db.add_pdu_outlier(event_id, pdu)
|
2021-08-28 11:39:33 +02:00
|
|
|
}
|
2022-06-25 16:12:23 +02:00
|
|
|
}
|