blob: 4cca85449732a44470f4e9f003c1c3e50d3de5fc (
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Package refstore provides interfaces for reference storage backends.
package refstore
import (
"errors"
"codeberg.org/lindenii/furgit/ref"
)
// ErrReferenceNotFound indicates that a reference does not exist in a backend.
// TODO: interface error? just like object not found in objectstore
var ErrReferenceNotFound = errors.New("refstore: reference not found")
// Store reads Git references.
type Store 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.
// If the reference does not exist, implementations should return
// ErrReferenceNotFound.
Resolve(name string) (ref.Ref, error)
// ResolveFully 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.
//
// ResolveFully resolves symbolic references only. It does not imply peeling
// annotated tag objects.
ResolveFully(name string) (ref.Detached, error)
// List returns references matching pattern.
//
// The exact pattern language is backend-defined.
List(pattern string) ([]ref.Ref, error)
// Shorten returns the shortest unambiguous shorthand for a full
// reference name within this store's visible namespace.
//
// If name does not exist in this store, implementations should return
// ErrReferenceNotFound.
Shorten(name string) (string, error)
// Close releases resources associated with the store.
Close() error
}
|