Documentation
¶
Index ¶
- Constants
- Variables
- 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) 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) 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) 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)
- 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() semver.Version
- 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 = semver.MustParse("0.0.1")
Version is the version of the controller implementation.
Functions ¶
This section is empty.
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"`
// 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) 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) 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 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) 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
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 ¶
GetVersion returns the version of this controller.
type PluginStatusSnapshot ¶ added in v0.51.0
type PluginStatusSnapshot struct {
Plugins []*bldr_plugin.PluginStatus
}
PluginStatusSnapshot describes the scheduler's current plugin instances.