feat: Integration with persy using background ops

This commit is contained in:
Tglman 2021-06-18 00:38:32 +01:00
parent 5b8d2a736e
commit ab15ec6c32
5 changed files with 275 additions and 1 deletions

View file

@ -8,6 +8,9 @@ use ruma::{
use thiserror::Error;
use tracing::warn;
#[cfg(feature = "persy")]
use persy::PersyError;
#[cfg(feature = "conduit_bin")]
use {
crate::RumaResponse,
@ -36,6 +39,9 @@ pub enum Error {
#[from]
source: rusqlite::Error,
},
#[cfg(feature = "persy")]
#[error("There was a problem with the connection to the persy database.")]
PersyError { source: PersyError },
#[cfg(feature = "heed")]
#[error("There was a problem with the connection to the heed database: {error}")]
HeedError { error: String },
@ -142,3 +148,12 @@ where
self.to_response().respond_to(r)
}
}
#[cfg(feature = "persy")]
impl<T: Into<PersyError>> From<persy::PE<T>> for Error {
fn from(err: persy::PE<T>) -> Self {
Error::PersyError {
source: err.error().into(),
}
}
}