2022-07-10 17:23:26 +02:00
|
|
|
mod data;
|
2022-09-06 23:15:09 +02:00
|
|
|
use std::{sync::Arc, collections::HashSet};
|
|
|
|
|
2022-07-10 17:23:26 +02:00
|
|
|
pub use data::Data;
|
2021-08-12 23:04:00 +02:00
|
|
|
|
2022-09-07 13:25:51 +02:00
|
|
|
use crate::Result;
|
2021-08-14 19:07:50 +02:00
|
|
|
|
2022-10-05 12:45:54 +02:00
|
|
|
pub struct Service {
|
|
|
|
db: Box<dyn Data>,
|
2022-07-10 17:23:26 +02:00
|
|
|
}
|
2022-06-20 12:08:58 +02:00
|
|
|
|
2022-10-05 12:45:54 +02:00
|
|
|
impl Service {
|
2022-06-19 22:56:14 +02:00
|
|
|
#[tracing::instrument(skip(self))]
|
2022-07-10 17:23:26 +02:00
|
|
|
pub fn get_cached_eventid_authchain<'a>(
|
2022-06-19 22:56:14 +02:00
|
|
|
&'a self,
|
|
|
|
key: &[u64],
|
|
|
|
) -> Result<Option<Arc<HashSet<u64>>>> {
|
2022-10-05 15:33:57 +02:00
|
|
|
self.db.get_cached_eventid_authchain(key)
|
2021-04-11 21:01:27 +02:00
|
|
|
}
|
|
|
|
|
2021-02-28 12:41:03 +01:00
|
|
|
#[tracing::instrument(skip(self))]
|
2022-07-10 17:23:26 +02:00
|
|
|
pub fn cache_auth_chain(&self, key: Vec<u64>, auth_chain: Arc<HashSet<u64>>) -> Result<()> {
|
2022-10-05 15:33:57 +02:00
|
|
|
self.db.cache_auth_chain(key, auth_chain)
|
2020-05-03 17:25:31 +02:00
|
|
|
}
|
2022-07-10 17:23:26 +02:00
|
|
|
}
|