fn compact(&mut self) -> Result<(), Box<Error>>{
        // create a new on-disk BTree
        let mut new_tree_file = try!(OnDiskBTree::<K,V>::new(self.tree_file_path.to_owned() + ".new", self.key_size, self.value_size));

        // get an iterator for the in-memory items
        let mem_iter = self.mem_tree.into_iter();

        // get an iterator to the on-disk items
        let disk_iter = self.tree_file.into_iter();

        for kv in merge(mem_iter, disk_iter) {
            try!(new_tree_file.insert_record(&kv));
        }

        Ok( () )
    }
/// Merges the records on disk with the records in memory
Merges the records on disk with the records in memory
Merges the records on disk with the records in memory
fn compact(&mut self) -> Result<(), Box<Error>>{
        // create a new on-disk BTree
        let mut new_tree_file = try!(OnDiskBTree::<K,V>::new(self.tree_file_path.to_owned() + ".new", self.key_size, self.value_size));
        // get an iterator for the in-memory items
        let mem_iter = self.mem_tree.into_iter();
        // get an iterator to the on-disk items
        let disk_iter = self.tree_file.into_iter();
        for kv in merge(mem_iter, disk_iter) {
            try!(new_tree_file.insert_record(&kv));
        }
        Ok( () )
    }
fn compact ( & mut self ) -> Result < ( ) , Box < Error > > { // create a new on-disk BTree let mut new_tree_file = try ! ( OnDiskBTree K V new ( self tree_file_path to_owned ( ) " " self key_size self value_size ) ) ; // get an iterator for the in-memory items let mem_iter = self . mem_tree . into_iter ( ) ; // get an iterator to the on-disk items let disk_iter = self . tree_file . into_iter ( ) ; for kv in merge ( mem_iter , disk_iter ) { try ! ( new_tree_file insert_record ( kv ) ) ; } Ok ( ( ) ) }
Merges the records on disk with the records in memory
Merges the records on disk with the records in memory
&mut self