fn filter_idle_canisters(
    ordered_canister_ids: &[CanisterId],
    all_canister_states: &BTreeMap<CanisterId, CanisterState>,
    heartbeat_handling: HeartbeatHandling,
    heap_delta_rate_limit: NumBytes,
) -> (Vec<CanisterId>, BTreeSet<CanisterId>) {
    let mut rate_limited_canisters = BTreeSet::new();
    // Consider only canisters with some input messages for execution.
    let runnable_canisters = ordered_canister_ids
        .iter()
        .filter(|canister_id| {
            let canister = all_canister_states.get(canister_id).unwrap();
            let is_under_limit = canister.scheduler_state.heap_delta_debit < heap_delta_rate_limit;
            if !is_under_limit {
                rate_limited_canisters.insert(**canister_id);
            }
            (canister.has_input()
                || (heartbeat_handling.should_execute_heartbeat()
                    && canister.exports_heartbeat_method()))
                && is_under_limit
        })
        .cloned()
        .collect();
    (runnable_canisters, rate_limited_canisters)
}
// Returns a list of canisters that can be executed and a set of canisters that
// were heap delta rate limited. Does not alter the order of canisters to be
// executed.
Returns a list of canisters that can be executed and a set of canisters that
were heap delta rate limited. Does not alter the order of canisters to be
executed.
Returns a list of canisters that can be executed and a set of canisters that were heap delta rate limited . Does not alter the order of canisters to be executed .
fn filter_idle_canisters(
    ordered_canister_ids: &[CanisterId],
    all_canister_states: &BTreeMap<CanisterId, CanisterState>,
    heartbeat_handling: HeartbeatHandling,
    heap_delta_rate_limit: NumBytes,
) -> (Vec<CanisterId>, BTreeSet<CanisterId>) {
    let mut rate_limited_canisters = BTreeSet::new();
    // Consider only canisters with some input messages for execution.
    let runnable_canisters = ordered_canister_ids
        .iter()
        .filter(|canister_id| {
            let canister = all_canister_states.get(canister_id).unwrap();
            let is_under_limit = canister.scheduler_state.heap_delta_debit < heap_delta_rate_limit;
            if !is_under_limit {
                rate_limited_canisters.insert(**canister_id);
            }
            (canister.has_input()
                || (heartbeat_handling.should_execute_heartbeat()
                    && canister.exports_heartbeat_method()))
                && is_under_limit
        })
        .cloned()
        .collect();
    (runnable_canisters, rate_limited_canisters)
}
fn filter_idle_canisters ( ordered_canister_ids : & [ CanisterId ] , all_canister_states : & BTreeMap < CanisterId , CanisterState > , heartbeat_handling : HeartbeatHandling , heap_delta_rate_limit : NumBytes , ) -> ( Vec < CanisterId > , BTreeSet < CanisterId > ) { let mut rate_limited_canisters = BTreeSet :: new ( ) ; // Consider only canisters with some input messages for execution. let runnable_canisters = ordered_canister_ids . iter ( ) . filter ( | canister_id | { let canister = all_canister_states . get ( canister_id ) . unwrap ( ) ; let is_under_limit = canister . scheduler_state . heap_delta_debit < heap_delta_rate_limit ; if ! is_under_limit { rate_limited_canisters . insert ( * * canister_id ) ; } ( canister . has_input ( ) || ( heartbeat_handling . should_execute_heartbeat ( ) && canister . exports_heartbeat_method ( ) ) ) && is_under_limit } ) . cloned ( ) . collect ( ) ; ( runnable_canisters , rate_limited_canisters ) }
Returns a list of canisters that can be executed and a set of canisters that
were heap delta rate limited.
Returns a list of canisters that can be executed and a set of canisters that were heap delta rate limited .
ordered_canister_ids
&[CanisterId]
all_canister_states
&BTreeMap<CanisterId, CanisterState>
heartbeat_handling
HeartbeatHandling
heap_delta_rate_limit
NumBytes
ordered_canister_ids
&[CanisterId]
all_canister_states
&BTreeMap<CanisterId, CanisterState>
heartbeat_handling
HeartbeatHandling
heap_delta_rate_limit
NumBytes