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

plugin_host_export

package
v0.57.28 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ConfigID = ControllerID

ConfigID is the config identifier.

View Source
const ControllerID = "bldr/plugin/host/export"

ControllerID is the host export proxy controller ID.

View Source
const SRPCExecutionServiceID = "plugin.host.export.Execution"
View Source
const SRPCHostExportServiceID = "plugin.host.export.HostExport"

Variables

View Source
var Version = controller.MustParseVersion("0.0.1")

Version is the version of this controller.

Functions

func NewSRPCExecutionHandler

func NewSRPCExecutionHandler(impl SRPCExecutionServer, serviceID string) srpc.Handler

NewSRPCExecutionHandler constructs a new RPC handler. serviceID: if empty, uses default: plugin.host.export.Execution

func NewSRPCHostExportHandler

func NewSRPCHostExportHandler(impl SRPCHostExportServer, serviceID string) srpc.Handler

NewSRPCHostExportHandler constructs a new RPC handler. serviceID: if empty, uses default: plugin.host.export.HostExport

func SRPCRegisterExecution

func SRPCRegisterExecution(mux srpc.Mux, impl SRPCExecutionServer) error

SRPCRegisterExecution registers the implementation with the mux. Uses the default serviceID: plugin.host.export.Execution

func SRPCRegisterHostExport

func SRPCRegisterHostExport(mux srpc.Mux, impl SRPCHostExportServer) error

SRPCRegisterHostExport registers the implementation with the mux. Uses the default serviceID: plugin.host.export.HostExport

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config configures the controller that resolves the host's exported plugin hosts on a plugin's bus.

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) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type. This string is stored with the encoded 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 {
	// contains filtered or unexported fields
}

Controller resolves LookupPluginHost and LookupRoot on a plugin's bus with proxies for the plugin hosts its host exports.

func NewController

func NewController(le *logrus.Entry, b bus.Bus) *Controller

NewController constructs the controller on the plugin bus b.

func (*Controller) Close

func (c *Controller) Close() error

Close releases any resources used by the controller.

func (*Controller) Execute

func (c *Controller) Execute(ctx context.Context) error

Execute follows the exported hosts. Proxies stay stable across reports so the scheduler keeps its running plugins on retained platforms.

func (*Controller) GetControllerInfo

func (c *Controller) GetControllerInfo() *controller.Info

GetControllerInfo returns information about the controller.

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.

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory constructs the host export proxy controller.

func NewFactory

func NewFactory(bus bus.Bus) *Factory

NewFactory builds the 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

func (t *Factory) ConstructConfig() config.Config

ConstructConfig constructs an instance of the controller configuration.

func (*Factory) GetConfigID

func (t *Factory) GetConfigID() string

GetConfigID returns the configuration ID for the controller.

func (*Factory) GetControllerID

func (t *Factory) GetControllerID() string

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 HostSource

type HostSource interface {
	// GetHostState returns the current hosts, a wait for them to change, and
	// the host lookup failure.
	GetHostState() ([]plugin_host.PluginHost, func(context.Context) error, error)
}

HostSource reports the plugin hosts a Server exports.

type SRPCExecutionClient

type SRPCExecutionClient interface {
	// SRPCClient returns the underlying SRPC client.
	SRPCClient() srpc.Client

	// Start executes the plugin and reports its RPC readiness until it exits.
	Start(ctx context.Context, in *StartRequest) (SRPCExecution_StartClient, error)
}

func NewSRPCExecutionClient

func NewSRPCExecutionClient(cc srpc.Client) SRPCExecutionClient

func NewSRPCExecutionClientWithServiceID

func NewSRPCExecutionClientWithServiceID(cc srpc.Client, serviceID string) SRPCExecutionClient

type SRPCExecutionHandler

type SRPCExecutionHandler struct {
	// contains filtered or unexported fields
}

func (SRPCExecutionHandler) GetMethodIDs

func (SRPCExecutionHandler) GetMethodIDs() []string

func (*SRPCExecutionHandler) GetServiceID

func (d *SRPCExecutionHandler) GetServiceID() string

func (*SRPCExecutionHandler) InvokeMethod

func (d *SRPCExecutionHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

func (SRPCExecutionHandler) InvokeMethod_Start

func (SRPCExecutionHandler) InvokeMethod_Start(impl SRPCExecutionServer, strm srpc.Stream) error

type SRPCExecutionServer

type SRPCExecutionServer interface {
	// Start executes the plugin and reports its RPC readiness until it exits.
	Start(*StartRequest, SRPCExecution_StartStream) error
}

type SRPCExecution_StartClient

type SRPCExecution_StartClient interface {
	srpc.Stream
	Recv() (*StartResponse, error)
	RecvTo(*StartResponse) error
}

type SRPCExecution_StartStream

type SRPCExecution_StartStream interface {
	srpc.Stream
	Send(*StartResponse) error
	SendAndClose(*StartResponse) error
}

type SRPCHostExportClient

type SRPCHostExportClient interface {
	// SRPCClient returns the underlying SRPC client.
	SRPCClient() srpc.Client

	// WatchHosts streams the platform IDs of the host's plugin hosts.
	WatchHosts(ctx context.Context, in *WatchHostsRequest) (SRPCHostExport_WatchHostsClient, error)
	// ExecutePlugin carries one execution session as a multiplexed connection.
	// The caller serves the plugin's host mux, including its dist and assets
	// file services. The host serves Execution and forwards every other call to
	// the running plugin.
	ExecutePlugin(ctx context.Context) (SRPCHostExport_ExecutePluginClient, error)
}

func NewSRPCHostExportClient

func NewSRPCHostExportClient(cc srpc.Client) SRPCHostExportClient

func NewSRPCHostExportClientWithServiceID

func NewSRPCHostExportClientWithServiceID(cc srpc.Client, serviceID string) SRPCHostExportClient

type SRPCHostExportHandler

type SRPCHostExportHandler struct {
	// contains filtered or unexported fields
}

func (SRPCHostExportHandler) GetMethodIDs

func (SRPCHostExportHandler) GetMethodIDs() []string

func (*SRPCHostExportHandler) GetServiceID

func (d *SRPCHostExportHandler) GetServiceID() string

func (*SRPCHostExportHandler) InvokeMethod

func (d *SRPCHostExportHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

func (SRPCHostExportHandler) InvokeMethod_ExecutePlugin

func (SRPCHostExportHandler) InvokeMethod_ExecutePlugin(impl SRPCHostExportServer, strm srpc.Stream) error

func (SRPCHostExportHandler) InvokeMethod_WatchHosts

func (SRPCHostExportHandler) InvokeMethod_WatchHosts(impl SRPCHostExportServer, strm srpc.Stream) error

type SRPCHostExportServer

type SRPCHostExportServer interface {
	// WatchHosts streams the platform IDs of the host's plugin hosts.
	WatchHosts(*WatchHostsRequest, SRPCHostExport_WatchHostsStream) error
	// ExecutePlugin carries one execution session as a multiplexed connection.
	// The caller serves the plugin's host mux, including its dist and assets
	// file services. The host serves Execution and forwards every other call to
	// the running plugin.
	ExecutePlugin(SRPCHostExport_ExecutePluginStream) error
}

type SRPCHostExport_ExecutePluginClient

type SRPCHostExport_ExecutePluginClient interface {
	srpc.Stream
	Send(*rpcstream.RpcStreamPacket) error
	Recv() (*rpcstream.RpcStreamPacket, error)
	RecvTo(*rpcstream.RpcStreamPacket) error
}

type SRPCHostExport_ExecutePluginStream

type SRPCHostExport_ExecutePluginStream interface {
	srpc.Stream
	Send(*rpcstream.RpcStreamPacket) error
	SendAndClose(*rpcstream.RpcStreamPacket) error
	Recv() (*rpcstream.RpcStreamPacket, error)
	RecvTo(*rpcstream.RpcStreamPacket) error
}

type SRPCHostExport_WatchHostsClient

type SRPCHostExport_WatchHostsClient interface {
	srpc.Stream
	Recv() (*WatchHostsResponse, error)
	RecvTo(*WatchHostsResponse) error
}

type SRPCHostExport_WatchHostsStream

type SRPCHostExport_WatchHostsStream interface {
	srpc.Stream
	Send(*WatchHostsResponse) error
	SendAndClose(*WatchHostsResponse) error
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server exports a HostSource's plugin hosts to one plugin.

func NewServer

func NewServer(le *logrus.Entry, b bus.Bus, hosts HostSource) *Server

NewServer constructs a Server. Executions publish their plugin files on b, where the hosts' runtimes look them up.

func (*Server) ExecutePlugin

func (s *Server) ExecutePlugin(strm SRPCHostExport_ExecutePluginStream) error

ExecutePlugin serves one execution session until the caller closes it.

func (*Server) WatchHosts

WatchHosts streams the platform IDs of the exported hosts.

type StartRequest

type StartRequest struct {

	// PlatformId selects the plugin host.
	PlatformId string `protobuf:"bytes,1,opt,name=platform_id,json=platformId,proto3" json:"platformId,omitempty"`
	// PluginId is the plugin to execute.
	PluginId string `protobuf:"bytes,2,opt,name=plugin_id,json=pluginId,proto3" json:"pluginId,omitempty"`
	// InstanceKey is the logical instance key passed to the plugin.
	InstanceKey string `protobuf:"bytes,3,opt,name=instance_key,json=instanceKey,proto3" json:"instanceKey,omitempty"`
	// ExecutionKey distinguishes concurrent executions of one instance.
	ExecutionKey string `protobuf:"bytes,4,opt,name=execution_key,json=executionKey,proto3" json:"executionKey,omitempty"`
	// ManifestRoot identifies the exact files used by this execution.
	ManifestRoot string `protobuf:"bytes,5,opt,name=manifest_root,json=manifestRoot,proto3" json:"manifestRoot,omitempty"`
	// Entrypoint is the entrypoint path within the dist files.
	Entrypoint string `protobuf:"bytes,6,opt,name=entrypoint,proto3" json:"entrypoint,omitempty"`
	// contains filtered or unexported fields
}

StartRequest carries the PluginHost.ExecutePlugin arguments.

func (*StartRequest) CloneMessageVT

func (m *StartRequest) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*StartRequest) CloneVT

func (m *StartRequest) CloneVT() *StartRequest

func (*StartRequest) EqualMessageVT

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

func (*StartRequest) EqualVT

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

func (*StartRequest) GetEntrypoint

func (x *StartRequest) GetEntrypoint() string

func (*StartRequest) GetExecutionKey

func (x *StartRequest) GetExecutionKey() string

func (*StartRequest) GetInstanceKey

func (x *StartRequest) GetInstanceKey() string

func (*StartRequest) GetManifestRoot

func (x *StartRequest) GetManifestRoot() string

func (*StartRequest) GetPlatformId

func (x *StartRequest) GetPlatformId() string

func (*StartRequest) GetPluginId

func (x *StartRequest) GetPluginId() string

func (*StartRequest) MarshalJSON

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

MarshalJSON marshals the StartRequest to JSON.

func (*StartRequest) MarshalProtoJSON

func (x *StartRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the StartRequest message to JSON.

func (*StartRequest) MarshalProtoText

func (x *StartRequest) MarshalProtoText() string

func (*StartRequest) MarshalToSizedBufferVT

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

func (*StartRequest) MarshalToVT

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

func (*StartRequest) MarshalVT

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

func (*StartRequest) ProtoMessage

func (*StartRequest) ProtoMessage()

func (*StartRequest) Reset

func (x *StartRequest) Reset()

func (*StartRequest) SizeVT

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

func (*StartRequest) String

func (x *StartRequest) String() string

func (*StartRequest) UnmarshalJSON

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

UnmarshalJSON unmarshals the StartRequest from JSON.

func (*StartRequest) UnmarshalProtoJSON

func (x *StartRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the StartRequest message from JSON.

func (*StartRequest) UnmarshalVT

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

type StartResponse

type StartResponse struct {

	// RpcReady is set while the running plugin accepts calls on the session.
	RpcReady bool `protobuf:"varint,1,opt,name=rpc_ready,json=rpcReady,proto3" json:"rpcReady,omitempty"`
	// contains filtered or unexported fields
}

StartResponse reports a change in the running plugin's RPC readiness.

func (*StartResponse) CloneMessageVT

func (m *StartResponse) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*StartResponse) CloneVT

func (m *StartResponse) CloneVT() *StartResponse

func (*StartResponse) EqualMessageVT

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

func (*StartResponse) EqualVT

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

func (*StartResponse) GetRpcReady

func (x *StartResponse) GetRpcReady() bool

func (*StartResponse) MarshalJSON

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

MarshalJSON marshals the StartResponse to JSON.

func (*StartResponse) MarshalProtoJSON

func (x *StartResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the StartResponse message to JSON.

func (*StartResponse) MarshalProtoText

func (x *StartResponse) MarshalProtoText() string

func (*StartResponse) MarshalToSizedBufferVT

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

func (*StartResponse) MarshalToVT

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

func (*StartResponse) MarshalVT

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

func (*StartResponse) ProtoMessage

func (*StartResponse) ProtoMessage()

func (*StartResponse) Reset

func (x *StartResponse) Reset()

func (*StartResponse) SizeVT

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

func (*StartResponse) String

func (x *StartResponse) String() string

func (*StartResponse) UnmarshalJSON

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

UnmarshalJSON unmarshals the StartResponse from JSON.

func (*StartResponse) UnmarshalProtoJSON

func (x *StartResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the StartResponse message from JSON.

func (*StartResponse) UnmarshalVT

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

type WatchHostsRequest

type WatchHostsRequest struct {
	// contains filtered or unexported fields
}

WatchHostsRequest is the request for WatchHosts.

func (*WatchHostsRequest) CloneMessageVT

func (m *WatchHostsRequest) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*WatchHostsRequest) CloneVT

func (m *WatchHostsRequest) CloneVT() *WatchHostsRequest

func (*WatchHostsRequest) EqualMessageVT

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

func (*WatchHostsRequest) EqualVT

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

func (*WatchHostsRequest) MarshalJSON

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

MarshalJSON marshals the WatchHostsRequest to JSON.

func (*WatchHostsRequest) MarshalProtoJSON

func (x *WatchHostsRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the WatchHostsRequest message to JSON.

func (*WatchHostsRequest) MarshalProtoText

func (x *WatchHostsRequest) MarshalProtoText() string

func (*WatchHostsRequest) MarshalToSizedBufferVT

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

func (*WatchHostsRequest) MarshalToVT

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

func (*WatchHostsRequest) MarshalVT

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

func (*WatchHostsRequest) ProtoMessage

func (*WatchHostsRequest) ProtoMessage()

func (*WatchHostsRequest) Reset

func (x *WatchHostsRequest) Reset()

func (*WatchHostsRequest) SizeVT

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

func (*WatchHostsRequest) String

func (x *WatchHostsRequest) String() string

func (*WatchHostsRequest) UnmarshalJSON

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

UnmarshalJSON unmarshals the WatchHostsRequest from JSON.

func (*WatchHostsRequest) UnmarshalProtoJSON

func (x *WatchHostsRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the WatchHostsRequest message from JSON.

func (*WatchHostsRequest) UnmarshalVT

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

type WatchHostsResponse

type WatchHostsResponse struct {

	// PlatformIds are the platform IDs of the available plugin hosts.
	PlatformIds []string `protobuf:"bytes,1,rep,name=platform_ids,json=platformIds,proto3" json:"platformIds,omitempty"`
	// contains filtered or unexported fields
}

WatchHostsResponse lists the current plugin host platforms.

func (*WatchHostsResponse) CloneMessageVT

func (m *WatchHostsResponse) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*WatchHostsResponse) CloneVT

func (m *WatchHostsResponse) CloneVT() *WatchHostsResponse

func (*WatchHostsResponse) EqualMessageVT

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

func (*WatchHostsResponse) EqualVT

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

func (*WatchHostsResponse) GetPlatformIds

func (x *WatchHostsResponse) GetPlatformIds() []string

func (*WatchHostsResponse) MarshalJSON

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

MarshalJSON marshals the WatchHostsResponse to JSON.

func (*WatchHostsResponse) MarshalProtoJSON

func (x *WatchHostsResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the WatchHostsResponse message to JSON.

func (*WatchHostsResponse) MarshalProtoText

func (x *WatchHostsResponse) MarshalProtoText() string

func (*WatchHostsResponse) MarshalToSizedBufferVT

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

func (*WatchHostsResponse) MarshalToVT

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

func (*WatchHostsResponse) MarshalVT

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

func (*WatchHostsResponse) ProtoMessage

func (*WatchHostsResponse) ProtoMessage()

func (*WatchHostsResponse) Reset

func (x *WatchHostsResponse) Reset()

func (*WatchHostsResponse) SizeVT

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

func (*WatchHostsResponse) String

func (x *WatchHostsResponse) String() string

func (*WatchHostsResponse) UnmarshalJSON

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

UnmarshalJSON unmarshals the WatchHostsResponse from JSON.

func (*WatchHostsResponse) UnmarshalProtoJSON

func (x *WatchHostsResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the WatchHostsResponse message from JSON.

func (*WatchHostsResponse) UnmarshalVT

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

Jump to

Keyboard shortcuts

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