fn entries(&self, lo: u64, hi: u64, limit: u64) -> Result<Vec<Entry>, StorageError> {
        let offset = self.ents[0].get_Index();
        if lo <= offset {
            return Err(StorageError::Compacted);
        }
        if hi > self.ents.last().unwrap().get_Index() + 1 {
            unimplemented!("entries's hi({}) is out of bound last_index({})", lo, hi);
        }
        // only contains dummy entries
        if self.ents.len() == 1 {
            return Err(StorageError::Compacted);
        }

        let start = (lo - offset) as usize;
        let end = (hi - offset) as usize;

        let ents: Vec<Entry> = self.ents[start..end]
            .iter()
            .map(|item| item.clone())
            .collect();
        if self.ents.len() == 1 && !ents.is_empty() {
            return Err(StorageError::Unavailable);
        }
        Ok(limit_size(ents, limit))
    }
// TODO: optimized
// entries implements the Storage interface.
optimized
entries implements the Storage interface.
optimized entries implements the Storage interface .
fn entries(&self, lo: u64, hi: u64, limit: u64) -> Result<Vec<Entry>, StorageError> {
        let offset = self.ents[0].get_Index();
        if lo <= offset {
            return Err(StorageError::Compacted);
        }
        if hi > self.ents.last().unwrap().get_Index() + 1 {
            unimplemented!("entries's hi({}) is out of bound last_index({})", lo, hi);
        }
        // only contains dummy entries
        if self.ents.len() == 1 {
            return Err(StorageError::Compacted);
        }
        let start = (lo - offset) as usize;
        let end = (hi - offset) as usize;
        let ents: Vec<Entry> = self.ents[start..end]
            .iter()
            .map(|item| item.clone())
            .collect();
        if self.ents.len() == 1 && !ents.is_empty() {
            return Err(StorageError::Unavailable);
        }
        Ok(limit_size(ents, limit))
    }
fn entries ( & self , lo : u64 , hi : u64 , limit : u64 ) -> Result < Vec < Entry > , StorageError > { let offset = self . ents [ 0 ] . get_Index ( ) ; if lo <= offset { return Err ( StorageError :: Compacted ) ; } if hi > self . ents . last ( ) . unwrap ( ) . get_Index ( ) + 1 { unimplemented ! ( " " lo hi ) ; } // only contains dummy entries if self . ents . len ( ) == 1 { return Err ( StorageError :: Compacted ) ; } let start = ( lo - offset ) as usize ; let end = ( hi - offset ) as usize ; let ents : Vec < Entry > = self . ents [ start .. end ] . iter ( ) . map ( | item | item . clone ( ) ) . collect ( ) ; if self . ents . len ( ) == 1 && ! ents . is_empty ( ) { return Err ( StorageError :: Unavailable ) ; } Ok ( limit_size ( ents , limit ) ) }
TODO: optimized
entries implements the Storage interface.
TODO : optimized entries implements the Storage interface .
&self
lo
u64
hi
u64
limit
u64