pub fn from_cincinnati(node: Node) -> Result<Self> {
        ensure!(!node.version.is_empty(), "empty version field");
        ensure!(!node.payload.is_empty(), "empty payload field (checksum)");
        let scheme = node
            .metadata
            .get(SCHEME_KEY)
            .ok_or_else(|| anyhow!("missing metadata key: {}", SCHEME_KEY))?;

        ensure!(
            scheme == CHECKSUM_SCHEME,
            "unexpected payload scheme: {}",
            scheme
        );

        let age = {
            let val = node
                .metadata
                .get(AGE_INDEX_KEY)
                .ok_or_else(|| anyhow!("missing metadata key: {}", AGE_INDEX_KEY))?;

            val.parse::<u64>()
                .context(format!("invalid age_index value: {}", val))?
        };

        let rel = Self {
            version: node.version,
            checksum: node.payload,
            age_index: Some(age),
        };
        Ok(rel)
    }
/// Builds a `Release` object from a Cincinnati node.
Builds a `Release` object from a Cincinnati node.
Builds a ` Release ` object from a Cincinnati node .
pub fn from_cincinnati(node: Node) -> Result<Self> {
        ensure!(!node.version.is_empty(), "empty version field");
        ensure!(!node.payload.is_empty(), "empty payload field (checksum)");
        let scheme = node
            .metadata
            .get(SCHEME_KEY)
            .ok_or_else(|| anyhow!("missing metadata key: {}", SCHEME_KEY))?;
        ensure!(
            scheme == CHECKSUM_SCHEME,
            "unexpected payload scheme: {}",
            scheme
        );
        let age = {
            let val = node
                .metadata
                .get(AGE_INDEX_KEY)
                .ok_or_else(|| anyhow!("missing metadata key: {}", AGE_INDEX_KEY))?;
            val.parse::<u64>()
                .context(format!("invalid age_index value: {}", val))?
        };
        let rel = Self {
            version: node.version,
            checksum: node.payload,
            age_index: Some(age),
        };
        Ok(rel)
    }
pub fn from_cincinnati ( node : Node ) -> Result < Self > { ensure ! ( node version is_empty ( ) " " ) ; ensure ! ( node payload is_empty ( ) " " ) ; let scheme = node . metadata . get ( SCHEME_KEY ) . ok_or_else ( | | anyhow ! ( " " SCHEME_KEY ) ) ? ; ensure ! ( scheme CHECKSUM_SCHEME " " scheme ) ; let age = { let val = node . metadata . get ( AGE_INDEX_KEY ) . ok_or_else ( | | anyhow ! ( " " AGE_INDEX_KEY ) ) ? ; val . parse :: < u64 > ( ) . context ( format ! ( " " val ) ) ? } ; let rel = Self { version : node . version , checksum : node . payload , age_index : Some ( age ) , } ; Ok ( rel ) }
Builds a `Release` object from a Cincinnati node.
Builds a ` Release ` object from a Cincinnati node .
node
Node