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

Function balanced_agg_tree

crates/kernel/src/shard.rs:2004–2015  ·  view source on GitHub ↗

A balanced binary [`AggNode`] over the contiguous shard-id range `lo..hi`.

(lo: u32, hi: u32)

Source from the content-addressed store, hash-verified

2002 foreign_bytes.saturating_add(added).saturating_sub(removed);
2003 let tentative = predicted(member_cost.saturating_add(bc), tent_fbytes);
2004
2005 // Open a new shard when the current one is non-empty and `b` won't fit. The
2006 // first block of a run always goes in (a lone over-cap block is flagged
2007 // infeasible below, not split — it can't be).
2008 if !members.is_empty() && tentative > max_cycles {
2009 max_shard_steps =
2010 max_shard_steps.max(predicted(member_cost, foreign_bytes));
2011 cur += 1;
2012 members.clear();
2013 foreign.clear();
2014 member_cost = 0;
2015 foreign_bytes = 0;
2016 }
2017
2018 // Commit `b` into the current shard.

Callers 1

partition_for_cycle_capFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected