Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("resource: not found")
ErrNotFound is returned by Store.Get/UpdateCurrentSnapshot when a Resource isn't registered.
Functions ¶
func SplitRef ¶
SplitRef splits a possibly ref-bearing reference — readproof://<ns>/<path> or readproof://<ns>/<path>@<ref> — into its bare URI and ref. A bare URI returns ref "". Only the LAST "@" is treated as the ref delimiter; whatever precedes it must be a valid bare URI, so a stray second "@" is an error rather than a silently mangled path. This is the single entry point for user-supplied references (CLI args, API request bodies); everything downstream works with the bare URI plus an explicit ref, never with the combined string.
Types ¶
type Resource ¶
type Resource struct {
URI string
Namespace string
Path string
SourceID string
SourceConfig source.Config
PolicyID string
Policy policy.Policy
// CurrentSnapshotID is "" until the first successful resolve.
CurrentSnapshotID string
CreatedAt time.Time
UpdatedAt time.Time
}
Resource is the stable logical identity consumed by applications.
type Store ¶
type Store interface {
Create(ctx context.Context, r Resource) error
Get(ctx context.Context, uri string) (Resource, error)
List(ctx context.Context) ([]Resource, error)
UpdateCurrentSnapshot(ctx context.Context, uri, snapshotID string) error
}
Store is the single public port over a Resource's sources+policies+ resources rows — callers never juggle three stores for one Resource.
type URI ¶
URI is a parsed readproof://<namespace>/<path> logical identifier.
func ParseURI ¶
ParseURI parses a *bare* readproof://<namespace>/<path> identifier. It rejects anything carrying a trailing "@<ref>": "@" is reserved for tag refs, and silently folding one into the path would make `readproof://ns/p@prod` register or look up a resource literally named "p@prod". Callers handling a user-supplied reference that may carry a ref must run it through SplitRef first and parse the bare URI SplitRef returns.