Skip to main content

push_branch_steps

Function push_branch_steps 

Source
pub fn push_branch_steps(
    tx: &dyn Transport,
    store: &ObjectStore,
    branch: &str,
    tip: Hash,
    condition: RefWriteCondition,
    rebaseline_threshold: usize,
    pack_payload_cap: u64,
    control: &PushControl<'_>,
    on_step: &mut dyn FnMut(Hash) -> Result<(), DispatchError>,
) -> Result<usize, DispatchError>
Expand description

push_branch_with_limits that splits a push too large for one advance along the branch’s first-parent history (WP-1.17b, R-164), and reports each published advance to on_step with the commit the remote branch now points at. Returns the number of advances.

The split applies only when the transport ticketed-uploads (UploadLimits::tickets_per_advance) and the conservative estimate of the push’s packs exceeds the data-pack budget of one advance. Otherwise this is exactly one push_branch_with_limits call. When it applies, the first advance uses condition, and every later one is a Match on the previous advance’s commit, whatever condition was, so a long split never overwrites a concurrent pusher. Each advance uploads its own packs just before it lands; nothing is pre-uploaded.

A failure after the first advance is returned as DispatchError::SplitInterrupted, naming the published prefix; running the push again resumes from it.

§Errors

As push_branch, plus the split’s own refusals (see plan_push_steps), and whatever on_step returns.