Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ClientFrameworkVersion = SemanticVersion{
MajorRelease: 1,
MinorRelease: 3,
Build: 0,
}
ClientFrameworkVersion represents the current Semantic Version of the Client-side Plugin agent framework
var ServerFrameworkVersion = SemanticVersion{
MajorRelease: 1,
MinorRelease: 3,
Build: 0,
}
ServerFrameworkVersion represents the current Semantic Version of the Server-side Plugin agent framework
Functions ¶
func Accepts ¶
func Accepts(Is, AcceptsMin, AcceptsMax SemanticVersion) bool
Accepts determines if a given version is accepted for a set of minimum and maximum acceptable versions
Types ¶
type ClientPlugin ¶
type ClientPlugin struct { // A Client Plugin is composed of a generic plugin plus an API Contract. Plugin // A ClientPlugin must implement the full API Contract. ClientPluginAPI }
ClientPlugin represents a EasyTLS-compatible Plugin to be used with an EasyTLS SimpleClient.
func InitializeClientPlugin ¶ added in v1.1.0
func InitializeClientPlugin(Filename string, FrameworkVersion SemanticVersion) (*ClientPlugin, error)
InitializeClientPlugin will initialize and return a Client Plugin, ready to be registered by a Client Plugin Agent.
type ClientPluginAPI ¶ added in v1.1.0
type ClientPluginAPI struct { // Start a plugin. // // This will provide a SimpleClient object for the Plugin to use for any HTTP(S) operations it should take. // If a non-nil error is returned, this indicates that the initialization failed, and the Stop command should be used. // No Plugins should function if Init returns a non-nil error. Init func(*client.SimpleClient, ...interface{}) error }
ClientPluginAPI represents the API contract a Client-Plugin must satisfy to be used by this framework.
type ClientPluginAgent ¶ added in v1.1.0
type ClientPluginAgent struct { RegisteredPlugins []ClientPlugin PluginSearchFolder string // contains filtered or unexported fields }
ClientPluginAgent represents the a Plugin Manager agent to be used with a SimpleClient.
func NewClientAgent ¶
func NewClientAgent(Client *client.SimpleClient, PluginFolder string, Logger io.WriteCloser) (*ClientPluginAgent, error)
NewClientAgent will create a new Client Plugin agent, ready to register plugins.
func (*ClientPluginAgent) Close ¶ added in v1.1.0
func (CA *ClientPluginAgent) Close() error
Close down the plugin agent.
func (*ClientPluginAgent) GetPluginByName ¶ added in v1.1.0
func (CA *ClientPluginAgent) GetPluginByName(Name string) (*ClientPlugin, error)
GetPluginByName will return a pointer to the requested plugin. This is typically used to provide input arguments for when the plugin is Initiated.
func (*ClientPluginAgent) RegisterPlugins ¶ added in v1.1.0
func (CA *ClientPluginAgent) RegisterPlugins() error
RegisterPlugins will configure and register all of the plugins in the previously specified PluginFolder. This will not start any of the plugins, but will only load the necessary symbols from them.
func (*ClientPluginAgent) Run ¶ added in v1.1.0
func (CA *ClientPluginAgent) Run(blocking bool) error
Run will start the ClientPlugin Agent, starting each of the registered plugins. blocking represents if the rest of the application should block on this call or not.
func (*ClientPluginAgent) Stop ¶ added in v1.1.0
func (CA *ClientPluginAgent) Stop() error
Stop will cause ALL of the currentlyRunning Plugins to safely stop.
type Plugin ¶ added in v1.1.0
type Plugin struct { // Filename represents purely the filename component of the plugin file. Filename string // Filepath represents the full path to the plugin file. Filepath string // All Plugins implement the basic API Contract. // This must be a struct and not an interface because the actual function bodies will be returned from loading the plugin file. PluginAPI // contains filtered or unexported fields }
Plugin represents the most generic features and functionality of a Plugin Object
func (*Plugin) SetInputArguments ¶ added in v1.1.0
func (P *Plugin) SetInputArguments(args ...interface{})
SetInputArguments will set the input arguments passed to a given plugin to be exactly what is passed to this function.
type PluginAPI ¶ added in v1.1.0
type PluginAPI struct { // Query the current status of the plugin. // // This must return an output-only unbuffered channel, allowing the plugin to directly send status messages as they are generated. // If this channel is not read from, it will not block itself, and will only present the most recent message. Status func() (<-chan PluginStatus, error) // Query the Semantic Versioning compatabilities of the plugin. // // This will accept the Semantic Version of the Plugin at hand and compare it against it's set of acceptable framework versions. A nil error implies compatability. Version func(SemanticVersion) error // Query the Name of the Plugin. // // This must return the name of the plugin, in canonical format. Name func() string // Stop the plugin. // // This must trigger a full stop of any internal behaviours of the plugin, only returning once ALL internal behaviours have halted. This should return any and all errors which arise during shutdown and are not explicitly handled by the shutdown. The Agent makes no guarantee on how long AFTER receiving the return value from this call the application will run for, so this must represent the FINAL valid state of a plugin. Stop func() error }
PluginAPI represents the base API contract which must be satisfied by ANY plugin.
type PluginStatus ¶
PluginStatus represents a single status message from a given EasyTLS-compliant plugin.
func (PluginStatus) String ¶
func (S PluginStatus) String() string
type SemanticVersion ¶
SemanticVersion represents a useable semantic version number. This can be used to assert compatability between plugins, agents, and frameworks.
func ParseVersion ¶
func ParseVersion(v string) (*SemanticVersion, error)
ParseVersion allows for a SemanticVersion to be recovered from its string representation.
func (*SemanticVersion) String ¶
func (v *SemanticVersion) String() string
type ServerPlugin ¶
type ServerPlugin struct { // A Server Plugin is composed of a generic plugin plus an API Contract. Plugin // A ServerPlugin must implement the full API Contract. ServerPluginAPI }
ServerPlugin represents a EasyTLS-compatible Plugin to be used with an EasyTLS SimpleServer.
func InitializeServerPlugin ¶ added in v1.1.0
func InitializeServerPlugin(Filename string, FrameworkVersion SemanticVersion) (*ServerPlugin, error)
InitializeServerPlugin will initialize and return a Server Plugin, ready to be registered by a Server Plugin Agent.
type ServerPluginAPI ¶ added in v1.1.0
type ServerPluginAPI struct { // Start a plugin. // // This will initialize the plugin, and return the set of Routes it can provide back to the SimpleServer. Init func(...interface{}) ([]server.SimpleHandler, error) }
ServerPluginAPI represents the API contract a Server-Plugin must satisfy to be used by this framework.
type ServerPluginAgent ¶ added in v1.1.0
type ServerPluginAgent struct { RegisteredPlugins []ServerPlugin PluginSearchFolder string // contains filtered or unexported fields }
ServerPluginAgent represents the a Plugin Manager agent to be used with a SimpleServer.
func NewServerAgent ¶
func NewServerAgent(PluginFolder string, Logger io.WriteCloser) (*ServerPluginAgent, error)
NewServerAgent will create a new Server Plugin agent, ready to register plugins.
func (*ServerPluginAgent) Close ¶ added in v1.1.0
func (SA *ServerPluginAgent) Close() error
Close down the plugin agent.
func (*ServerPluginAgent) GetPluginByName ¶ added in v1.1.0
func (SA *ServerPluginAgent) GetPluginByName(Name string) (*ServerPlugin, error)
GetPluginByName will return a pointer to the requested plugin. This is typically used to provide input arguments for when the plugin is Initiated.
func (*ServerPluginAgent) RegisterPlugins ¶ added in v1.1.0
func (SA *ServerPluginAgent) RegisterPlugins() error
RegisterPlugins will configure and register all of the plugins in the previously specified PluginFolder. This will not start any of the plugins, but will only load the necessary symbols from them.
func (*ServerPluginAgent) Run ¶ added in v1.1.0
func (SA *ServerPluginAgent) Run(blocking bool) error
Run will start the ServerPlugin Agent, starting each of the registered plugins. blocking represents if the rest of the application should block on this SAll or not.
func (*ServerPluginAgent) Stop ¶ added in v1.1.0
func (SA *ServerPluginAgent) Stop() error
Stop will cause ALL of the currently Running Plugins to safely stop.