fn read(&mut self, seq: u32) -> Result<Page> {
        if let Some(page) = self.dirty.get(&seq) {
            debug!("{:?}: hit #{} (dirty)", self.name, seq);
            Ok(page.clone())
        } else if let Some(page) = self.ro_cache.get(&seq) {
            debug!("{:?}: hit #{}", self.name, seq);
            Ok(page.clone())
        } else if self.map[seq as usize].is_none() {
            debug!("{:?}: zero #{}", self.name, seq);
            Ok(self.zero_page.clone())
        } else {
            info!("{:?}: load #{}", self.name, seq);
            let page = Page::load(&self.map, &self.backend, seq)?;
            self.ro_cache.put(seq, page.clone());
            Ok(page)
        }
    }
/// Returns data from chunk `seq`. Data is fetched from the cache or loaded from disk if
/// necessary.
Returns data from chunk `seq`. Data is fetched from the cache or loaded from disk if
necessary.
Returns data from chunk ` seq ` . Data is fetched from the cache or loaded from disk if necessary .
fn read(&mut self, seq: u32) -> Result<Page> {
        if let Some(page) = self.dirty.get(&seq) {
            debug!("{:?}: hit #{} (dirty)", self.name, seq);
            Ok(page.clone())
        } else if let Some(page) = self.ro_cache.get(&seq) {
            debug!("{:?}: hit #{}", self.name, seq);
            Ok(page.clone())
        } else if self.map[seq as usize].is_none() {
            debug!("{:?}: zero #{}", self.name, seq);
            Ok(self.zero_page.clone())
        } else {
            info!("{:?}: load #{}", self.name, seq);
            let page = Page::load(&self.map, &self.backend, seq)?;
            self.ro_cache.put(seq, page.clone());
            Ok(page)
        }
    }
fn read ( & mut self , seq : u32 ) -> Result < Page > { if let Some ( page ) = self . dirty . get ( & seq ) { debug ! ( " " self name seq ) ; Ok ( page . clone ( ) ) } else if let Some ( page ) = self . ro_cache . get ( & seq ) { debug ! ( " " self name seq ) ; Ok ( page . clone ( ) ) } else if self . map [ seq as usize ] . is_none ( ) { debug ! ( " " self name seq ) ; Ok ( self . zero_page . clone ( ) ) } else { info ! ( " " self name seq ) ; let page = Page :: load ( & self . map , & self . backend , seq ) ? ; self . ro_cache . put ( seq , page . clone ( ) ) ; Ok ( page ) } }
Returns data from chunk `seq`.
Returns data from chunk ` seq ` .
&mut self
seq
u32
&mut self
seq
u32