Skip to main content

objects/transfer/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2//! Transfer planning for Heddle object lanes.
3//!
4//! One vocabulary for local sync, hosted sync, and the wire protocol:
5//! content-addressed objects that can ride the native pack, and signed
6//! sidecars that must use the out-of-pack verification paths.
7
8pub mod availability;
9pub mod graph;
10pub mod plan;
11
12pub use availability::{ObjectAvailabilityPlan, has_object, plan_object_availability};
13pub use graph::{
14    ObjectId, ObjectInfo, ObjectType, ObjectTypeBucket, PlannedObject, StateClosureOptions,
15    StateClosureTransferObjects, enumerate_state_closure, enumerate_state_closure_plan,
16    enumerate_state_closure_plan_with_options, enumerate_state_closure_transfer_from_boundaries,
17    enumerate_state_closure_transfer_with_options, enumerate_state_closure_with_options,
18    is_ancestor, missing_blobs_in_tree,
19};
20pub use plan::{
21    GitLaneTransferIntent, RepositoryTransferPlan, TransferPartitions, TransferPlanStats,
22};
23
24#[cfg(test)]
25mod tests {
26    use super::graph::ObjectType;
27
28    /// The push/pull packability split routes `StateAttachment` off the push
29    /// pack (weft#549 forgery seal) while leaving pull carriage and every other
30    /// type untouched.
31    #[test]
32    fn packable_predicates_split_state_attachment_by_direction() {
33        // Sidecar records are never packable in either direction.
34        for sidecar in [
35            ObjectType::Redaction,
36            ObjectType::StateVisibility,
37            ObjectType::KeyBinding,
38        ] {
39            assert!(!sidecar.packable_for_push(), "{sidecar:?} push");
40            assert!(!sidecar.packable_for_pull(), "{sidecar:?} pull");
41        }
42        // Content-addressed objects ride the pack in both directions.
43        for packable in [
44            ObjectType::Blob,
45            ObjectType::Tree,
46            ObjectType::State,
47            ObjectType::Action,
48        ] {
49            assert!(packable.packable_for_push(), "{packable:?} push");
50            assert!(packable.packable_for_pull(), "{packable:?} pull");
51        }
52        // The attachment record: excluded from the push pack, kept on pull.
53        assert!(!ObjectType::StateAttachment.packable_for_push());
54        assert!(ObjectType::StateAttachment.packable_for_pull());
55    }
56}