Help us shape the future of Go! Take the 2026 Go Developer Survey

plugin_space_runtime

package
v0.57.29 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigID = ControllerID

ConfigID is the config identifier.

View Source
const ControllerID = "plugin/space/runtime"

ControllerID is the controller ID.

Variables

View Source
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) CloneVT

func (m *Config) CloneVT() *Config

func (*Config) EqualMessageVT

func (this *Config) EqualMessageVT(thatMsg any) bool

func (*Config) EqualVT

func (this *Config) EqualVT(that *Config) bool

func (*Config) EqualsConfig

func (c *Config) EqualsConfig(other config.Config) bool

EqualsConfig checks if the config is equal to another.

func (*Config) GetAppPluginIds

func (x *Config) GetAppPluginIds() []string

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type.

func (*Config) GetSpace

func (x *Config) GetSpace() *space.Config

func (*Config) MarshalJSON

func (x *Config) MarshalJSON() ([]byte, error)

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 (x *Config) MarshalProtoText() string

func (*Config) MarshalToSizedBufferVT

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SizeVT

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalJSON

func (x *Config) UnmarshalJSON(b []byte) error

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

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

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.

Jump to

Keyboard shortcuts

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