fn partition_canisters_to_cores(
    scheduler_cores: usize,
    executable_canister_ids: &[CanisterId],
    mut canisters: BTreeMap<CanisterId, CanisterState>,
) -> (Vec<Vec<CanisterState>>, BTreeMap<CanisterId, CanisterState>) {
    let mut res = vec![Vec::<CanisterState>::new(); scheduler_cores];
    for (i, canister_id) in executable_canister_ids.iter().enumerate() {
        res[i % scheduler_cores].push(canisters.remove(canister_id).unwrap());
    }
    (res, canisters)
}
// Partitions the executable canisters to the available cores for execution.
//
// Returns the executable canisters partitioned by cores and the
// non-executable canisters.
//
// ## Example
//
// Given a list of 8 executable canisters and 3 cpu cores, then we have the
// following assignment:
// * Core 1 takes `CanisterId1`, `CanisterId4`, `CanisterId7`
// * Core 2 takes CanisterId2`, `CanisterId5`, `CanisterId8`
// * Core 3 takes CanisterId3`, `CanisterId6`
Partitions the executable canisters to the available cores for execution.
Returns the executable canisters partitioned by cores and the
non-executable canisters.
Partitions the executable canisters to the available cores for execution . Returns the executable canisters partitioned by cores and the non - executable canisters .
fn partition_canisters_to_cores(
    scheduler_cores: usize,
    executable_canister_ids: &[CanisterId],
    mut canisters: BTreeMap<CanisterId, CanisterState>,
) -> (Vec<Vec<CanisterState>>, BTreeMap<CanisterId, CanisterState>) {
    let mut res = vec![Vec::<CanisterState>::new(); scheduler_cores];
    for (i, canister_id) in executable_canister_ids.iter().enumerate() {
        res[i % scheduler_cores].push(canisters.remove(canister_id).unwrap());
    }
    (res, canisters)
}
fn partition_canisters_to_cores ( scheduler_cores : usize , executable_canister_ids : & [ CanisterId ] , mut canisters : BTreeMap < CanisterId , CanisterState > , ) -> ( Vec < Vec < CanisterState > > , BTreeMap < CanisterId , CanisterState > ) { let mut res = vec ! [ Vec CanisterState new ( ) scheduler_cores ] ; for ( i , canister_id ) in executable_canister_ids . iter ( ) . enumerate ( ) { res [ i % scheduler_cores ] . push ( canisters . remove ( canister_id ) . unwrap ( ) ) ; } ( res , canisters ) }
Partitions the executable canisters to the available cores for execution.
Partitions the executable canisters to the available cores for execution .
scheduler_cores
usize
executable_canister_ids
&[CanisterId]
canisters
BTreeMap<CanisterId, CanisterState>
scheduler_cores
usize
executable_canister_ids
&[CanisterId]
canisters
BTreeMap<CanisterId, CanisterState>
example
Given a list of 8 executable canisters and 3 cpu cores, then we have the
following assignment:
Core 1 takes `CanisterId1`, `CanisterId4`, `CanisterId7`
Core 2 takes CanisterId2`, `CanisterId5`, `CanisterId8`
Core 3 takes CanisterId3`, `CanisterId6`
Given a list of 8 executable canisters and 3 cpu cores then we have the following assignment : Core 1 takes ` CanisterId1 ` ` CanisterId4 ` ` CanisterId7 ` Core 2 takes CanisterId2 ` ` CanisterId5 ` ` CanisterId8 ` Core 3 takes CanisterId3 ` ` CanisterId6 `