pub async fn retrieve(
        &mut self,
        hash: AnySgdHash,
        mut options: NetworkGetOptions,
    ) -> CascadeResult<Option<Element>> {
        let result = self.find_map(|store| Ok(store.get_element(&hash)?))?;
        if result.is_some() {
            return Ok(result);
        }
        options.request_type = aingle_p2p::event::GetRequest::Pending;
        self.fetch_element(hash.clone(), options).await?;

        // Check if we have the data now after the network call.
        let result = self.find_map(|store| Ok(store.get_element(&hash)?))?;
        Ok(result)
    }
/// Retrieve data from either locally or from an authority.
/// Data might not have been validated yet by the authority.
Retrieve data from either locally or from an authority.
Data might not have been validated yet by the authority.
Retrieve data from either locally or from an authority . Data might not have been validated yet by the authority .
pub async fn retrieve(
        &mut self,
        hash: AnySgdHash,
        mut options: NetworkGetOptions,
    ) -> CascadeResult<Option<Element>> {
        let result = self.find_map(|store| Ok(store.get_element(&hash)?))?;
        if result.is_some() {
            return Ok(result);
        }
        options.request_type = aingle_p2p::event::GetRequest::Pending;
        self.fetch_element(hash.clone(), options).await?;
        // Check if we have the data now after the network call.
        let result = self.find_map(|store| Ok(store.get_element(&hash)?))?;
        Ok(result)
    }
pub async fn retrieve ( & mut self , hash : AnySgdHash , mut options : NetworkGetOptions , ) -> CascadeResult < Option < Element > > { let result = self . find_map ( | store | Ok ( store . get_element ( & hash ) ? ) ) ? ; if result . is_some ( ) { return Ok ( result ) ; } options . request_type = aingle_p2p :: event :: GetRequest :: Pending ; self . fetch_element ( hash . clone ( ) , options ) . await ? ; // Check if we have the data now after the network call. let result = self . find_map ( | store | Ok ( store . get_element ( & hash ) ? ) ) ? ; Ok ( result ) }
Retrieve data from either locally or from an authority.
Retrieve data from either locally or from an authority .
&mut self
hash
AnySgdHash
options
NetworkGetOptions
&mut self
hash
AnySgdHash
options
NetworkGetOptions