shithub: furgit

ref: 3ce59c3248dec0eb0f918c42f37f53bc2ac20425
dir: /reachability/reachability.go/

View raw version
package reachability

import (
	commitgraphread "codeberg.org/lindenii/furgit/format/commitgraph/read"
	objectstore "codeberg.org/lindenii/furgit/object/store"
)

// Reachability provides graph traversal over objects in one object store.
//
// Labels: MT-Safe.
type Reachability struct {
	store objectstore.Reader
	graph *commitgraphread.Reader
}

// New builds a Reachability over one object store with an optional
// commit-graph reader for faster commit-domain traversal.
//
// Labels: Deps-Borrowed, Life-Parent.
func New(store objectstore.Reader, graph *commitgraphread.Reader) *Reachability {
	return &Reachability{store: store, graph: graph}
}