fn trigger_children(
    io_executor: &mut dyn Executor,
    directories: &mut HashMap<PathBuf, DirStatus>,
    budget: &mut MemoryBudget,
    item: Item,
) -> Result<usize> {
    let mut result = 0;
    if let Kind::Directory = item.kind {
        let mut pending = Vec::new();
        directories
            .entry(item.full_path)
            .and_modify(|status| match status {
                DirStatus::Exists => unreachable!(),
                DirStatus::Pending(pending_inner) => {
                    pending.append(pending_inner);
                    *status = DirStatus::Exists;
                }
            })
            .or_insert_with(|| unreachable!());
        result += pending.len();
        for pending_item in pending.into_iter() {
            for mut item in Vec::from_iter(io_executor.execute(pending_item)) {
                // TODO capture metrics
                budget.reclaim(&item);
                filter_result(&mut item).chain_err(|| ErrorKind::ExtractingPackage)?;
                result += trigger_children(io_executor, directories, budget, item)?;
            }
        }
    };
    Ok(result)
}
/// Dequeue the children of directories queued up waiting for the directory to
/// be created.
///
/// Currently the volume of queued items does not count as backpressure against
/// the main tar extraction process.
Dequeue the children of directories queued up waiting for the directory to
be created.

Currently the volume of queued items does not count as backpressure against
the main tar extraction process.
Dequeue the children of directories queued up waiting for the directory to be created . Currently the volume of queued items does not count as backpressure against the main tar extraction process .
fn trigger_children(
    io_executor: &mut dyn Executor,
    directories: &mut HashMap<PathBuf, DirStatus>,
    budget: &mut MemoryBudget,
    item: Item,
) -> Result<usize> {
    let mut result = 0;
    if let Kind::Directory = item.kind {
        let mut pending = Vec::new();
        directories
            .entry(item.full_path)
            .and_modify(|status| match status {
                DirStatus::Exists => unreachable!(),
                DirStatus::Pending(pending_inner) => {
                    pending.append(pending_inner);
                    *status = DirStatus::Exists;
                }
            })
            .or_insert_with(|| unreachable!());
        result += pending.len();
        for pending_item in pending.into_iter() {
            for mut item in Vec::from_iter(io_executor.execute(pending_item)) {
                // TODO capture metrics
                budget.reclaim(&item);
                filter_result(&mut item).chain_err(|| ErrorKind::ExtractingPackage)?;
                result += trigger_children(io_executor, directories, budget, item)?;
            }
        }
    };
    Ok(result)
}
fn trigger_children ( io_executor : & mut dyn Executor , directories : & mut HashMap < PathBuf , DirStatus > , budget : & mut MemoryBudget , item : Item , ) -> Result < usize > { let mut result = 0 ; if let Kind :: Directory = item . kind { let mut pending = Vec :: new ( ) ; directories . entry ( item . full_path ) . and_modify ( | status | match status { DirStatus :: Exists => unreachable ! ( ) , DirStatus :: Pending ( pending_inner ) => { pending . append ( pending_inner ) ; * status = DirStatus :: Exists ; } } ) . or_insert_with ( | | unreachable ! ( ) ) ; result += pending . len ( ) ; for pending_item in pending . into_iter ( ) { for mut item in Vec :: from_iter ( io_executor . execute ( pending_item ) ) { // TODO capture metrics budget . reclaim ( & item ) ; filter_result ( & mut item ) . chain_err ( | | ErrorKind :: ExtractingPackage ) ? ; result += trigger_children ( io_executor , directories , budget , item ) ? ; } } } ; Ok ( result ) }
Dequeue the children of directories queued up waiting for the directory to
be created.
Dequeue the children of directories queued up waiting for the directory to be created .
io_executor
&mut dyn Executor
directories
&mut HashMap<PathBuf, DirStatus>
budget
&mut MemoryBudget
item
Item