Documentation
¶
Overview ¶
Package registry stores immutable, content-addressed package records and agentpack revisions under the user's agentpack home.
Index ¶
- Variables
- func CaptureProjectIfEnabled(home, definitionRoot, sourceProject, sourceNode, modeName string) (Agentpack, Revision, bool, error)
- func PendingRestore(home, directory string) (bool, error)
- func RecoverDefinition(home, directory string) error
- func ValidateChanges(store *state.Store, changes []state.Change) error
- func ValidatePeer(node string) error
- type Agentpack
- type CaptureInput
- type Conflict
- type ConflictField
- type DiffResult
- type Draft
- type DraftInput
- type DraftReview
- type DraftState
- type Package
- type PackagePin
- type PeerReplica
- type Revision
- type Store
- func (s *Store) AgentpackDeleted(id string) (bool, error)
- func (s *Store) Capture(input CaptureInput) (Agentpack, Revision, error)
- func (s *Store) Close() error
- func (s *Store) CollectGarbage() ([]string, error)
- func (s *Store) Conflict(id string) (Conflict, error)
- func (s *Store) DeleteAgentpack(id string) (Tombstone, error)
- func (s *Store) DeleteDraft(id string) error
- func (s *Store) Diff(fromID, toID string) (DiffResult, error)
- func (s *Store) EnrollOwnMachine(node string) error
- func (s *Store) EnrollPeer(node string) error
- func (s *Store) Get(id string) (Agentpack, []Revision, error)
- func (s *Store) GetDraft(id string) (Draft, error)
- func (s *Store) Heads(id string) ([]string, error)
- func (s *Store) ImportPackages(packages []Package) error
- func (s *Store) ListAgentpacks() ([]Agentpack, error)
- func (s *Store) ListDrafts() ([]Draft, error)
- func (s *Store) ListPackages() ([]Package, error)
- func (s *Store) ListPeers() ([]PeerReplica, error)
- func (s *Store) MergeHeads() error
- func (s *Store) PeerRemoved(node string) (bool, error)
- func (s *Store) Preview(id, revisionID, directory string) (Revision, DiffResult, error)
- func (s *Store) Recover(directory string) error
- func (s *Store) RemovePeer(node string) error
- func (s *Store) Rename(id, name string) (Agentpack, error)
- func (s *Store) Resolve(id string, heads []string, choices map[string]string, node string) (Revision, error)
- func (s *Store) Restore(id, revisionID, directory string, apply func() error) error
- func (s *Store) RevalidateDraft(id string, state DraftState) (DraftReview, error)
- func (s *Store) SaveDraft(input DraftInput) (Draft, error)
- func (s *Store) SetCapture(directory, agentpackID string, enabled bool) error
- type Tombstone
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("registry item not found")
Functions ¶
func CaptureProjectIfEnabled ¶
func CaptureProjectIfEnabled(home, definitionRoot, sourceProject, sourceNode, modeName string) (Agentpack, Revision, bool, error)
CaptureProjectIfEnabled returns without opening or creating registry storage when capture is disabled.
func PendingRestore ¶
PendingRestore reports an interrupted restore without changing project or registry files.
func RecoverDefinition ¶
RecoverDefinition is a no-op without an interrupted restore and does not create registry storage.
func ValidateChanges ¶ added in v0.14.0
ValidateChanges checks public records before a peer page can enter the local database.
func ValidatePeer ¶ added in v0.14.0
Types ¶
type CaptureInput ¶
type Conflict ¶ added in v0.12.6
type Conflict struct {
Heads []string `json:"heads"`
Fields []ConflictField `json:"fields"`
}
type ConflictField ¶ added in v0.12.6
type ConflictField struct {
Path string `json:"path"`
Name string `json:"name"`
Base string `json:"base"`
Values map[string]string `json:"values"`
}
ConflictField is one value both heads changed differently. Values maps a head ID to its display text.
type DiffResult ¶
type Draft ¶
type Draft struct {
ID string `json:"id"`
Item string `json:"item"`
Revision string `json:"revision,omitempty"`
Node string `json:"node"`
Directory string `json:"directory"`
Reason string `json:"reason"`
PackID string `json:"pack_id,omitempty"`
FolderIdentity string `json:"folder_identity"`
ExpectedPins map[string]PackagePin `json:"expected_pins"`
NeededHolder string `json:"needed_holder,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type DraftInput ¶
type DraftInput struct {
Item string `json:"item"`
Revision string `json:"revision,omitempty"`
Node string `json:"node"`
Directory string `json:"directory"`
Reason string `json:"reason"`
PackID string `json:"pack_id,omitempty"`
FolderIdentity string `json:"folder_identity"`
ExpectedPins map[string]PackagePin `json:"expected_pins"`
NeededHolder string `json:"needed_holder,omitempty"`
}
type DraftReview ¶
type DraftState ¶
type DraftState struct {
Reachable bool `json:"reachable"`
FolderIdentity string `json:"folder_identity"`
Pins map[string]PackagePin `json:"pins"`
CurrentDiff *DiffResult `json:"current_diff,omitempty"`
MissingObjects []string `json:"missing_objects,omitempty"`
NeededHolder string `json:"needed_holder,omitempty"`
}
type Package ¶
type Package struct {
ID string `json:"id"`
Schema int `json:"schema,omitempty"`
Module string `json:"module"`
Direct bool `json:"direct,omitempty"`
Commit string `json:"commit"`
ContentHash string `json:"content_hash,omitempty"`
Kind string `json:"kind"`
URL string `json:"url"`
Owner string `json:"owner"`
Repo string `json:"repo"`
Path string `json:"path,omitempty"`
CacheKey string `json:"cache_key"`
Name string `json:"name,omitempty"`
SourceNode string `json:"source_node,omitempty"`
Project string `json:"project,omitempty"`
}
type PackagePin ¶
type PeerReplica ¶
type Revision ¶
type Revision struct {
ID string `json:"id"`
Schema int `json:"schema,omitempty"`
AgentpackID string `json:"agentpack_id"`
ParentIDs []string `json:"parent_ids,omitempty"`
Manifest string `json:"manifest"`
Lock string `json:"lock"`
PackageIDs []string `json:"package_ids,omitempty"`
SourceNode string `json:"source_node,omitempty"`
Project string `json:"project,omitempty"`
CreatedAt time.Time `json:"created_at"`
Label string `json:"label,omitempty"`
Mode string `json:"mode,omitempty"`
NeedsLocalConfiguration bool `json:"needs_local_configuration,omitempty"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AgentpackDeleted ¶ added in v0.9.3
AgentpackDeleted reports whether a stable agentpack ID has a local tombstone.
func (*Store) Capture ¶
func (s *Store) Capture(input CaptureInput) (Agentpack, Revision, error)
Capture appends a content-addressed revision, creating a stable agentpack ID when absent.
func (*Store) CollectGarbage ¶
func (*Store) Conflict ¶ added in v0.12.6
Conflict reports the first pair of heads that needs a person, or empty when there is none.
func (*Store) DeleteDraft ¶
func (*Store) Diff ¶
func (s *Store) Diff(fromID, toID string) (DiffResult, error)
Diff compares package pins and selected mode from two verified revisions.
func (*Store) EnrollOwnMachine ¶ added in v0.12.6
func (*Store) EnrollPeer ¶
func (*Store) ImportPackages ¶ added in v0.9.3
ImportPackages adds indexed cache package records to the Library without associating it with a synthetic agentpack revision.
func (*Store) ListAgentpacks ¶
ListAgentpacks returns named packs from the rebuildable index.
func (*Store) ListDrafts ¶
func (*Store) ListPackages ¶
ListPackages loads and verifies every indexed package object.
func (*Store) ListPeers ¶
func (s *Store) ListPeers() ([]PeerReplica, error)
func (*Store) MergeHeads ¶ added in v0.12.6
MergeHeads settles every agentpack that replication left with several heads, as far as it can without a person.
func (*Store) PeerRemoved ¶ added in v0.14.1
PeerRemoved reports whether the owner removed this peer, which automatic pairing must respect.
func (*Store) Preview ¶
func (s *Store) Preview(id, revisionID, directory string) (Revision, DiffResult, error)
Preview exposes the redacted target snapshot; bindings are private to this machine.
func (*Store) RemovePeer ¶
func (*Store) Resolve ¶ added in v0.12.6
func (s *Store) Resolve(id string, heads []string, choices map[string]string, node string) (Revision, error)
Resolve merges two heads using a person's choice for every conflicting field: path to the head that wins.
func (*Store) Restore ¶
Restore writes the selected definition, runs apply, and restores both original files on any failure.
func (*Store) RevalidateDraft ¶
func (s *Store) RevalidateDraft(id string, state DraftState) (DraftReview, error)