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
- type Generation
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.
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 stops after the last returned reference is released.
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) 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) 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.
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.