Help us shape the future of Go! Take the 2026 Go Developer Survey

artifact

package
v0.2.50 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package artifact is the content-addressed artifact store: where snapshot (and future event) artifacts live. An event in the control contract is a notification + a reference into this store; the bytes never travel in the event log itself (see internal docs/todo-architecture-saas-fleet.md §3.1).

It deliberately stores OPAQUE bytes plus an OPAQUE manifest blob. It does not import chassis/snapshot — callers marshal their own manifest. This keeps the store a generic, swappable seam: the backend is selected by name through a registry, so an additional backend can be added without changing this package or its callers.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("artifact: ref not found")

ErrNotFound is returned by Get/stat when a ref is absent.

Functions

func Register

func Register(name string, c Constructor)

Register adds a backend constructor. Called from a backend package's init(); the chassis activates a backend with a blank import.

Types

type Constructor

type Constructor func(StoreConfig) (Store, error)

Constructor builds a Store from resolved config.

type Store

type Store interface {
	// Put writes data + manifest at ref atomically.
	Put(ctx context.Context, ref string, data, manifest []byte) error

	// Get returns the data and manifest blobs. ErrNotFound if absent.
	Get(ctx context.Context, ref string) (data, manifest []byte, err error)

	// Exists reports whether ref is present.
	Exists(ctx context.Context, ref string) (bool, error)

	// Name is the backend identity (for logs).
	Name() string
}

Store is the artifact backend. Refs are "/"-separated logical keys (e.g. "stacks/t_123/web/42"). Each ref holds a data blob and a manifest blob, written atomically together (a reader never sees a half-written pair). Artifacts are immutable by convention — a ref identifies content — but Put does not enforce create-if-absent: re-Putting identical content is a harmless idempotent overwrite.

func Open

func Open(name string, cfg StoreConfig) (Store, error)

Open constructs the named backend. Unknown name is a startup error listing what is available.

type StoreConfig

type StoreConfig struct {
	FileDir string
}

StoreConfig carries backend-selecting options resolved from chassis config. The file backend uses FileDir. Additional backends may extend this struct with their own fields; the existing backends and callers are unaffected by added fields.

Directories

Path Synopsis
Package filestore is the local-filesystem artifact backend: the built-in default, zero infrastructure, directly inspectable.
Package filestore is the local-filesystem artifact backend: the built-in default, zero infrastructure, directly inspectable.

Jump to

Keyboard shortcuts

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