SYURNHHL3P22ZAERTML4YW3DYLATHY5ALZH4GL5NF3LENDSKL2NQC
DASFQGORX56YK5E4Y7GGYZSQQQMUXYTZZ4A6IVWSTI3QGRUORLPAC
H3FVSQIQGFCFKCPXVOSFHP4OSUOBBURJESCZNGQTNDAAD3WQSBEQC
52X5P7NDBQHIJDIYNY3XUPDHHOO3PDPPNKGO2PGLXKVNM3EVECTQC
OP6SVMOD2GTQ7VNJ4E5KYFG4MIYA7HBMXJTADALMZH4PY7OQRMZQC
TSMS6W4DOKQNUQ4PEMTLOIODR33VFPN6MMNS73ZPSU4BOQVRGPNAC
73Z2UB3JGRLFNFORE7D64O4IHIFSZASD4G4FLJ4FJLHANT75MGIAC
OFINGD26ZWCRDVVDI2ZIBLMHXKEMJA6MRNLANJYUHQPIJLPA7J2AC
UAQX27N4PI4LHEW6LSHJETIE5MV7JTEMPLTJFYUBMYVPC43H7VOAC
6DMPXOAT5GQ3BQQOMUZN2GMBQPRA4IB7CCPHTQTIFGO3KWWAKF3QC
FZBLNBGNQPNTLBNPNZ2C6DJ5323MZQ2PH54F6ZEKPFCK7TGJFGWAC
MSRWB47YP6L5BVTS53QQPBOHY5SXTSTR5KD6IIF35UWCTEUOCQWQC
E4MD6T3LNOYWVFTFFWCUKRNS4M2XVSKRLDWPYHMZHGDNO2T5JREQC
Q7DRIBBRE4MNG4NP3PVIXAJF5PQYLFWYIVK2O4VVLEO6XY3BOSFQC
NXMFNPZ7VWJRLC3M5QJJVTICXCMGE24F3HVIZA7A7RLVMLQMLDVQC
SO25TWFLSRQIVTJTTSN77LO5FZQVQPIZTSBULH7MWBBDEWSK3OCAC
T7QB6QEPWBXAU3RL7LE4GRDWWNQ65ZU2YNNTWBYLORJOABAQFEZQC
unsafe fn put_mut(
page: &mut MutPage,
c: &Self::Cursor,
k0: &K,
v0: &V,
r: u64,
) {
let mut n = c.cur;
if r == 0 {
Leaf::alloc_write(page, k0, v0, 0, r, &mut n);
} else {
Internal::alloc_write(page, k0, v0, 0, r, &mut n);
}
}
unsafe fn set_left_child(
page: &mut MutPage,
c: &Self::Cursor,
l: u64
) {
let off = (page.0.data.add(HDR) as *mut u64).offset(c.cur - 1);
*off = (l | (u64::from_le(*off) & 0xfff)).to_le();
}
unsafe fn put_mut(
page: &mut MutPage,
c: &Self::Cursor,
k0: &K,
v0: &V,
r: u64,
) {
use super::page_unsized::AllocWrite;
let mut n = c.cur;
if r == 0 {
Leaf::alloc_write(page, k0, v0, 0, r, &mut n);
} else {
Internal::alloc_write(page, k0, v0, 0, r, &mut n);
}
}
unsafe fn set_left_child(
page: &mut MutPage,
c: &Self::Cursor,
l: u64
) {
let off = (page.0.data.add(HDR) as *mut u64).offset(c.cur - 1);
*off = (l | (u64::from_le(*off) & 0xfff)).to_le();
}
/// Add an entry to `page`, at position `c`. Does not check
/// whether there is enough space to do so. This method is mostly
/// useful for cloning pages.
#[allow(unused_variables)]
unsafe fn put_mut(
page: &mut MutPage,
c: &Self::Cursor,
k0: &K,
v0: &V,
r: u64,
) {
unimplemented!()
}
#[allow(unused_variables)]
unsafe fn set_left_child(
page: &mut MutPage,
c: &Self::Cursor,
l: u64
) {
unimplemented!()
}
}
}
}
impl<E: Borrow<Env>> Txn<E> {
/// A "raw" version of the `root_db` method, useful to store
/// things other than databases.
pub fn root(&self, n: usize) -> u64 {
assert!(n <= (4096 - GLOBAL_HEADER_SIZE) / 8);
unsafe {
let env = self.env.borrow();
let maps = env.mmaps.lock();
*(maps[0]
.ptr
.add(self.root * PAGE_SIZE + GLOBAL_HEADER_SIZE + 8 * n)
as *mut u64)