aboutsummaryrefslogtreecommitdiff
path: root/commitquery/queries_new.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-28 17:40:02 +0000
committerGravatar Runxi Yu2026-03-28 17:40:02 +0000
commit06583274fa64ad6677773bf4ca54f69226388203 (patch)
tree66354bf972d267bf7ee5135eb7e5b90c31f9fe4d /commitquery/queries_new.go
parentformat/commitgraph/read: Lifetime (diff)
signatureNo signature
commitquery: Make a reusable engine thingy
Diffstat (limited to 'commitquery/queries_new.go')
-rw-r--r--commitquery/queries_new.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/commitquery/queries_new.go b/commitquery/queries_new.go
new file mode 100644
index 00000000..b43084b4
--- /dev/null
+++ b/commitquery/queries_new.go
@@ -0,0 +1,25 @@
+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.
+func New(store objectstore.ReadingStore, graph *commitgraphread.Reader) *Queries {
+ maxIdle := runtime.GOMAXPROCS(0)
+ if maxIdle < 1 {
+ maxIdle = 1
+ }
+
+ return &Queries{
+ store: store,
+ graph: graph,
+ maxIdle: maxIdle,
+ }
+}