KMT3MF5NLEQIPZLHCRYDGQ5EA46HJCG3C2ANEPMZGKGHDK77ADPAC
OTWDDJE7TTE73D6BGF4ZN6BH2NFUFLPME2VJ3CPALH463UGWLEIQC
OP6SVMOD2GTQ7VNJ4E5KYFG4MIYA7HBMXJTADALMZH4PY7OQRMZQC
ONES3V466GLO5CXKRF5ENK7VFOQPWM3YXLVRGWB56V5SH3W7XNBQC
EAAYH6BQWDK52EC5RG3BEZQU3FJPN5RRRN4U5KDKDVPKXBVJMNDAC
QEUTVAZ4F4EJXRDMWDMYXF6XEDMX7YPVG4IIXEKPIR3K54E5W5OAC
S4V4QZ5CF5LUDYWNR2UMWH6CHJDJ5FPGAZCQYM5GY7FJMJV4NN4QC
YWFYZNLZ5JHLIFVBRKZK4TSWVPROUPRG77ZB5M7UHT2OKPL4ZSRQC
WS4ZQM4RMIHZ6XZKSDQJGHN5SSSWFL4H236USOPUA33S6RC53RFAC
fn incr_rc(&mut self, off: u64) -> Result<(), Self::Error>;
fn decr_rc(&mut self, off: u64) -> Result<(), Self::Error>;
fn decr_rc_owned(&mut self, off: u64) -> Result<(), Self::Error>;
// Returns the new RC.
fn incr_rc(&mut self, off: u64) -> Result<usize, Self::Error>;
// Returns the new RC (0 if freed).
fn decr_rc(&mut self, off: u64) -> Result<usize, Self::Error>;
// Returns the new RC (0 if freed).
fn decr_rc_owned(&mut self, off: u64) -> Result<usize, Self::Error>;
fn drop_<T: AllocPage, K: Representable+?Sized, V: Representable+?Sized, P: BTreePage<K, V>>(txn: &mut T, p: Page) -> Result<(), T::Error> {
let rc = if P::is_dirty(p) {
txn.decr_rc_owned(p.offset)?
} else {
txn.decr_rc(p.offset)?
};
if rc == 0 {
let mut cursor = P::first_cursor(p);
let left_page = P::left_child(p, &cursor);
if left_page == 0 {
return Ok(())
}
drop_::<T, K, V, P>(txn, txn.load_page(left_page)?.as_page())?;
while let Some((k, v, r)) = P::next(txn, p, &mut cursor) {
for o in k.page_offsets().chain(v.page_offsets()) {
txn.decr_rc(o)?;
}
drop_::<T, K, V, P>(txn, txn.load_page(r)?.as_page())?;
}
}
Ok(())
}