patternstore

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package patternstore manages one bounded, create-only local Pattern library. It does not play patterns, create Jobs, or access hardware.

Index

Constants

This section is empty.

Variables

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

func DefaultDir() (string, error)

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

func DefaultV2Dir() (string, error)

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 ImportResult struct {
	Records  []patterns.Record `json:"records"`
	Created  []string          `json:"created"`
	Existing []string          `json:"existing"`
	Total    int               `json:"total"`
}

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

func New(dir string) (*Store, error)

New validates the explicitly selected directory without reading or writing it. Filesystem ownership, privacy, type and identity are checked per operation.

func (*Store) Export

func (s *Store) Export() (data []byte, err error)

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) Get

func (s *Store) Get(id string) (record patterns.Record, err error)

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

func (s *Store) List() (records []patterns.Record, err error)

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.

func (*Store) Path

func (s *Store) Path() string

func (*Store) Resolve

func (s *Store) Resolve(id, revision string) (patterns.Record, error)

Resolve requires an exact content revision and returns the saved snapshot, never a newly compiled replacement. Callers may submit its CompiledProgram through the existing Job path; resolving itself has no execution behavior.

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 NewV2

func NewV2(dir string) (*StoreV2, error)

func (*StoreV2) Export

func (s *StoreV2) Export() (data []byte, err error)

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) Path

func (s *StoreV2) Path() string

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.

Jump to

Keyboard shortcuts

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