add is_read_only()/is_secondary() to Engine

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-11-14 22:43:18 +00:00
parent 4b652f5236
commit 59834a4b05
2 changed files with 10 additions and 2 deletions

View file

@ -38,11 +38,11 @@ impl Database {
#[inline]
#[must_use]
pub fn is_read_only(&self) -> bool { self.db.secondary || self.db.read_only }
pub fn is_read_only(&self) -> bool { self.db.is_read_only() }
#[inline]
#[must_use]
pub fn is_secondary(&self) -> bool { self.db.secondary }
pub fn is_secondary(&self) -> bool { self.db.is_secondary() }
}
impl Index<&str> for Database {

View file

@ -274,6 +274,14 @@ impl Engine {
result(self.db.property_value_cf(cf, name))
.and_then(|val| val.map_or_else(|| Err!("Property {name:?} not found."), Ok))
}
#[inline]
#[must_use]
pub fn is_read_only(&self) -> bool { self.secondary || self.read_only }
#[inline]
#[must_use]
pub fn is_secondary(&self) -> bool { self.secondary }
}
pub(crate) fn repair(db_opts: &Options, path: &PathBuf) -> Result<()> {