aboutsummaryrefslogtreecommitdiff
path: root/commitquery/queries.go
blob: 33709783ec2f453606316ce31527b980440eac74 (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
23
24
25
26
package commitquery

import (
	"sync"

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

// Queries provides commit-domain queries over one object fetcher
// and optional commit-graph reader.
//
// Queries reuses internal mutable query workers across operations.
//
// Labels: MT-Safe.
type Queries struct {
	fetcher *objectfetch.Fetcher
	graph   *commitgraphread.Reader

	mu      sync.Mutex
	idle    []*query
	maxIdle int
}

// TODO: Research a shared arena, or perhaps worker-reconciliation
// schemes if a complete shared arena proves to be too contentious.