pub async fn sgd_get_entry(
        &mut self,
        entry_hash: EntryHash,
        options: GetOptions,
    ) -> CascadeResult<Option<Element>> {
        let authoring = self.am_i_authoring(&entry_hash.clone().into())?;
        let authority = self.am_i_an_authority(entry_hash.clone().into()).await?;
        let query = GetLiveEntryQuery::new(entry_hash.clone());

        // We don't need metadata and only need the content
        // so if we have it locally then we can avoid the network.
        if let GetStrategy::Content = options.strategy {
            let results = self.cascading(query.clone())?;
            // We got a result so can short circuit.
            if results.is_some() {
                return Ok(results);
            // We didn't get a result so if we are either authoring
            // or the authority there's nothing left to do.
            } else if authoring || authority {
                return Ok(None);
            }
        }

        // If we are not in the process of authoring this hash and we are not the
        // authority we can skip the network call.
        if !authoring && !authority {
            self.fetch_element(entry_hash.into(), options.into())
                .await?;
        }

        // Check if we have the data now after the network call.
        let results = self.cascading(query)?;
        Ok(results)
    }
/// Returns the oldest live [Element] for this [EntryHash] by getting the
/// latest available metadata from authorities combined with this agents authored data.
Returns the oldest live [Element] for this [EntryHash] by getting the
latest available metadata from authorities combined with this agents authored data.
Returns the oldest live [ Element ] for this [ EntryHash ] by getting the latest available metadata from authorities combined with this agents authored data .
pub async fn sgd_get_entry(
        &mut self,
        entry_hash: EntryHash,
        options: GetOptions,
    ) -> CascadeResult<Option<Element>> {
        let authoring = self.am_i_authoring(&entry_hash.clone().into())?;
        let authority = self.am_i_an_authority(entry_hash.clone().into()).await?;
        let query = GetLiveEntryQuery::new(entry_hash.clone());
        // We don't need metadata and only need the content
        // so if we have it locally then we can avoid the network.
        if let GetStrategy::Content = options.strategy {
            let results = self.cascading(query.clone())?;
            // We got a result so can short circuit.
            if results.is_some() {
                return Ok(results);
            // We didn't get a result so if we are either authoring
            // or the authority there's nothing left to do.
            } else if authoring || authority {
                return Ok(None);
            }
        }
        // If we are not in the process of authoring this hash and we are not the
        // authority we can skip the network call.
        if !authoring && !authority {
            self.fetch_element(entry_hash.into(), options.into())
                .await?;
        }
        // Check if we have the data now after the network call.
        let results = self.cascading(query)?;
        Ok(results)
    }
pub async fn sgd_get_entry ( & mut self , entry_hash : EntryHash , options : GetOptions , ) -> CascadeResult < Option < Element > > { let authoring = self . am_i_authoring ( & entry_hash . clone ( ) . into ( ) ) ? ; let authority = self . am_i_an_authority ( entry_hash . clone ( ) . into ( ) ) . await ? ; let query = GetLiveEntryQuery :: new ( entry_hash . clone ( ) ) ; // We don't need metadata and only need the content // so if we have it locally then we can avoid the network. if let GetStrategy :: Content = options . strategy { let results = self . cascading ( query . clone ( ) ) ? ; // We got a result so can short circuit. if results . is_some ( ) { return Ok ( results ) ; // We didn't get a result so if we are either authoring // or the authority there's nothing left to do. } else if authoring || authority { return Ok ( None ) ; } } // If we are not in the process of authoring this hash and we are not the // authority we can skip the network call. if ! authoring && ! authority { self . fetch_element ( entry_hash . into ( ) , options . into ( ) ) . await ? ; } // Check if we have the data now after the network call. let results = self . cascading ( query ) ? ; Ok ( results ) }
Returns the oldest live [Element] for this [EntryHash] by getting the
latest available metadata from authorities combined with this agents authored data.
Returns the oldest live [ Element ] for this [ EntryHash ] by getting the latest available metadata from authorities combined with this agents authored data .
&mut self
entry_hash
EntryHash
options
GetOptions
&mut self
entry_hash
EntryHash
options
GetOptions