Documentation
¶
Index ¶
- Constants
- Variables
- func IsPluginRunningOnBus(ctx context.Context, b bus.Bus, pluginID string) bool
- type Config
- func (c *Config) BuildExecBackoff() *backoff.Backoff
- func (c *Config) BuildFetchBackoff() *backoff.Backoff
- 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) FilterPluginPlatformIDs(pluginID string, platformIDs []string) []string
- func (c *Config) GetConfigID() string
- func (x *Config) GetDisableCopyManifest() bool
- func (x *Config) GetDisableStoreManifest() bool
- func (x *Config) GetEngineId() string
- func (x *Config) GetExecBackoff() *backoff.Backoff
- func (x *Config) GetFetchBackoff() *backoff.Backoff
- func (x *Config) GetFetchConcurrency() uint32
- func (x *Config) GetObjectKey() string
- func (x *Config) GetPeerId() string
- func (x *Config) GetPlatformSelectionPolicies() []*PlatformSelectionPolicy
- func (x *Config) GetVerbose() bool
- func (x *Config) GetVolumeId() string
- func (x *Config) GetWatchFetchManifest() bool
- 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 (c *Config) ParsePeerID() (peer.ID, 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) AddPluginReference(pluginID, instanceKey string) (bldr_plugin.RunningPluginRef, func())
- func (c *Controller) Close() error
- func (c *Controller) Execute(rctx context.Context) (rerr error)
- func (c *Controller) GetControllerInfo() *controller.Info
- func (c *Controller) GetPluginStatusCtr() ccontainer.Watchable[*PluginStatusSnapshot]
- func (c *Controller) HandleDirective(ctx context.Context, inst directive.Instance) ([]directive.Resolver, error)
- func (c *Controller) IsPluginRunning(pluginID string) bool
- func (c *Controller) WaitPluginClient(ctx context.Context, released func(), pluginID string) (srpc.Client, func(), error)
- func (c *Controller) WaitPluginHostClient(ctx context.Context, released func()) (srpc.Client, func(), error)
- func (c *Controller) WaitPluginsRunning(ctx context.Context, pluginIDs []string) error
- type Factory
- func (t *Factory) Construct(ctx context.Context, conf config.Config, opts controller.ConstructOpts) (controller.Controller, error)
- func (t *Factory) ConstructConfig() config.Config
- func (t *Factory) GetConfigID() string
- func (t *Factory) GetControllerID() string
- func (t *Factory) GetVersion() controller.Version
- type PlatformSelectionPolicy
- func (m *PlatformSelectionPolicy) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *PlatformSelectionPolicy) CloneVT() *PlatformSelectionPolicy
- func (this *PlatformSelectionPolicy) EqualMessageVT(thatMsg any) bool
- func (this *PlatformSelectionPolicy) EqualVT(that *PlatformSelectionPolicy) bool
- func (x *PlatformSelectionPolicy) GetAllowedPluginIds() []string
- func (x *PlatformSelectionPolicy) GetPlatformId() string
- func (x *PlatformSelectionPolicy) MarshalJSON() ([]byte, error)
- func (x *PlatformSelectionPolicy) MarshalProtoJSON(s *json.MarshalState)
- func (x *PlatformSelectionPolicy) MarshalProtoText() string
- func (m *PlatformSelectionPolicy) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *PlatformSelectionPolicy) MarshalToVT(dAtA []byte) (int, error)
- func (m *PlatformSelectionPolicy) MarshalVT() (dAtA []byte, err error)
- func (*PlatformSelectionPolicy) ProtoMessage()
- func (x *PlatformSelectionPolicy) Reset()
- func (m *PlatformSelectionPolicy) SizeVT() (n int)
- func (x *PlatformSelectionPolicy) String() string
- func (x *PlatformSelectionPolicy) UnmarshalJSON(b []byte) error
- func (x *PlatformSelectionPolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *PlatformSelectionPolicy) UnmarshalVT(dAtA []byte) error
- type PluginManifestRecoveryStatus
- type PluginStatusSnapshot
Constants ¶
const ConfigID = ControllerID
ConfigID is the config identifier.
const ControllerID = "bldr/plugin/host/scheduler"
ControllerID is the controller identifier.
Variables ¶
var Version = controller.MustParseVersion("0.0.1")
Version is the version of the controller implementation.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// EngineId is the world engine id to attach to.
EngineId string `protobuf:"bytes,1,opt,name=engine_id,json=engineId,proto3" json:"engineId,omitempty"`
// ObjectKey is the root object to attach to.
// If not exists, waits for it to exist.
//
// Searches for <manifest> links from this object.
ObjectKey string `protobuf:"bytes,2,opt,name=object_key,json=objectKey,proto3" json:"objectKey,omitempty"`
// PeerId is the peer ID to use for world transactions.
PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
// VolumeId is the identifier of the volume on the plugin host bus.
// This volume is available for the plugin to use via the volume proxy.
VolumeId string `protobuf:"bytes,4,opt,name=volume_id,json=volumeId,proto3" json:"volumeId,omitempty"`
// WatchFetchManifest will watch the FetchManifest directive while a plugin is running.
WatchFetchManifest bool `protobuf:"varint,5,opt,name=watch_fetch_manifest,json=watchFetchManifest,proto3" json:"watchFetchManifest,omitempty"`
// DisableStoreManifest disables storing manifests fetched with FetchManifest.
// This is used if we are watching the same world as the FetchManifest resolver.
DisableStoreManifest bool `protobuf:"varint,6,opt,name=disable_store_manifest,json=disableStoreManifest,proto3" json:"disableStoreManifest,omitempty"`
// DisableCopyManifest disables copying manifests to the plugin host world bucket.
// This is used if the manifest bucket is always accessible and locally cached.
// If unset, we will copy manifests to the same bucket as the plugin host world.
DisableCopyManifest bool `protobuf:"varint,10,opt,name=disable_copy_manifest,json=disableCopyManifest,proto3" json:"disableCopyManifest,omitempty"`
// FetchConcurrency limits the number of blocks fetched concurrently per-manifest.
// If zero, uses no limit to the number of concurrent fetches.
//
// Note: the concurrency is limited by the number of blocks that we have seen
// so far. Fetches blocks, then the references those blocks reference. We only
// know about the blocks on the frontier of the blocks fetched so far.
FetchConcurrency uint32 `protobuf:"varint,7,opt,name=fetch_concurrency,json=fetchConcurrency,proto3" json:"fetchConcurrency,omitempty"`
// FetchBackoff is the backoff config for fetching plugin manifests.
// If unset, defaults to reasonable defaults.
FetchBackoff *backoff.Backoff `protobuf:"bytes,8,opt,name=fetch_backoff,json=fetchBackoff,proto3" json:"fetchBackoff,omitempty"`
// ExecBackoff is the backoff config for executing plugin manifests.
// If unset, defaults to reasonable defaults.
ExecBackoff *backoff.Backoff `protobuf:"bytes,9,opt,name=exec_backoff,json=execBackoff,proto3" json:"execBackoff,omitempty"`
// Verbose enables verbose logging for world ops (slower).
Verbose bool `protobuf:"varint,11,opt,name=verbose,proto3" json:"verbose,omitempty"`
// PlatformSelectionPolicies restrict selected platform IDs to selected
// plugin IDs. If empty, every discovered plugin host platform is selectable
// for every plugin.
PlatformSelectionPolicies []*PlatformSelectionPolicy `` /* 137-byte string literal not displayed */
// contains filtered or unexported fields
}
Config is the plugin host scheduler controller configuration.
Manages available plugin hosts and running plugins. Manages downloading the most appropriate manifest for the available plugin hosts. Manages executing plugins via the plugin hosts.
func NewConfig ¶
func NewConfig( engineID, objectKey, volumeID, peerID string, watchFetchManifest, disableStoreManifest, disableCopyManifest bool, ) *Config
NewConfig constructs a new controller config. Sets the most important fields only.
func (*Config) BuildExecBackoff ¶
BuildExecBackoff gets the ExecBackoff and fills defaults if applicable.
func (*Config) BuildFetchBackoff ¶
BuildFetchBackoff gets the FetchBackoff and fills defaults if applicable.
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) FilterPluginPlatformIDs ¶ added in v0.51.7
FilterPluginPlatformIDs filters platform IDs through PlatformSelectionPolicies.
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetDisableCopyManifest ¶
func (*Config) GetDisableStoreManifest ¶
func (*Config) GetEngineId ¶
func (*Config) GetExecBackoff ¶
func (*Config) GetFetchBackoff ¶
func (*Config) GetFetchConcurrency ¶
func (*Config) GetObjectKey ¶
func (*Config) GetPlatformSelectionPolicies ¶ added in v0.51.7
func (x *Config) GetPlatformSelectionPolicies() []*PlatformSelectionPolicy
func (*Config) GetVerbose ¶
func (*Config) GetVolumeId ¶
func (*Config) GetWatchFetchManifest ¶
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) ParsePeerID ¶
ParsePeerID parses the peer ID field.
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 {
// contains filtered or unexported fields
}
Controller implements the plugin host scheduler controller.
Manages available plugin hosts and running plugins. Manages downloading the most appropriate manifest for the available plugin hosts. Manages executing plugins via the plugin hosts.
Only one of these controllers should be running.
func FindControllerOnBus ¶ added in v0.51.7
func FindControllerOnBus(b bus.Bus) *Controller
FindControllerOnBus returns the first plugin host scheduler on b.
func NewController ¶
NewController constructs a new controller.
func (*Controller) AddPluginReference ¶
func (c *Controller) AddPluginReference(pluginID, instanceKey string) (bldr_plugin.RunningPluginRef, func())
AddPluginReference adds a reference to the plugin, returning the RunningPlugin handle and a release function. instanceKey may be empty for shared (non-instanced) plugins.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*Controller) Execute ¶
func (c *Controller) Execute(rctx context.Context) (rerr error)
Execute executes the controller. Returning nil ends execution. Returning an error triggers a retry with backoff.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) GetPluginStatusCtr ¶ added in v0.51.0
func (c *Controller) GetPluginStatusCtr() ccontainer.Watchable[*PluginStatusSnapshot]
GetPluginStatusCtr returns the scheduler's live plugin-status snapshot.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective( ctx context.Context, inst directive.Instance, ) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil. Any unexpected errors are returned for logging. It is safe to add a reference to the directive during this call. The context tasked is canceled when the directive instance expires.
func (*Controller) IsPluginRunning ¶ added in v0.51.5
func (c *Controller) IsPluginRunning(pluginID string) bool
IsPluginRunning reports whether any instance for pluginID is running.
func (*Controller) WaitPluginClient ¶
func (c *Controller) WaitPluginClient(ctx context.Context, released func(), pluginID string) (srpc.Client, func(), error)
WaitPluginClient waits for an RPC client for a plugin.
if pluginID is invalid, returns an error.
Released is a function to call if the client becomes invalid. Returns nil, nil, err if any error. Returns nil, nil, nil to skip resolving the client. Otherwise returns client, releaseFunc, nil
func (*Controller) WaitPluginHostClient ¶
func (c *Controller) WaitPluginHostClient(ctx context.Context, released func()) (srpc.Client, func(), error)
WaitPluginHostClient waits for an RPC client for the plugin host.
Released is a function to call if the client becomes invalid. Returns nil, nil, err if any error. Returns nil, nil, nil to skip resolving the client. Otherwise returns client, releaseFunc, nil
func (*Controller) WaitPluginsRunning ¶ added in v0.51.7
func (c *Controller) WaitPluginsRunning(ctx context.Context, pluginIDs []string) error
WaitPluginsRunning waits until all shared instances in pluginIDs report running, or returns the first scheduler error recorded for one of them.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory constructs the controller factory
func (*Factory) Construct ¶
func (t *Factory) Construct( ctx context.Context, conf config.Config, opts controller.ConstructOpts, ) (controller.Controller, error)
Construct constructs the associated controller given configuration.
func (*Factory) ConstructConfig ¶
ConstructConfig constructs an instance of the controller configuration.
func (*Factory) GetConfigID ¶
GetConfigID returns the configuration ID for the controller.
func (*Factory) GetControllerID ¶
GetControllerID returns the unique ID for the controller.
func (*Factory) GetVersion ¶
func (t *Factory) GetVersion() controller.Version
GetVersion returns the version of this controller.
type PlatformSelectionPolicy ¶ added in v0.51.7
type PlatformSelectionPolicy struct {
// PlatformId is the plugin host platform ID to restrict, such as
// "web/js/wasm".
PlatformId string `protobuf:"bytes,1,opt,name=platform_id,json=platformId,proto3" json:"platformId,omitempty"`
// AllowedPluginIds are the plugin IDs that may select PlatformId.
AllowedPluginIds []string `protobuf:"bytes,2,rep,name=allowed_plugin_ids,json=allowedPluginIds,proto3" json:"allowedPluginIds,omitempty"`
// contains filtered or unexported fields
}
PlatformSelectionPolicy restricts a plugin host platform to a plugin ID list.
func (*PlatformSelectionPolicy) CloneMessageVT ¶ added in v0.51.7
func (m *PlatformSelectionPolicy) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*PlatformSelectionPolicy) CloneVT ¶ added in v0.51.7
func (m *PlatformSelectionPolicy) CloneVT() *PlatformSelectionPolicy
func (*PlatformSelectionPolicy) EqualMessageVT ¶ added in v0.51.7
func (this *PlatformSelectionPolicy) EqualMessageVT(thatMsg any) bool
func (*PlatformSelectionPolicy) EqualVT ¶ added in v0.51.7
func (this *PlatformSelectionPolicy) EqualVT(that *PlatformSelectionPolicy) bool
func (*PlatformSelectionPolicy) GetAllowedPluginIds ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) GetAllowedPluginIds() []string
func (*PlatformSelectionPolicy) GetPlatformId ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) GetPlatformId() string
func (*PlatformSelectionPolicy) MarshalJSON ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) MarshalJSON() ([]byte, error)
MarshalJSON marshals the PlatformSelectionPolicy to JSON.
func (*PlatformSelectionPolicy) MarshalProtoJSON ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the PlatformSelectionPolicy message to JSON.
func (*PlatformSelectionPolicy) MarshalProtoText ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) MarshalProtoText() string
func (*PlatformSelectionPolicy) MarshalToSizedBufferVT ¶ added in v0.51.7
func (m *PlatformSelectionPolicy) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*PlatformSelectionPolicy) MarshalToVT ¶ added in v0.51.7
func (m *PlatformSelectionPolicy) MarshalToVT(dAtA []byte) (int, error)
func (*PlatformSelectionPolicy) MarshalVT ¶ added in v0.51.7
func (m *PlatformSelectionPolicy) MarshalVT() (dAtA []byte, err error)
func (*PlatformSelectionPolicy) ProtoMessage ¶ added in v0.51.7
func (*PlatformSelectionPolicy) ProtoMessage()
func (*PlatformSelectionPolicy) Reset ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) Reset()
func (*PlatformSelectionPolicy) SizeVT ¶ added in v0.51.7
func (m *PlatformSelectionPolicy) SizeVT() (n int)
func (*PlatformSelectionPolicy) String ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) String() string
func (*PlatformSelectionPolicy) UnmarshalJSON ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the PlatformSelectionPolicy from JSON.
func (*PlatformSelectionPolicy) UnmarshalProtoJSON ¶ added in v0.51.7
func (x *PlatformSelectionPolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the PlatformSelectionPolicy message from JSON.
func (*PlatformSelectionPolicy) UnmarshalVT ¶ added in v0.51.7
func (m *PlatformSelectionPolicy) UnmarshalVT(dAtA []byte) error
type PluginManifestRecoveryStatus ¶ added in v0.51.8
type PluginManifestRecoveryStatus struct {
PluginID string
InstanceKey string
ExecuteManifestRef string
DownloadManifestRef string
SkippedCandidateCount int
SkippedCandidateSummary string
IgnoredCandidateCount int
IgnoredCandidateSummary string
QuarantinedCandidateCount int
QuarantinedCandidateSummary string
}
PluginManifestRecoveryStatus describes the scheduler-owned retained Manifest selection and eligibility facts for one plugin instance.
type PluginStatusSnapshot ¶ added in v0.51.0
type PluginStatusSnapshot struct {
Plugins []*bldr_plugin.PluginStatus
ManifestRecovery []*PluginManifestRecoveryStatus
}
PluginStatusSnapshot describes the scheduler's current plugin instances.