pub fn prepare_transaction(&mut self, tx: &mut DBTransaction, column: Option<u32>, prefix: &[u8]) {
		let mut buf = prefix.to_vec();
		for LeafSetItem { hash, number } in self.pending_added.drain(..) {
			hash.using_encoded(|s| buf.extend(s));
			tx.put_vec(column, &buf[..], number.0.encode());
			buf.truncate(prefix.len()); // reuse allocation.
		}
		for hash in self.pending_removed.drain(..) {
			hash.using_encoded(|s| buf.extend(s));
			tx.delete(column, &buf[..]);
			buf.truncate(prefix.len()); // reuse allocation.
		}
	}
/// Write the leaf list to the database transaction.
Write the leaf list to the database transaction.
Write the leaf list to the database transaction .
pub fn prepare_transaction(&mut self, tx: &mut DBTransaction, column: Option<u32>, prefix: &[u8]) {
		let mut buf = prefix.to_vec();
		for LeafSetItem { hash, number } in self.pending_added.drain(..) {
			hash.using_encoded(|s| buf.extend(s));
			tx.put_vec(column, &buf[..], number.0.encode());
			buf.truncate(prefix.len()); // reuse allocation.
		}
		for hash in self.pending_removed.drain(..) {
			hash.using_encoded(|s| buf.extend(s));
			tx.delete(column, &buf[..]);
			buf.truncate(prefix.len()); // reuse allocation.
		}
	}
pub fn prepare_transaction ( & mut self , tx : & mut DBTransaction , column : Option < u32 > , prefix : & [ u8 ] ) { let mut buf = prefix . to_vec ( ) ; for LeafSetItem { hash , number } in self . pending_added . drain ( .. ) { hash . using_encoded ( | s | buf . extend ( s ) ) ; tx . put_vec ( column , & buf [ .. ] , number . 0 . encode ( ) ) ; buf . truncate ( prefix . len ( ) ) ; // reuse allocation. } for hash in self . pending_removed . drain ( .. ) { hash . using_encoded ( | s | buf . extend ( s ) ) ; tx . delete ( column , & buf [ .. ] ) ; buf . truncate ( prefix . len ( ) ) ; // reuse allocation. } }
Write the leaf list to the database transaction.
Write the leaf list to the database transaction .
&mut self
tx
&mut DBTransaction
column
Option<u32>
prefix
&[u8]
&mut self
tx
&mut DBTransaction
column
Option<u32>
prefix
&[u8]