pub fn delete_all(&self, index_uuid: Uuid) -> Result<()> {
        let mut txn = self.env.write_txn()?;
        // Contains all the content file paths that we need to be removed if the deletion was successful.
        let mut uuids_to_remove = Vec::new();

        let mut pendings = self.pending_queue.iter_mut(&mut txn)?.lazily_decode_data();

        while let Some(Ok(((_, uuid, _), pending))) = pendings.next() {
            if uuid == index_uuid {
                unsafe {
                    pendings.del_current()?;
                }
                let mut pending = pending.decode()?;
                if let Some(update_uuid) = pending.content.take() {
                    uuids_to_remove.push(update_uuid);
                }
            }
        }

        drop(pendings);

        let mut updates = self
            .updates
            .remap_key_type::<ByteSlice>()
            .prefix_iter_mut(&mut txn, index_uuid.as_bytes())?
            .lazily_decode_data();

        while let Some(_) = updates.next() {
            unsafe {
                updates.del_current()?;
            }
        }

        drop(updates);

        txn.commit()?;

        uuids_to_remove
            .iter()
            .map(|uuid| update_uuid_to_file_path(&self.path, *uuid))
            .for_each(|path| {
                let _ = remove_file(path);
            });

        // If the currently processing update is from our index, we wait until it is
        // finished before returning. This ensure that no write to the index occurs after we delete it.
        if let State::Processing(uuid, _) = *self.state.read() {
            if uuid == index_uuid {
                // wait for a write lock, do nothing with it.
                self.state.write();
            }
        }

        Ok(())
    }
/// Delete all updates for an index from the update store. If the currently processing update
/// is for `index_uuid`, the call will block until the update is terminated.
Delete all updates for an index from the update store. If the currently processing update
is for `index_uuid`, the call will block until the update is terminated.
Delete all updates for an index from the update store . If the currently processing update is for ` index_uuid ` the call will block until the update is terminated .
pub fn delete_all(&self, index_uuid: Uuid) -> Result<()> {
        let mut txn = self.env.write_txn()?;
        // Contains all the content file paths that we need to be removed if the deletion was successful.
        let mut uuids_to_remove = Vec::new();
        let mut pendings = self.pending_queue.iter_mut(&mut txn)?.lazily_decode_data();
        while let Some(Ok(((_, uuid, _), pending))) = pendings.next() {
            if uuid == index_uuid {
                unsafe {
                    pendings.del_current()?;
                }
                let mut pending = pending.decode()?;
                if let Some(update_uuid) = pending.content.take() {
                    uuids_to_remove.push(update_uuid);
                }
            }
        }
        drop(pendings);
        let mut updates = self
            .updates
            .remap_key_type::<ByteSlice>()
            .prefix_iter_mut(&mut txn, index_uuid.as_bytes())?
            .lazily_decode_data();
        while let Some(_) = updates.next() {
            unsafe {
                updates.del_current()?;
            }
        }
        drop(updates);
        txn.commit()?;
        uuids_to_remove
            .iter()
            .map(|uuid| update_uuid_to_file_path(&self.path, *uuid))
            .for_each(|path| {
                let _ = remove_file(path);
            });
        // If the currently processing update is from our index, we wait until it is
        // finished before returning. This ensure that no write to the index occurs after we delete it.
        if let State::Processing(uuid, _) = *self.state.read() {
            if uuid == index_uuid {
                // wait for a write lock, do nothing with it.
                self.state.write();
            }
        }
        Ok(())
    }
pub fn delete_all ( & self , index_uuid : Uuid ) -> Result < ( ) > { let mut txn = self . env . write_txn ( ) ? ; // Contains all the content file paths that we need to be removed if the deletion was successful. let mut uuids_to_remove = Vec :: new ( ) ; let mut pendings = self . pending_queue . iter_mut ( & mut txn ) ? . lazily_decode_data ( ) ; while let Some ( Ok ( ( ( _ , uuid , _ ) , pending ) ) ) = pendings . next ( ) { if uuid == index_uuid { unsafe { pendings . del_current ( ) ? ; } let mut pending = pending . decode ( ) ? ; if let Some ( update_uuid ) = pending . content . take ( ) { uuids_to_remove . push ( update_uuid ) ; } } } drop ( pendings ) ; let mut updates = self . updates . remap_key_type :: < ByteSlice > ( ) . prefix_iter_mut ( & mut txn , index_uuid . as_bytes ( ) ) ? . lazily_decode_data ( ) ; while let Some ( _ ) = updates . next ( ) { unsafe { updates . del_current ( ) ? ; } } drop ( updates ) ; txn . commit ( ) ? ; uuids_to_remove . iter ( ) . map ( | uuid | update_uuid_to_file_path ( & self . path , * uuid ) ) . for_each ( | path | { let _ = remove_file ( path ) ; } ) ; // If the currently processing update is from our index, we wait until it is // finished before returning. This ensure that no write to the index occurs after we delete it. if let State :: Processing ( uuid , _ ) = * self . state . read ( ) { if uuid == index_uuid { // wait for a write lock, do nothing with it. self . state . write ( ) ; } } Ok ( ( ) ) }
Delete all updates for an index from the update store.
Delete all updates for an index from the update store .
&self
index_uuid
Uuid
&self
index_uuid
Uuid