contextprofile

package
v0.27.7 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 12 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 contextprofile stores the owner's named contexts. It owns persistence, revision checks and backups; activation and tool enforcement belong to the host.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("context not found")
	ErrConflict = errors.New("context changed; read its current revision before writing")
	ErrInvalid  = errors.New("invalid context")
)

Functions

This section is empty.

Types

type Backup

type Backup struct {
	Record
	ArchivedAt string `json:"archived_at"`
	Reason     string `json:"reason"`
}

Backup is the exact previous definition, including the revision used to replace it.

type Record

type Record struct {
	steer.Preset
	Revision  string `json:"revision"`
	UpdatedAt string `json:"updated_at"`
}

Record keeps the authored definition separate from any resolved context.

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, db *sql.DB) (*Store, error)

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, name, revision, reason string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, name string) (Record, error)

func (*Store) History

func (s *Store) History(ctx context.Context, name string) ([]Backup, error)

History returns superseded and deleted definitions, newest first. Restoring one uses Put with the current revision; backups never bypass optimistic concurrency.

func (*Store) List

func (s *Store) List(ctx context.Context) ([]Record, error)

func (*Store) Put

func (s *Store) Put(ctx context.Context, p steer.Preset, revision, reason string) (Record, error)

Put creates only when revision is empty, or replaces exactly that revision. Replacements back up the previous record in the same transaction. A stale writer cannot overwrite a newer edit, even after deletion and recreation.

Jump to

Keyboard shortcuts

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