registry

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package registry holds flow and node registrations. See design docs/plans/2026-06-24-flow-engine-design.md §18.1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateRegistrationError

type DuplicateRegistrationError struct {
	GraphID flow.GraphID
	Version string
}

DuplicateRegistrationError reports an Add of a (GraphID, Version) that is already registered (§18.1). Per CLAUDE.md every package-level failure is a concrete typed error so callers can errors.As to inspect it; it names both the GraphID and the Version so an operator can identify the offending registration from a log line. A different version of the same GraphID is NOT a duplicate.

func (*DuplicateRegistrationError) Error

Error names the duplicated (GraphID, Version) registration.

type GraphManifest

type GraphManifest struct {
	GraphID  flow.GraphID
	Versions []string
}

GraphManifest is the per-GraphID advertisement of the versions this registry serves (§18.1): the data §18.3's GET /v1/graphs returns. Versions is sorted ascending for a stable, deterministic listing.

type Registry

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

Registry is the concurrency-safe, in-process resolver from (GraphID, GraphVersion) to a flow.RunnerHandle (§18.1). It is a pure lookup table: it does not execute graphs or route work. Construct one with New.

func New

func New() *Registry

New returns an empty Registry ready to Add handles to.

func (*Registry) Add

func (r *Registry) Add(h flow.RunnerHandle) error

Add registers h under its (GraphID, GraphVersion). Keying on BOTH lets multiple versions of one graph coexist, so adding a different version of an already- registered GraphID succeeds. A duplicate — the SAME (id, version) already registered — is rejected with a typed *DuplicateRegistrationError (fail loudly, not a silent overwrite). It is concurrency-safe (write lock).

func (*Registry) Keys

func (r *Registry) Keys() []flow.GraphVersionKey

Keys returns one flow.GraphVersionKey per registered (GraphID, GraphVersion), in deterministic order (sorted by GraphID bytes then version), so flow.Serve can Consume EXACTLY the keys this registry serves (§18.5/§18.6 — registration is implicit via Consume). It is concurrency-safe (read lock) and returns a freshly allocated, non-nil slice (empty when nothing is registered) so a caller cannot mutate the registry's internal state. With Resolve, this satisfies flow.Resolver structurally — no adapter needed.

func (*Registry) Manifest

func (r *Registry) Manifest() []GraphManifest

Manifest returns one GraphManifest per distinct GraphID, each with its sorted list of served versions (§18.1, §18.3). The slice order across GraphIDs is not specified (a map iteration), but each entry's Versions is sorted. It is concurrency-safe (read lock) and returns freshly allocated slices so a caller cannot mutate the registry's internal state.

func (*Registry) Resolve

func (r *Registry) Resolve(id flow.GraphID, version string) (flow.RunnerHandle, bool)

Resolve returns the handle registered under the exact (id, version) and true, or (nil, false) if none is registered. It is an EXACT match — there is no fallback to another version (that policy belongs to the ingress/dispatcher, §18.3). It is concurrency-safe (read lock).

Jump to

Keyboard shortcuts

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