Documentation
¶
Overview ¶
Package tag defines named, movable pointers from a Resource to one of its Snapshots — `(resource_uri, tag) -> snapshot_id`. A tag is the only mutable thing in the model: the Snapshot it names never changes, but the tag can be re-pointed at a different Snapshot at any time. Resolving `readproof://ns/path@<tag>` therefore delivers exactly the bytes that tag names, with no source fetch and no policy evaluation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidName = errors.New("tag: invalid tag name")
ErrInvalidName is returned by ValidateName (and therefore by Store.Set) for a tag name that breaks the naming rules.
var ErrNotFound = errors.New("tag: not found")
ErrNotFound is returned by Store.Get/Delete when no such tag exists.
var ErrSnapshotMismatch = errors.New("tag: snapshot belongs to a different resource")
ErrSnapshotMismatch is returned by Store.Set when the snapshot exists but was observed for a different Resource. A tag names a snapshot *of its own resource*; a cross-resource pointer would let `readproof://a/x@prod` deliver content that never belonged to `readproof://a/x`.
Functions ¶
func ValidateName ¶
ValidateName is the one place the tag naming rules live. Every write path (Store.Set in both storage backends, and so the API and CLI above them) goes through it, so no backend can drift from another.
Types ¶
type Store ¶
type Store interface {
Set(ctx context.Context, t Tag) error
Get(ctx context.Context, uri, name string) (Tag, error)
List(ctx context.Context, uri string) ([]Tag, error)
Delete(ctx context.Context, uri, name string) error
}
Store persists tags. Set is an upsert and must reject a SnapshotID that doesn't exist or belongs to a different Resource; List returns one resource's tags sorted by name.