/// Remove the pool object of the given type/height/id key.
Remove the pool object of the given type/height/id key.
Remove the pool object of the given type / height / id key .
fn tx_remove<'a>(&self, tx: &mut RwTransaction<'a>, key: &ArtifactKey) -> lmdb::Result<()> {
        if let Err(err) = tx.del(self.artifacts, &key.id_key, None) {
            // skip the removal if it is not found in artifacts
            return if lmdb::Error::NotFound == err {
                Ok(())
            } else {
                Err(err)
            };
        }
        let index_db = self.get_index_db(&key.type_key);
        tx.del(index_db, &key.height_key, Some(&key.id_key.0))?;
        let min_height;
        let max_height;
        {
            let mut cursor = tx.open_ro_cursor(index_db)?;
            let mut iter = cursor.iter_start();
            min_height = iter
                .next()
                .transpose()?
                .map(|(key, _)| HeightKey::from(key));
            max_height = iter
                .last()
                .transpose()?
                .map(|(key, _)| HeightKey::from(key));
        }
        match (min_height, max_height) {
            (Some(min), Some(max)) => self.update_meta(tx, &key.type_key, &Meta { min, max }),
            (Some(min), None) => self.update_meta(tx, &key.type_key, &Meta { min, max: min }),
            _ => tx.del(self.meta, &key.type_key, None),
        }
    }
fn tx_remove < ' a > ( & self , tx : & mut RwTransaction < ' a > , key : & ArtifactKey ) -> lmdb :: Result < ( ) > { if let Err ( err ) = tx . del ( self . artifacts , & key . id_key , None ) { // skip the removal if it is not found in artifacts return if lmdb :: Error :: NotFound == err { Ok ( ( ) ) } else { Err ( err ) } ; } let index_db = self . get_index_db ( & key . type_key ) ; tx . del ( index_db , & key . height_key , Some ( & key . id_key . 0 ) ) ? ; let min_height ; let max_height ; { let mut cursor = tx . open_ro_cursor ( index_db ) ? ; let mut iter = cursor . iter_start ( ) ; min_height = iter . next ( ) . transpose ( ) ? . map ( | ( key , _ ) | HeightKey :: from ( key ) ) ; max_height = iter . last ( ) . transpose ( ) ? . map ( | ( key , _ ) | HeightKey :: from ( key ) ) ; } match ( min_height , max_height ) { ( Some ( min ) , Some ( max ) ) => self . update_meta ( tx , & key . type_key , & Meta { min , max } ) , ( Some ( min ) , None ) => self . update_meta ( tx , & key . type_key , & Meta { min , max : min } ) , _ => tx . del ( self . meta , & key . type_key , None ) , } }
Remove the pool object of the given type/height/id key.
Remove the pool object of the given type / height / id key .
&self
tx
&mut RwTransaction<'a>
key
&ArtifactKey