aboutsummaryrefslogtreecommitdiff
path: root/reachability/reachability.go
diff options
context:
space:
mode:
Diffstat (limited to 'reachability/reachability.go')
-rw-r--r--reachability/reachability.go71
1 files changed, 36 insertions, 35 deletions
diff --git a/reachability/reachability.go b/reachability/reachability.go
index 9126ee84..29ac2a93 100644
--- a/reachability/reachability.go
+++ b/reachability/reachability.go
@@ -71,6 +71,42 @@ func (r *Reachability) IsAncestor(ancestor, descendant objectid.ObjectID) (bool,
return false, nil
}
+// CheckConnected verifies that all objects reachable from wants (under the
+// selected domain) can be fully traversed without missing-object/type/parse
+// errors, excluding subgraphs rooted at haves.
+//
+// Even with commit-graph acceleration available, each visited commit is
+// still validated against the object store.
+func (r *Reachability) CheckConnected(domain Domain, haves, wants map[objectid.ObjectID]struct{}) error {
+ walk := r.Walk(domain, haves, wants)
+
+ walk.strict = true
+ for range walk.Seq() {
+ }
+
+ return walk.Err()
+}
+
+// Walk creates one single-use traversal over the selected domain.
+//
+// In DomainCommits, when a commit-graph reader is attached, parent expansion
+// may use commit-graph metadata for speed.
+func (r *Reachability) Walk(domain Domain, haves, wants map[objectid.ObjectID]struct{}) *Walk {
+ walk := &Walk{
+ reachability: r,
+ domain: domain,
+ haves: haves,
+ wants: wants,
+ }
+
+ err := validateDomain(domain)
+ if err != nil {
+ walk.err = err
+ }
+
+ return walk
+}
+
func (r *Reachability) isAncestorGraph(ancestor, descendant objectid.ObjectID) (bool, bool, error) {
if r.graph == nil {
return false, false, nil
@@ -141,38 +177,3 @@ func (r *Reachability) isAncestorGraph(ancestor, descendant objectid.ObjectID) (
return false, true, nil
}
-
-// CheckConnected verifies that all objects reachable from wants (under the
-// selected domain) can be fully traversed without missing-object/type/parse
-// errors, excluding subgraphs rooted at haves.
-//
-// Even with commit-graph acceleration available, each visited commit is
-// still validated against the object store.
-func (r *Reachability) CheckConnected(domain Domain, haves, wants map[objectid.ObjectID]struct{}) error {
- walk := r.Walk(domain, haves, wants)
- walk.strict = true
- for range walk.Seq() {
- }
-
- return walk.Err()
-}
-
-// Walk creates one single-use traversal over the selected domain.
-//
-// In DomainCommits, when a commit-graph reader is attached, parent expansion
-// may use commit-graph metadata for speed.
-func (r *Reachability) Walk(domain Domain, haves, wants map[objectid.ObjectID]struct{}) *Walk {
- walk := &Walk{
- reachability: r,
- domain: domain,
- haves: haves,
- wants: wants,
- }
-
- err := validateDomain(domain)
- if err != nil {
- walk.err = err
- }
-
- return walk
-}