assembly

package
v0.0.0-...-4afd048 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package assembly holds the durable representation of a registered assembly: a first-class N.O.R.E. resource that exists independently of any live Instance. Instances are reconstructed from a RegisteredAssembly on demand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstanceKeyString

func InstanceKeyString(assemblyID, version, env string) string

InstanceKeyString renders a possibly-partial key for error messages.

Types

type RegisteredAssembly

type RegisteredAssembly struct {
	Key protocol.InstanceKey `json:"key"`

	Assembly shared.Assembly `json:"assembly"`

	// ExecutionConfigurations is stored opaquely. For CLI-sourced assemblies it is
	// a []project.CapabilityRuntimeSource, which the runtime module cannot import.
	ExecutionConfigurations any `json:"execution_configurations,omitempty"`

	// BlueprintMetadata is the assembly-level metadata produced when the assembly
	// is compiled, kept so list views can surface graph metadata lazily.
	BlueprintMetadata shared.Metadata `json:"blueprint_metadata,omitempty"`

	RegisteredAt time.Time `json:"registered_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

RegisteredAssembly is the durable artifact persisted by /v1/register.

This is the source of truth for a assembly's definition. An Instance is only a transient runtime built from it, so the registered artifact is reloadable and re-instantiable after a restart.

type Repository

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

Repository persists RegisteredAssembly artifacts under assemblies/{assemblyID}/{version}/{hash}/{env}/manifest keys in the shared storage.Store, plus a per-assembly version index (versions.json) that makes (assemblyID, version) the source of truth.

Each content hash is an immutable artifact; registering the same version again REPLACES the previous artifact for that version, so a given name:version always addresses exactly one artifact — the newest one.

func NewRepository

func NewRepository(store storage.Store) *Repository

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, key protocol.InstanceKey) error

Delete removes version's artifact(s) and its version index entry, then recomputes the latest pointer. A key may be partial (assemblyID:version); when the version is empty every version of the assembly is removed.

func (*Repository) Exists

func (r *Repository) Exists(ctx context.Context, key protocol.InstanceKey) (bool, error)

func (*Repository) Get

Get resolves the durable artifact for key. See Resolve for how partial keys are normalized.

func (*Repository) List

List returns every registered artifact, one per indexing assembly/version/hash.

func (*Repository) Register

func (r *Repository) Register(ctx context.Context, reg RegisteredAssembly) (created bool, replaced bool, err error)

Register persists reg durably and makes (assemblyID, version) point at it. Registering the same version clears the previously recorded artifact(s) for that version, regardless of hash or environment, then writes the new one and sets it as the latest version. The request is idempotent when the exact same artifact is already current: created=false, replaced=false.

func (*Repository) Resolve

Resolve returns the artifact a possibly-partial key addresses. Accepted forms are assemblyID, assemblyID:latest, assemblyID:version, and assemblyID:version:hash, each optionally suffixed with :env.

  • A fully-specified hash maps directly to its immutable artifact.
  • Otherwise the version is resolved through the assembly's version index (latest resolves to the most recently registered version) and the hash and environment come from that index entry.
  • An explicitly requested environment that is no longer current falls back to scanning the version's artifacts so legacy multi-env data stays addressable.

type VersionEntry

type VersionEntry struct {
	Hash         string    `json:"hash"`
	Env          string    `json:"env"`
	RegisteredAt time.Time `json:"registered_at"`
}

VersionEntry is the per-version record a assembly's version index keeps. It points at the current artifact (hash + env) for that version and the time it was registered.

type VersionIndex

type VersionIndex struct {
	Latest   *VersionRef             `json:"latest,omitempty"`
	Versions map[string]VersionEntry `json:"versions"`
}

VersionIndex makes (assemblyID, version) the source of truth for addressing a registered artifact. Each version maps to exactly one current artifact; registering the same version again replaces the previous one. Latest points to the most recently registered version (time-based).

func (*VersionIndex) Select

func (idx *VersionIndex) Select(version string) (string, VersionEntry, error)

Select resolves a requested version to its concrete artifact. An empty or "latest" version resolves through the time-based latest pointer.

type VersionRef

type VersionRef struct {
	Version string `json:"version"`
	VersionEntry
}

VersionRef names the version a VersionEntry belongs to. It is solely used for the index's latest pointer.

Jump to

Keyboard shortcuts

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