aboutsummaryrefslogtreecommitdiff
path: root/ref/store/reading.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-25 14:31:16 +0000
committerGravatar Runxi Yu2026-03-25 14:31:16 +0000
commit48ff647cf4a8bb8f23fcd6b8616f56a8ef72b980 (patch)
treeae199c38042adaa544d5f7d31351661d5831381e /ref/store/reading.go
parent*: objectstore -> object/store (diff)
signatureNo signature
*: refstore -> ref/store
Diffstat (limited to 'ref/store/reading.go')
-rw-r--r--ref/store/reading.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/ref/store/reading.go b/ref/store/reading.go
new file mode 100644
index 00000000..3444f07f
--- /dev/null
+++ b/ref/store/reading.go
@@ -0,0 +1,34 @@
+package refstore
+
+import "codeberg.org/lindenii/furgit/ref"
+
+// ReadingStore reads Git references.
+type ReadingStore interface {
+ // Resolve resolves a reference name to either a symbolic or detached ref.
+ //
+ // Implementations should return value forms (ref.Detached or ref.Symbolic),
+ // not pointer forms. Returned refs do not borrow the store.
+ // If the reference does not exist, implementations should return
+ // ErrReferenceNotFound.
+ Resolve(name string) (ref.Ref, error)
+ // ResolveToDetached resolves a reference name to a detached object ID.
+ //
+ // Implementations may use backend-local lookup semantics for symbolic hops.
+ // Callers that need cross-backend symbolic resolution (for example in a
+ // chain of stores) should prefer repeatedly calling Resolve.
+ //
+ // ResolveToDetached resolves symbolic references only. It does not imply peeling
+ // annotated tag objects.
+ ResolveToDetached(name string) (ref.Detached, error)
+ // List returns references matching pattern.
+ //
+ // The exact pattern language is backend-defined.
+ List(pattern string) ([]ref.Ref, error)
+ // Close releases resources associated with the store.
+ //
+ // Transactions and batches borrowing the store are invalid after Close.
+ //
+ // Repeated calls to Close are undefined behavior unless the implementation
+ // explicitly documents otherwise.
+ Close() error
+}