Documentation
¶
Overview ¶
Package patternstore manages one bounded, create-only local Pattern library. It does not play patterns, create Jobs, or access hardware.
Index ¶
- Variables
- func DefaultDir() (string, error)
- func DefaultV2Dir() (string, error)
- type ImportResult
- type ImportResultV2
- type Store
- func (s *Store) Export() (data []byte, err error)
- func (s *Store) Get(id string) (record patterns.Record, err error)
- func (s *Store) Import(data []byte) (result ImportResult, err error)
- func (s *Store) List() (records []patterns.Record, err error)
- func (s *Store) Path() string
- func (s *Store) Resolve(id, revision string) (patterns.Record, error)
- type StoreV2
- func (s *StoreV2) Export() (data []byte, err error)
- func (s *StoreV2) Get(id string) (record patternsv2.Inspection, err error)
- func (s *StoreV2) Import(data []byte) (result ImportResultV2, err error)
- func (s *StoreV2) List() (records []patternsv2.Inspection, err error)
- func (s *StoreV2) Path() string
- func (s *StoreV2) Resolve(id, revision string) (patternsv2.Record, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalid = errors.New("invalid pattern store request") ErrLimit = errors.New("pattern library limit exceeded") ErrNotFound = errors.New("pattern not found") ErrConflict = errors.New("pattern id already has different content") ErrRevisionConflict = errors.New("pattern revision does not match") ErrCorrupt = errors.New("pattern library is corrupt or noncanonical") ErrBusy = errors.New("pattern library is busy") ErrUnsafe = errors.New("pattern library path or files are unsafe") ErrUnsupported = errors.New("pattern persistence is unsupported on this platform") ErrCommitUncertain = errors.New("pattern publication occurred but final confirmation failed") )
var ( // ErrReadOnly distinguishes an intact but unsupported library from corrupt // data. Even an empty or idempotent import must not rewrite such a library. ErrReadOnly = errors.New("pattern library is read-only because a source or recipe is unsupported") ErrFormatMismatch = errors.New("pattern library uses a different snapshot format") )
Functions ¶
func DefaultDir ¶
DefaultDir reports the current user's application directory; it creates nothing and does not fall back to a source, system, or working directory.
func DefaultV2Dir ¶
DefaultV2Dir only computes a path. It never reads, creates, migrates or combines a v1/v2 directory; selecting a path remains the caller's job.
Types ¶
type ImportResult ¶
type ImportResultV2 ¶
type ImportResultV2 struct {
Records []patternsv2.Record `json:"records"`
Created []string `json:"created"`
Existing []string `json:"existing"`
Total int `json:"total"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store has no open handles or cache. Each operation obtains a short, cross-process library lock and checks the current on-disk snapshot.
func New ¶
New validates the explicitly selected directory without reading or writing it. Filesystem ownership, privacy, type and identity are checked per operation.
func (*Store) Export ¶
Export returns a canonical frozen package, including an empty records array for a missing library. It does not select or write an external output file.
func (*Store) Import ¶
func (s *Store) Import(data []byte) (result ImportResult, err error)
Import validates the entire authoring or frozen package before touching the library. Equal IDs and canonical content are idempotent; any conflict rejects the entire package. There is no replacement, deletion, replay or migration.
func (*Store) List ¶
List returns independent frozen records in exact ASCII ID order. A library directory that does not exist is empty and is not created by a read.
type StoreV2 ¶
type StoreV2 struct {
// contains filtered or unexported fields
}
StoreV2 is an independent, experimental library format. It uses the same private transaction/openFS implementation as Store, including all platform permissions, locking, identity checks, publication and close behavior. No operation reads a runtime library, submits a job or accesses a device.
func (*StoreV2) Export ¶
Export preserves the exact canonical snapshot, including intact unsupported records. It does not encode those records via the strict write path.
func (*StoreV2) Get ¶
func (s *StoreV2) Get(id string) (record patternsv2.Inspection, err error)
func (*StoreV2) Import ¶
func (s *StoreV2) Import(data []byte) (result ImportResultV2, err error)
Import accepts a complete, verified v2 frozen snapshot, never an authoring envelope or raw FrameProgram. Input validation finishes before opening or creating the library. The transaction is create-only and all-or-nothing.
func (*StoreV2) List ¶
func (s *StoreV2) List() (records []patternsv2.Inspection, err error)
List includes explicit read-only inspections for supported outer records whose source/recipe verifier is unavailable. Each inspection owns its data.
func (*StoreV2) Resolve ¶
func (s *StoreV2) Resolve(id, revision string) (patternsv2.Record, error)
Resolve requires exact identity and a known verifier for this record only. Another unsupported record in the library does not block this read. It never returns a current-compiler replacement or claims execution availability.