pub fn complete_install(&mut self, package_hash: Hash) -> Result<(), CompleteInstallError> {
        match self.packages.get_mut(&package_hash) {
            Some(PackageWithInspect {
                package: package @ Package::WithMetaFar { .. },
                package_node,
            }) => {
                if let Package::WithMetaFar { path, required_blobs } =
                    std::mem::replace(package, Package::Pending)
                {
                    let child_node = self.node.create_child(&package_hash.to_string());
                    let required_blobs_size = required_blobs.len().try_into().unwrap_or(-1);
                    *package = Package::Active { path: path.clone(), required_blobs };
                    *package_node = PackageNode::Active {
                        state: child_node.create_string("state", "active"),
                        path: child_node.create_string("path", format!("{}", path.clone())),
                        required_blobs: child_node
                            .create_int("required_blobs", required_blobs_size),
                        time: child_node.create_int("time", zx::Time::get_monotonic().into_nanos()),
                        node: child_node,
                    };

                    if let Some(previous_package) = self.active_packages.insert(path, package_hash)
                    {
                        self.packages.remove(&previous_package);
                    }
                } else {
                    unreachable!()
                }
            }
            package => {
                return Err(CompleteInstallError::UnexpectedPackageState(
                    package.map(|pwi| pwi.package.to_owned()),
                ));
            }
        }
        Ok(())
    }
/// Notifies dynamic index that the given package has completed installation.
Notifies dynamic index that the given package has completed installation.
Notifies dynamic index that the given package has completed installation .
pub fn complete_install(&mut self, package_hash: Hash) -> Result<(), CompleteInstallError> {
        match self.packages.get_mut(&package_hash) {
            Some(PackageWithInspect {
                package: package @ Package::WithMetaFar { .. },
                package_node,
            }) => {
                if let Package::WithMetaFar { path, required_blobs } =
                    std::mem::replace(package, Package::Pending)
                {
                    let child_node = self.node.create_child(&package_hash.to_string());
                    let required_blobs_size = required_blobs.len().try_into().unwrap_or(-1);
                    *package = Package::Active { path: path.clone(), required_blobs };
                    *package_node = PackageNode::Active {
                        state: child_node.create_string("state", "active"),
                        path: child_node.create_string("path", format!("{}", path.clone())),
                        required_blobs: child_node
                            .create_int("required_blobs", required_blobs_size),
                        time: child_node.create_int("time", zx::Time::get_monotonic().into_nanos()),
                        node: child_node,
                    };
                    if let Some(previous_package) = self.active_packages.insert(path, package_hash)
                    {
                        self.packages.remove(&previous_package);
                    }
                } else {
                    unreachable!()
                }
            }
            package => {
                return Err(CompleteInstallError::UnexpectedPackageState(
                    package.map(|pwi| pwi.package.to_owned()),
                ));
            }
        }
        Ok(())
    }
pub fn complete_install ( & mut self , package_hash : Hash ) -> Result < ( ) , CompleteInstallError > { match self . packages . get_mut ( & package_hash ) { Some ( PackageWithInspect { package : package @ Package :: WithMetaFar { .. } , package_node , } ) => { if let Package :: WithMetaFar { path , required_blobs } = std :: mem :: replace ( package , Package :: Pending ) { let child_node = self . node . create_child ( & package_hash . to_string ( ) ) ; let required_blobs_size = required_blobs . len ( ) . try_into ( ) . unwrap_or ( - 1 ) ; * package = Package :: Active { path : path . clone ( ) , required_blobs } ; * package_node = PackageNode :: Active { state : child_node . create_string ( " " , " " ) , path : child_node . create_string ( " " , format ! ( " " path clone ( ) ) ) , required_blobs : child_node . create_int ( " " , required_blobs_size ) , time : child_node . create_int ( " " , zx :: Time :: get_monotonic ( ) . into_nanos ( ) ) , node : child_node , } ; if let Some ( previous_package ) = self . active_packages . insert ( path , package_hash ) { self . packages . remove ( & previous_package ) ; } } else { unreachable ! ( ) } } package => { return Err ( CompleteInstallError :: UnexpectedPackageState ( package . map ( | pwi | pwi . package . to_owned ( ) ) , ) ) ; } } Ok ( ( ) ) }
Notifies dynamic index that the given package has completed installation.
Notifies dynamic index that the given package has completed installation .
&mut self
package_hash
Hash
&mut self
package_hash
Hash