Skip to content

Commit

Permalink
implement missing trait function; add missing match arm (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardliner66 committed Jun 12, 2023
1 parent 7c41433 commit b3d7b52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl From<SanakirjaError> for Error {
SanakirjaError::IO(err) => Self::IO(err),
SanakirjaError::Poison => Self::Poison,
SanakirjaError::VersionMismatch | SanakirjaError::CRC(_) => Self::Corruption,
SanakirjaError::Corrupt(_) => Self::Corruption,
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/store/txn.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::Error;
use sanakirja::{AllocPage, Commit, Env, LoadPage, MutTxn, RootDb, RootPage, Txn};
use sanakirja::{AllocPage, Commit, Env, LoadPage, MutTxn, RootDb, RootPage, Txn, MutPage};
use std::borrow::Borrow;

pub(crate) enum DynTxn<E: Borrow<Env>> {
Expand Down Expand Up @@ -105,4 +105,11 @@ impl<E: Borrow<Env>> AllocPage for DynTxn<E> {
DynTxn::MutTxn(txn) => Ok(txn.decr_rc_owned(off)?),
}
}

fn alloc_contiguous(&mut self, off: u64) -> Result<MutPage, <Self as LoadPage>::Error> {
match self {
DynTxn::Txn(_) => Err(Error::ReadOnlyWrite),
DynTxn::MutTxn(txn) => Ok(txn.alloc_contiguous(off)?),
}
}
}

0 comments on commit b3d7b52

Please sign in to comment.