pub fn read_ledger(&self) -> Result<impl Iterator<Item = Entry>> {
        use crate::entryInfo::EntrySlice;
        use std::collections::VecDeque;

        struct EntryIterator {
            db_iterator: Cursor<cf::Data>,

            // TODO: remove me when replay_stage is iterating by block (Blocktree)
            //    this verification is duplicating that of replay_stage, which
            //    can do this in parallel
            blockhash: Option<Hash>,
            // https://github.com/rust-rocksdb/rust-rocksdb/issues/234
            //   rocksdb issue: the _blocktree member must be lower in the struct to prevent a crash
            //   when the db_iterator member above is dropped.
            //   _blocktree is unused, but dropping _blocktree results in a broken db_iterator
            //   you have to hold the database open in order to iterate over it, and in order
            //   for db_iterator to be able to run Drop
            //    _blocktree: Blocktree,
            entries: VecDeque<Entry>,
        }

        impl Iterator for EntryIterator {
            type Item = Entry;

            fn next(&mut self) -> Option<Entry> {
                if !self.entries.is_empty() {
                    return Some(self.entries.pop_front().unwrap());
                }

                if self.db_iterator.valid() {
                    if let Some(value) = self.db_iterator.value_bytes() {
                        if let Ok(next_entries) =
                            deserialize::<Vec<Entry>>(&value[BLOB_HEADER_SIZE..])
                        {
                            if let Some(blockhash) = self.blockhash {
                                if !next_entries.verify(&blockhash) {
                                    return None;
                                }
                            }
                            self.db_iterator.next();
                            if next_entries.is_empty() {
                                return None;
                            }
                            self.entries = VecDeque::from(next_entries);
                            let entry = self.entries.pop_front().unwrap();
                            self.blockhash = Some(entry.hash);
                            return Some(entry);
                        }
                    }
                }
                None
            }
        }
        let mut db_iterator = self.db.cursor::<cf::Data>()?;

        db_iterator.seek_to_first();
        Ok(EntryIterator {
            entries: VecDeque::new(),
            db_iterator,
            blockhash: None,
        })
    }
/// Return an iterator for all the entries in the given file.
Return an iterator for all the entries in the given file.
Return an iterator for all the entries in the given file .
pub fn read_ledger(&self) -> Result<impl Iterator<Item = Entry>> {
        use crate::entryInfo::EntrySlice;
        use std::collections::VecDeque;
        struct EntryIterator {
            db_iterator: Cursor<cf::Data>,
            // TODO: remove me when replay_stage is iterating by block (Blocktree)
            //    this verification is duplicating that of replay_stage, which
            //    can do this in parallel
            blockhash: Option<Hash>,
            // https://github.com/rust-rocksdb/rust-rocksdb/issues/234
            //   rocksdb issue: the _blocktree member must be lower in the struct to prevent a crash
            //   when the db_iterator member above is dropped.
            //   _blocktree is unused, but dropping _blocktree results in a broken db_iterator
            //   you have to hold the database open in order to iterate over it, and in order
            //   for db_iterator to be able to run Drop
            //    _blocktree: Blocktree,
            entries: VecDeque<Entry>,
        }
        impl Iterator for EntryIterator {
            type Item = Entry;
            fn next(&mut self) -> Option<Entry> {
                if !self.entries.is_empty() {
                    return Some(self.entries.pop_front().unwrap());
                }
                if self.db_iterator.valid() {
                    if let Some(value) = self.db_iterator.value_bytes() {
                        if let Ok(next_entries) =
                            deserialize::<Vec<Entry>>(&value[BLOB_HEADER_SIZE..])
                        {
                            if let Some(blockhash) = self.blockhash {
                                if !next_entries.verify(&blockhash) {
                                    return None;
                                }
                            }
                            self.db_iterator.next();
                            if next_entries.is_empty() {
                                return None;
                            }
                            self.entries = VecDeque::from(next_entries);
                            let entry = self.entries.pop_front().unwrap();
                            self.blockhash = Some(entry.hash);
                            return Some(entry);
                        }
                    }
                }
                None
            }
        }
        let mut db_iterator = self.db.cursor::<cf::Data>()?;
        db_iterator.seek_to_first();
        Ok(EntryIterator {
            entries: VecDeque::new(),
            db_iterator,
            blockhash: None,
        })
    }
pub fn read_ledger ( & self ) -> Result < impl Iterator < Item = Entry > > { use crate :: entryInfo :: EntrySlice ; use std :: collections :: VecDeque ; struct EntryIterator { db_iterator : Cursor < cf :: Data > , // TODO: remove me when replay_stage is iterating by block (Blocktree) //    this verification is duplicating that of replay_stage, which //    can do this in parallel blockhash : Option < Hash > , // https://github.com/rust-rocksdb/rust-rocksdb/issues/234 //   rocksdb issue: the _blocktree member must be lower in the struct to prevent a crash //   when the db_iterator member above is dropped. //   _blocktree is unused, but dropping _blocktree results in a broken db_iterator //   you have to hold the database open in order to iterate over it, and in order //   for db_iterator to be able to run Drop //    _blocktree: Blocktree, entries : VecDeque < Entry > , } impl Iterator for EntryIterator { type Item = Entry ; fn next ( & mut self ) -> Option < Entry > { if ! self . entries . is_empty ( ) { return Some ( self . entries . pop_front ( ) . unwrap ( ) ) ; } if self . db_iterator . valid ( ) { if let Some ( value ) = self . db_iterator . value_bytes ( ) { if let Ok ( next_entries ) = deserialize :: < Vec < Entry > > ( & value [ BLOB_HEADER_SIZE .. ] ) { if let Some ( blockhash ) = self . blockhash { if ! next_entries . verify ( & blockhash ) { return None ; } } self . db_iterator . next ( ) ; if next_entries . is_empty ( ) { return None ; } self . entries = VecDeque :: from ( next_entries ) ; let entry = self . entries . pop_front ( ) . unwrap ( ) ; self . blockhash = Some ( entry . hash ) ; return Some ( entry ) ; } } } None } } let mut db_iterator = self . db . cursor :: < cf :: Data > ( ) ? ; db_iterator . seek_to_first ( ) ; Ok ( EntryIterator { entries : VecDeque :: new ( ) , db_iterator , blockhash : None , } ) }
Return an iterator for all the entries in the given file.
Return an iterator for all the entries in the given file .
&self
&self