Documentation
¶
Index ¶
- Constants
- Variables
- func NewFactory(b bus.Bus) controller.Factory
- type Config
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) EqualsConfig(other config.Config) bool
- func (x *Config) GetAppPluginIds() []string
- func (c *Config) GetConfigID() string
- func (x *Config) GetSpace() *space.Config
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Controller
- func (c *Controller) DemandAllPlugins() *PluginDemand
- func (c *Controller) DemandPlugins(pluginIDs []string) *PluginDemand
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) GetAccountPluginIDs() []string
- func (c *Controller) GetGeneration() (*Generation, <-chan struct{}, error)
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- func (c *Controller) IsPluginDemanded(pluginID string) bool
- func (c *Controller) NotifyProcessBindingsChanged()
- func (c *Controller) ReserveServicePrefix(prefix string) (release func(), err error)
- func (c *Controller) SetAccountPluginIDs(ids []string)
- func (c *Controller) SetBindingRegistry(registry *process_binding.BindingRegistry)
- type Generation
- type PluginDemand
Constants ¶
const ConfigID = ControllerID
ConfigID is the config identifier.
const ControllerID = "plugin/space/runtime"
ControllerID is the controller ID.
Variables ¶
var Version = controller.MustParseVersion("0.0.1")
Version is the version of this controller.
Functions ¶
func NewFactory ¶
func NewFactory(b bus.Bus) controller.Factory
NewFactory constructs the component factory.
Types ¶
type Config ¶
type Config struct {
// Space configures the plugin/space controller inside the runtime.
Space *space.Config `protobuf:"bytes,1,opt,name=space,proto3" json:"space,omitempty"`
// AppPluginIds declares plugins supplied by this application on the parent bus.
AppPluginIds []string `protobuf:"bytes,2,rep,name=app_plugin_ids,json=appPluginIds,proto3" json:"appPluginIds,omitempty"`
// contains filtered or unexported fields
}
Config configures the shared plugin runtime of one Space. Contents mounts with equal configs share one runtime.
func (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the config is equal to another.
func (*Config) GetAppPluginIds ¶
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) MarshalJSON ¶
MarshalJSON marshals the Config to JSON.
func (*Config) MarshalProtoJSON ¶
func (x *Config) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config message to JSON.
func (*Config) MarshalProtoText ¶
func (*Config) MarshalToSizedBufferVT ¶
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Config from JSON.
func (*Config) UnmarshalProtoJSON ¶
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config message from JSON.
func (*Config) UnmarshalVT ¶
type Controller ¶
type Controller struct {
*bus.BusController[*Config]
// contains filtered or unexported fields
}
Controller runs the plugin runtime of one Space on a child bus of the daemon bus. Contents mounts acquire it with an ExecController directive, so mounts with equal configs share one runtime, and it stops after the last mount releases its reference.
The generation keeps loaded only the plugins some holder demands. Host changes reconcile within the running scheduler. A composition failure is published to every mount and retried with backoff.
func StartControllerWithConfig ¶
func StartControllerWithConfig( ctx context.Context, b bus.Bus, conf *Config, ) (*Controller, directive.Reference, error)
StartControllerWithConfig acquires the shared runtime for conf on b.
Mounts with equal configs share one runtime. It returns once the controller is constructed, before its first generation starts. The runtime loads no Space plugin until a holder adds a PluginDemand, and it stops after the last returned reference is released.
func (*Controller) DemandAllPlugins ¶
func (c *Controller) DemandAllPlugins() *PluginDemand
DemandAllPlugins demands every plugin the Space lists until Release.
func (*Controller) DemandPlugins ¶
func (c *Controller) DemandPlugins(pluginIDs []string) *PluginDemand
DemandPlugins demands the listed plugins until Release.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute runs generations until the last reference releases the controller.
It never returns an error: the loader would publish it to every mount and construct a new controller, dropping the reserved prefixes.
func (*Controller) GetAccountPluginIDs ¶
func (c *Controller) GetAccountPluginIDs() []string
GetAccountPluginIDs returns the account plugin list of the runtime.
func (*Controller) GetGeneration ¶
func (c *Controller) GetGeneration() (*Generation, <-chan struct{}, error)
GetGeneration returns the running generation and a channel closed when the runtime state or a process binding of the Space changes.
The generation is nil while none runs. err is the last startup or runtime failure while the controller waits to retry; the channel still reports the retry.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
HandleDirective holds ObjectType and operation lookups for this Space's engine on the daemon bus while its plugins register. A caller outside the Space, such as a session applying an operation, then sees a Space plugin's capabilities instead of finding none while the plugin starts.
func (*Controller) IsPluginDemanded ¶
func (c *Controller) IsPluginDemanded(pluginID string) bool
IsPluginDemanded reports whether any holder demands pluginID.
func (*Controller) NotifyProcessBindingsChanged ¶
func (c *Controller) NotifyProcessBindingsChanged()
NotifyProcessBindingsChanged wakes every mount and the running plugin/space controller after a process binding of the Space changed.
func (*Controller) ReserveServicePrefix ¶
func (c *Controller) ReserveServicePrefix(prefix string) (release func(), err error)
ReserveServicePrefix reserves an attached RPC service ID prefix for every mount of the runtime.
The first binding stays authoritative: a second reservation of a bound prefix fails. Call release once when the binding ends.
func (*Controller) SetAccountPluginIDs ¶
func (c *Controller) SetAccountPluginIDs(ids []string)
SetAccountPluginIDs replaces the account plugin list, which loads alongside the plugins the Space lists, and wakes every mount and the running generation. Every holder of the runtime reports the same account's list.
func (*Controller) SetBindingRegistry ¶
func (c *Controller) SetBindingRegistry(registry *process_binding.BindingRegistry)
SetBindingRegistry connects this shared runtime to its Resource root's binding watch without retaining another runtime reference.
type Generation ¶
type Generation struct {
// contains filtered or unexported fields
}
Generation is one running instance of the Space plugin runtime: an isolated child bus with the Space plugin scheduler and plugin/space controller.
A generation ends when its composition fails or its last mount is released. The scheduler reconciles host changes within the running generation.
func (*Generation) Done ¶
func (g *Generation) Done() <-chan struct{}
Done returns a channel closed after the generation is released.
func (*Generation) GetBus ¶
func (g *Generation) GetBus() bus.Bus
GetBus returns the isolated child bus of the generation.
func (*Generation) GetScheduler ¶
func (g *Generation) GetScheduler() *plugin_host_scheduler.Controller
GetScheduler returns the Space plugin scheduler.
func (*Generation) GetSpaceController ¶
func (g *Generation) GetSpaceController() *plugin_space.Controller
GetSpaceController returns the plugin/space controller.
type PluginDemand ¶
type PluginDemand struct {
// contains filtered or unexported fields
}
PluginDemand is one holder's selection of the Space plugins the runtime keeps running. The runtime runs the union of its demands: a contents mount demands every plugin the Space lists, and a background hold demands only its confirmed plugins. Dependencies that a running plugin loads still start on demand.
func (*PluginDemand) Release ¶
func (d *PluginDemand) Release()
Release withdraws the demand. Call once.
func (*PluginDemand) SetPluginIDs ¶
func (d *PluginDemand) SetPluginIDs(pluginIDs []string)
SetPluginIDs replaces the listed plugins of a DemandPlugins demand. Plugins that stay listed keep running.