registry

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddResolver added in v0.11.0

func AddResolver(key string, res command.Resolver) error

func GetCLIOptions

func GetCLIOptions() ([]kong.Option, error)

func HasResolver added in v0.11.0

func HasResolver(key string) bool

func RegisterCommand

func RegisterCommand[T any](cmd command.Commander[T], runnerOpts ...runner.Option) (dispatcher.Subscription, error)

func RegisterQuery

func RegisterQuery[T any, R any](qry command.Querier[T, R], runnerOpts ...runner.Option) (dispatcher.Subscription, error)

func SetCronRegister

func SetCronRegister(fn func(opts command.HandlerConfig, handler any) error)

func SetRPCRegister added in v0.15.0

func SetRPCRegister(fn func(opts command.RPCConfig, handler any, meta command.CommandMeta) error)

func Start

func Start(_ context.Context) error

func Stop

func Stop(_ context.Context) error

func WithTestRegistry

func WithTestRegistry(fn func())

Types

type CronScheduler added in v0.15.0

type CronScheduler interface {
	AddHandler(opts command.HandlerConfig, handler any) (cron.Subscription, error)
}

CronScheduler is the minimum cron dependency needed for runtime composition.

type RuntimeContainer added in v0.15.0

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

RuntimeContainer is an instance-first registry composition container.

func NewRuntimeContainer added in v0.15.0

func NewRuntimeContainer(deps RuntimeDependencies) *RuntimeContainer

NewRuntimeContainer builds a runtime with explicit dependencies.

func (*RuntimeContainer) AddResolver added in v0.15.0

func (r *RuntimeContainer) AddResolver(key string, res command.Resolver) error

AddResolver adds a resolver to the backing registry.

func (*RuntimeContainer) Dependencies added in v0.15.0

func (r *RuntimeContainer) Dependencies() RuntimeDependencies

Dependencies returns a copy of runtime dependencies.

func (*RuntimeContainer) HasResolver added in v0.15.0

func (r *RuntimeContainer) HasResolver(key string) bool

HasResolver reports resolver registration state.

func (*RuntimeContainer) RegisterCommand added in v0.15.0

func (r *RuntimeContainer) RegisterCommand(cmd any) error

RegisterCommand registers command in injected dispatcher hooks (optional) and registry.

func (*RuntimeContainer) RegisterQuery added in v0.15.0

func (r *RuntimeContainer) RegisterQuery(qry any) error

RegisterQuery registers query in injected dispatcher hooks (optional) and registry.

func (*RuntimeContainer) Registry added in v0.15.0

func (r *RuntimeContainer) Registry() *command.Registry

Registry returns the backing command registry instance.

func (*RuntimeContainer) Start added in v0.15.0

func (r *RuntimeContainer) Start(_ context.Context) error

Start initializes the backing registry.

func (*RuntimeContainer) Stop added in v0.15.0

Stop unsubscribes runtime subscriptions and clears local state.

type RuntimeDependencies added in v0.15.0

type RuntimeDependencies struct {
	Registry *command.Registry

	Dispatcher   any
	Router       *router.Mux
	Scheduler    CronScheduler
	Orchestrator any

	RunnerDefaults []runner.Option

	CronRegister func(opts command.HandlerConfig, handler any) error
	RPCRegister  func(opts command.RPCConfig, handler any, meta command.CommandMeta) error

	SubscribeCommand func(cmd any, opts ...runner.Option) (dispatcher.Subscription, error)
	SubscribeQuery   func(qry any, opts ...runner.Option) (dispatcher.Subscription, error)
}

RuntimeDependencies captures explicit runtime wiring dependencies.

Jump to

Keyboard shortcuts

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