simplify cork interface related

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-01 20:54:38 +00:00
parent a1ced0a56f
commit 6dd6e4bfaf
10 changed files with 26 additions and 22 deletions

View file

@ -8,7 +8,7 @@ use conduit::{PduCount, Result, Server};
use lru_cache::LruCache;
use ruma::{CanonicalJsonValue, OwnedDeviceId, OwnedRoomId, OwnedUserId};
use crate::{maps, maps::Maps, Engine, Map};
use crate::{cork::Cork, maps, maps::Maps, Engine, Map};
pub struct Database {
pub db: Arc<Engine>,
@ -38,6 +38,15 @@ impl Database {
)),
})
}
#[must_use]
pub fn cork(&self) -> Cork { Cork::new(&self.db, false, false) }
#[must_use]
pub fn cork_and_flush(&self) -> Cork { Cork::new(&self.db, true, false) }
#[must_use]
pub fn cork_and_sync(&self) -> Cork { Cork::new(&self.db, true, true) }
}
impl Index<&str> for Database {