runtime

package
v1.10.0-rc4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package runtime owns the plugin-lifecycle composition root for the daemon binary. Holds the coreapi.ServiceRegistry, constructs the daemon-side adapters that satisfy plugin Deps (Streams, EventBus, Identity, Polo), and registers/starts/stops L11 services.

Lives outside pkg/daemon (L7) so daemon stays free of pkg/coreapi (L10) imports — that's T7.1 in docs/architecture/04-EXTRACTION.md. Imports both pkg/daemon and pkg/coreapi (downward edges, allowed).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsDaemonPolicyManager

func AsDaemonPolicyManager(pm coreapi.PolicyManager) daemon.PolicyManager

AsDaemonPolicyManager adapts a coreapi.PolicyManager (returned by plugins/policy.Service.Manager()) to daemon.PolicyManager. The two interfaces have identical method shapes; the adapter does the PolicyRunner element-type conversion on All() and Get().

func NewHandshakeRuntime

func NewHandshakeRuntime(d *daemon.Daemon) handshake.Runtime

NewHandshakeRuntime returns a handshake.Runtime backed by d.

func NewHandshakeServiceAdapter

func NewHandshakeServiceAdapter(svc *handshake.Service) daemon.HandshakeService

NewHandshakeServiceAdapter wraps a *handshake.Service so it satisfies daemon.HandshakeService.

func NewPolicyRuntime

func NewPolicyRuntime(d *daemon.Daemon) policy.Runtime

NewPolicyRuntime returns a policy.Runtime backed by d.

Types

type HandshakeRuntime

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

HandshakeRuntime adapts *daemon.Daemon to the handshake.Runtime interface. Lives here (L12 composition root) so plugins/handshake stays free of pkg/daemon.

func (HandshakeRuntime) DialAndSend

func (r HandshakeRuntime) DialAndSend(peerNodeID uint32, port uint16, data []byte) error

func (HandshakeRuntime) HasIdentity

func (r HandshakeRuntime) HasIdentity() bool

func (HandshakeRuntime) IdentityPath

func (r HandshakeRuntime) IdentityPath() string

func (HandshakeRuntime) IsTrusted

func (r HandshakeRuntime) IsTrusted(nodeID uint32) (string, bool)

func (HandshakeRuntime) NodeID

func (r HandshakeRuntime) NodeID() uint32

func (HandshakeRuntime) PortListener

func (r HandshakeRuntime) PortListener(port uint16) (coreapi.Listener, error)

func (HandshakeRuntime) PublicKey

func (r HandshakeRuntime) PublicKey() ed25519.PublicKey

func (HandshakeRuntime) PublishEvent

func (r HandshakeRuntime) PublishEvent(topic string, payload map[string]any)

func (HandshakeRuntime) Registry

func (HandshakeRuntime) RemoveTunnelPeer

func (r HandshakeRuntime) RemoveTunnelPeer(nodeID uint32)

func (HandshakeRuntime) Sign

func (r HandshakeRuntime) Sign(msg []byte) []byte

func (HandshakeRuntime) TrustAutoApprove

func (r HandshakeRuntime) TrustAutoApprove() bool

type PolicyRuntime

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

PolicyRuntime adapts *daemon.Daemon to the policy.Runtime interface. Lives here (L12 composition root) so plugins/policy stays free of pkg/daemon.

func (PolicyRuntime) AdminToken

func (r PolicyRuntime) AdminToken() string

func (PolicyRuntime) ListNodes

func (r PolicyRuntime) ListNodes(netID uint16, token string) (map[string]any, error)

func (PolicyRuntime) NodeID

func (r PolicyRuntime) NodeID() uint32

func (PolicyRuntime) PublishEvent

func (r PolicyRuntime) PublishEvent(topic string, payload map[string]any)

func (PolicyRuntime) RevokeTrust

func (r PolicyRuntime) RevokeTrust(nodeID uint32) error

func (PolicyRuntime) SendHandshakeRequest

func (r PolicyRuntime) SendHandshakeRequest(nodeID uint32, reason string) error

func (PolicyRuntime) SetMemberTags

func (r PolicyRuntime) SetMemberTags(netID uint16, tags []string)

func (PolicyRuntime) TrustedPeers

func (r PolicyRuntime) TrustedPeers() []policy.TrustRecord

type Runtime

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

Runtime owns the plugin-side glue for a single daemon. cmd/daemon constructs one, registers L11 services, then calls StartPlugins after Daemon.Start (so regConn etc. are wired) and StopPlugins before Daemon.Stop.

func New

func New(d *daemon.Daemon) *Runtime

New returns a Runtime bound to the given daemon. Safe to call before d.Start.

func (*Runtime) Daemon

func (r *Runtime) Daemon() *daemon.Daemon

Daemon returns the underlying daemon (test access).

func (*Runtime) Register

func (r *Runtime) Register(s coreapi.Service) error

Register adds a service to the registry. Mirrors the old daemon.RegisterPlugin. Must be called before StartPlugins.

func (*Runtime) StartPlugins

func (r *Runtime) StartPlugins(ctx context.Context) error

StartPlugins starts every registered service in Order order. Plugins receive a Deps bundle covering Streams, Identity, Events, Trust.

func (*Runtime) StopPlugins

func (r *Runtime) StopPlugins(ctx context.Context) error

StopPlugins stops every started service in reverse-registration order. Each service has its own Stop ctx (caller-supplied here).

Jump to

Keyboard shortcuts

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