Documentation ¶
Index ¶
- func BackgroundListener(transport plugin.Transport, onStop func(), plugin server.VersionedInterface, ...) (server.Stoppable, <-chan struct{})
- func BackgroundPlugin(transport plugin.Transport, onStop func(), plugin server.VersionedInterface, ...) (server.Stoppable, <-chan struct{})
- func Call(plugins func() discovery.Plugins, interfaceSpec spi.InterfaceSpec, ...) error
- func EnsureDirExists(dir string)
- func Listener(transport plugin.Transport, onStop func(), plugin server.VersionedInterface, ...)
- func Plugin(transport plugin.Transport, plugin server.VersionedInterface, ...)
- func ServeRPC(transport plugin.Transport, onStop func(), impls map[PluginCode]interface{}) (stoppable server.Stoppable, running <-chan struct{}, err error)
- type PluginCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackgroundListener ¶
func BackgroundListener(transport plugin.Transport, onStop func(), plugin server.VersionedInterface, more ...server.VersionedInterface) (server.Stoppable, <-chan struct{})
BackgroundListener runs a plugin server, listening at listen address, and advertising with the provided name for discovery. The plugin should conform to the rpc call convention as implemented in the rpc package. This function does not block. Use the returned channel to optionally block while the server is running.
func BackgroundPlugin ¶
func BackgroundPlugin(transport plugin.Transport, onStop func(), plugin server.VersionedInterface, more ...server.VersionedInterface) (server.Stoppable, <-chan struct{})
BackgroundPlugin runs a plugin server, advertising with the provided name for discovery. The plugin should conform to the rpc call convention as implemented in the rpc package. This function does not block. Instead, use the returned channel to optionally block while the server is running. The provided callback, if not nil, will be called when the server stops, before the returned channel is closed.
func Call ¶
func Call(plugins func() discovery.Plugins, interfaceSpec spi.InterfaceSpec, name *plugin.Name, work interface{}) error
Call looks up the the plugin objects by the interface type and executes the work.
func EnsureDirExists ¶
func EnsureDirExists(dir string)
EnsureDirExists makes sure the directory where the socket file will be placed exists.
func Listener ¶
func Listener(transport plugin.Transport, onStop func(), plugin server.VersionedInterface, more ...server.VersionedInterface)
Listener runs a plugin server, listening at listen address, and advertising with the provided name for discovery. The plugin should conform to the rpc call convention as implemented in the rpc package.
func Plugin ¶
func Plugin(transport plugin.Transport, plugin server.VersionedInterface, more ...server.VersionedInterface)
Plugin runs a plugin server, advertising with the provided name for discovery. The plugin should conform to the rpc call convention as implemented in the rpc package.
func ServeRPC ¶
func ServeRPC(transport plugin.Transport, onStop func(), impls map[PluginCode]interface{}) (stoppable server.Stoppable, running <-chan struct{}, err error)
ServeRPC starts the RPC endpoint / server given a plugin name for lookup and a list of plugin objects that implements the pkg/spi/ interfaces. onStop is a callback invoked when the the endpoint shuts down.
Types ¶
type PluginCode ¶
type PluginCode int
PluginCode is the type code for exposing the correct RPC interface for a given object. We need type information because some object like Manager implements multiple spi interfaces and type information is necessary to know which RPC interface needs to bind to the object. This is so that an object that implements both Group and Metadata spi can be bound to separate RPC interfaces.
const ( // Manager is the type code for Manager Manager PluginCode = iota // Controller is the type code for Controller implementation Controller //Instance is the type code for Instance SPI implementation Instance // Flavor is the type code for Flavor SPI implementation Flavor // Group is the type code for Group SPI implementation Group // Metadata is the type code for Metadata SPI implementation Metadata // MetadataUpdatable is the type code for updatable Metadata SPI implementation MetadataUpdatable // Event is the type code for Event SPI implementation Event // Resource is the type code for Resource SPI implementation Resource // L4 is the type code for L4 loadbalancer implementation L4 )