tag

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

View Source
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.

View Source
var ErrNotFound = errors.New("tag: not found")

ErrNotFound is returned by Store.Get/Delete when no such tag exists.

View Source
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

func ValidateName(name string) error

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.

type Tag

type Tag struct {
	ResourceURI string
	Name        string
	SnapshotID  string
	UpdatedAt   time.Time
}

Tag is a named pointer from a Resource to one of its Snapshots.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL