Documentation
¶
Index ¶
- Constants
- Variables
- func NewFactory(b bus.Bus, opts ...FactoryOption) controller.Factory
- type CloudBlockStoreForwarder
- func (c *CloudBlockStoreForwarder) Close() error
- func (c *CloudBlockStoreForwarder) Execute(ctx context.Context) error
- func (c *CloudBlockStoreForwarder) GetControllerInfo() *controller.Info
- func (c *CloudBlockStoreForwarder) HandleDirective(context.Context, directive.Instance) ([]directive.Resolver, error)
- 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 (c *Config) GetConfigID() string
- func (x *Config) GetEngineId() string
- func (x *Config) GetHostPluginId() string
- func (x *Config) GetHostStorageId() string
- func (x *Config) GetObjectKeys() []string
- func (x *Config) GetObjectStoreId() string
- func (x *Config) GetPluginIds() []string
- func (x *Config) GetSessionPeerId() string
- func (x *Config) GetSpaceId() string
- func (x *Config) GetVolumeId() string
- func (x *Config) GetWorldBucketId() string
- 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) Execute(ctx context.Context) error
- func (c *Controller) GetLoadedPluginIDsAndWaitCh() ([]string, <-chan struct{})
- func (c *Controller) GetRegistrationPendingAndWaitCh() (bool, <-chan struct{})
- func (c *Controller) GetRequestedPluginIDsAndWaitCh() ([]string, <-chan struct{})
- func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- func (c *Controller) NotifyChanged()
- type FactoryOption
Constants ¶
const ConfigID = ControllerID
ConfigID is the config identifier.
const ControllerID = "plugin/space"
ControllerID is the controller ID.
Variables ¶
var ErrEmptySpaceID = errors.New("space_id must be specified")
ErrEmptySpaceID is returned when space_id is empty.
var Version = controller.MustParseVersion("0.0.1")
Version is the version of this controller.
Functions ¶
func NewFactory ¶
func NewFactory(b bus.Bus, opts ...FactoryOption) controller.Factory
NewFactory constructs the component factory.
Types ¶
type CloudBlockStoreForwarder ¶ added in v0.51.2
type CloudBlockStoreForwarder struct {
// contains filtered or unexported fields
}
CloudBlockStoreForwarder forwards the mounted Space bucket to the plugin host.
func NewCloudBlockStoreForwarder ¶ added in v0.51.2
func NewCloudBlockStoreForwarder( le *logrus.Entry, b bus.Bus, spaceID string, bucketID string, pluginID string, access world.AccessWorldStateFunc, ) *CloudBlockStoreForwarder
NewCloudBlockStoreForwarder constructs a cloud block store forwarding controller.
func (*CloudBlockStoreForwarder) Close ¶ added in v0.51.2
func (c *CloudBlockStoreForwarder) Close() error
Close releases resources used by the controller.
func (*CloudBlockStoreForwarder) Execute ¶ added in v0.51.2
func (c *CloudBlockStoreForwarder) Execute(ctx context.Context) error
Execute executes the controller goroutine.
func (*CloudBlockStoreForwarder) GetControllerInfo ¶ added in v0.51.2
func (c *CloudBlockStoreForwarder) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*CloudBlockStoreForwarder) HandleDirective ¶ added in v0.51.2
func (c *CloudBlockStoreForwarder) HandleDirective(context.Context, directive.Instance) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive.
type Config ¶
type Config struct {
// SpaceId is the Space identifier.
SpaceId string `protobuf:"bytes,1,opt,name=space_id,json=spaceId,proto3" json:"spaceId,omitempty"`
// PluginIds lists manifest IDs of plugins to load (from SpaceSettings).
PluginIds []string `protobuf:"bytes,2,rep,name=plugin_ids,json=pluginIds,proto3" json:"pluginIds,omitempty"`
// VolumeId is the volume ID for the PlatformAccount object store.
// If empty, uses the default bldr plugin volume.
VolumeId string `protobuf:"bytes,3,opt,name=volume_id,json=volumeId,proto3" json:"volumeId,omitempty"`
// ObjectStoreId is the object store ID within the volume.
// If empty, uses "platform-account".
ObjectStoreId string `protobuf:"bytes,4,opt,name=object_store_id,json=objectStoreId,proto3" json:"objectStoreId,omitempty"`
// EngineId is the Hydra engine ID for watching the Space world.
// Required for FetchManifest resolution.
EngineId string `protobuf:"bytes,5,opt,name=engine_id,json=engineId,proto3" json:"engineId,omitempty"`
// ObjectKeys is the list of object keys to collect manifests from.
// If empty, manifests are collected from every manifest store.
ObjectKeys []string `protobuf:"bytes,6,rep,name=object_keys,json=objectKeys,proto3" json:"objectKeys,omitempty"`
// SessionPeerId is the base58-encoded peer ID of the local session.
// Used by ObjectType factories that need session-scoped behavior
// (e.g., ForgeWorkerFactory checks if this session should run the worker).
SessionPeerId string `protobuf:"bytes,7,opt,name=session_peer_id,json=sessionPeerId,proto3" json:"sessionPeerId,omitempty"`
// WorldBucketId is the bucket ID backing the mounted Space world.
// If set, the controller forwards this block store to the plugin host.
WorldBucketId string `protobuf:"bytes,8,opt,name=world_bucket_id,json=worldBucketId,proto3" json:"worldBucketId,omitempty"`
// HostPluginId is the plugin ID of the host that mounts this Space.
// Required when world_bucket_id is set so the forwarded block store
// configset registers under the correct plugin service prefix.
HostPluginId string `protobuf:"bytes,9,opt,name=host_plugin_id,json=hostPluginId,proto3" json:"hostPluginId,omitempty"`
// HostStorageId selects the parent runtime Storage for every child plugin.
// Empty preserves the ordinary platform storage selection.
HostStorageId string `protobuf:"bytes,10,opt,name=host_storage_id,json=hostStorageId,proto3" json:"hostStorageId,omitempty"`
// contains filtered or unexported fields
}
Config configures the Space Plugin Controller. Loads plugins and resolves FetchManifest directives by watching the Space world.
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) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetEngineId ¶
func (*Config) GetHostPluginId ¶ added in v0.51.2
func (*Config) GetHostStorageId ¶
func (*Config) GetObjectKeys ¶
func (*Config) GetObjectStoreId ¶
func (*Config) GetPluginIds ¶
func (*Config) GetSessionPeerId ¶
func (*Config) GetSpaceId ¶
func (*Config) GetVolumeId ¶
func (*Config) GetWorldBucketId ¶ added in v0.51.2
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 loads plugins for a Space and resolves FetchManifest directives by watching the Space world.
Watches SpaceSettings in the Space world reactively. When plugin_ids or the plugin demand change, reconciles LoadPlugin directives: adds directives for newly listed and demanded plugins and releases the others.
For FetchManifest: resolves FetchManifest directives for manifest IDs matching the current SpaceSettings plugin_ids. Uses a shared world watch loop with broadcast to handle resolver set changes. With a manifest source, approved requests also resolve from the parent bus.
Also reconciles process bindings: starts enabled persistent processes, stops processes that are removed or disabled, and deletes the bindings of deleted World objects.
func StartControllerWithConfig ¶
func StartControllerWithConfig( ctx context.Context, b bus.Bus, conf *Config, rel func(), ) (*Controller, directive.Instance, directive.Reference, error)
StartControllerWithConfig starts the space plugin controller with a config. Waits for the controller to start running. Returns a Release function to close the controller when done.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute executes the controller goroutine.
func (*Controller) GetLoadedPluginIDsAndWaitCh ¶ added in v0.51.2
func (c *Controller) GetLoadedPluginIDsAndWaitCh() ([]string, <-chan struct{})
GetLoadedPluginIDsAndWaitCh returns loaded plugin IDs and a channel closed when they change.
func (*Controller) GetRegistrationPendingAndWaitCh ¶
func (c *Controller) GetRegistrationPendingAndWaitCh() (bool, <-chan struct{})
GetRegistrationPendingAndWaitCh reports whether a desired plugin is still registering its capabilities, and returns a channel closed when that changes.
func (*Controller) GetRequestedPluginIDsAndWaitCh ¶
func (c *Controller) GetRequestedPluginIDsAndWaitCh() ([]string, <-chan struct{})
GetRequestedPluginIDsAndWaitCh returns the sorted manifest IDs with a live FetchManifest in the Space, and a channel closed when the resolver set changes. A requested plugin that SpaceSettings does not list waits until it is listed.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive.
func (*Controller) NotifyChanged ¶
func (c *Controller) NotifyChanged()
NotifyChanged wakes the watch loop to reconcile external state changes, and rereads the process bindings.
type FactoryOption ¶ added in v0.57.2
type FactoryOption func(*factoryConfig)
FactoryOption configures a Space plugin controller factory.
func WithLoadTarget ¶ added in v0.57.2
func WithLoadTarget(target bus.Bus) FactoryOption
WithLoadTarget sends approved Space plugin load directives to target.
func WithManifestSource ¶ added in v0.57.2
func WithManifestSource(source bus.Bus) FactoryOption
WithManifestSource permits approved Space plugins to fetch manifests from source in addition to the Space World.
func WithPluginDemand ¶
func WithPluginDemand(demanded func(pluginID string) bool) FactoryOption
WithPluginDemand keeps loaded only the listed plugins for which demanded returns true. Without it, every listed plugin stays loaded. Call NotifyChanged after the demand changes.
func WithProcessBindingsChanged ¶
func WithProcessBindingsChanged(notify func()) FactoryOption
WithProcessBindingsChanged calls notify after the controller deletes the process binding of a deleted World object, so binding views can refresh.