MCPcopy Create free account
hub / github.com/argumentcomputer/ix / BudgetPlan

Class BudgetPlan

crates/kernel/src/shard.rs:1785–1808  ·  view source on GitHub ↗

A partition sized to a per-shard Zisk **cycle** budget (rather than a fixed shard count). See [`partition_for_cycle_cap`].

Source from the content-addressed store, hash-verified

1783 }
1784 let size = |b: u32| profile.block(b).serialized_size;
1785 let (crow, ccol) = profile.consumers_csr();
1786 let consumers = |b: u32| &ccol[crow[b as usize]..crow[b as usize + 1]];
1787
1788 let mut owned = vec![0.0f64; num_shards];
1789 for b in 0..n {
1790 owned[shard_of[b] as usize] += static_owned_weight(size(b as u32));
1791 }
1792 // fcnt[k][p] = number of k-owned consumers of foreign producer p;
1793 // fbytes[k] = Σ size(p) over k's frontier (fcnt keys).
1794 let mut fcnt: Vec<FxHashMap<u32, u32>> =
1795 vec![FxHashMap::default(); num_shards];
1796 let mut fbytes = vec![0.0f64; num_shards];
1797 for c in 0..n as u32 {
1798 let kc = shard_of[c as usize];
1799 for &p in profile.producers(c) {
1800 if shard_of[p as usize] != kc {
1801 let e = fcnt[kc as usize].entry(p).or_insert(0);
1802 if *e == 0 {
1803 fbytes[kc as usize] += f64::from(size(p));
1804 }
1805 *e += 1;
1806 }
1807 }
1808 }
1809
1810 let mut moves = 0usize;
1811 loop {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected