shithub: furgit

ref: fb9eb058f1c9b7cb26f33bbe679a85f530566641
dir: /commitquery/queries_new.go/

View raw version
package commitquery

import (
	"runtime"

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

// New builds one concurrent-safe commit query service over one object store
// and optional commit-graph reader.
//
// Labels: Deps-Borrowed, Life-Parent.
func New(store objectstore.ReadingStore, graph *commitgraphread.Reader) *Queries {
	maxIdle := max(runtime.GOMAXPROCS(0), 1)

	return &Queries{
		store:   store,
		graph:   graph,
		maxIdle: maxIdle,
	}
}