aboutsummaryrefslogtreecommitdiff
path: root/commitquery/queries_new.go
blob: fd38b6a98336f56199e7893d5cff016632de83b5 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package commitquery

import (
	"runtime"

	commitgraphread "lindenii.org/go/furgit/format/commitgraph/read"
	objectfetch "lindenii.org/go/furgit/object/fetch"
)

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

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