Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface { // SendMessage is the public trigger indicating a dynamically loaded adapter // should transmit an `EgressMessage` to its platform. Dynamically loaded // adapters must define how that is done. SendMessage(msg.MessageInterface) Name() string // Listen is the public trigger that initiates an adapter to start listening // to external platform events. It should be implemented as non-blocking and // push `RawIngressMessage`s to the inChan on the receipt of raw messages // from the external platform. Listen(chan<- msg.MessageInterface) }
Adapter is an abstraction that should be implemented to present a standard interface to the comm server for communicating to, and from external platforms. Similar to the `Plugin`, it is a facade type that delegates actions like sending and receiving messages to concrete implementations dynamically loaded from shared libraries.
func LoadAdapter ¶
LoadAdapter loads adapter behavior from a given .so adapter file
type CmdDelegate ¶
type CmdDelegate struct { IngressMessage msg.MessageInterface Submatches map[string]string // contains filtered or unexported fields }
CmdDelegate is the object passed to plugin cmds that acts as an intermediary between the `Engine` and the `Plugin`. It is the primary interface a plugin author interfaces with the comm server.
func NewCmdDelegate ¶
func NewCmdDelegate(im msg.MessageInterface, subm map[string]string) CmdDelegate
NewCmdDelegate creates a new `CmdDelegate` from an `IngressMessage` and a submatch array, produced from the `CmdLink.Regexp` match.
func (*CmdDelegate) SendResponse ¶
func (d *CmdDelegate) SendResponse(response string)
SendResponse is used by plugin cmds to communicate messages back to the originating platform that triggered the command. It accepts a simple string response.
type CmdFn ¶
type CmdFn func(*CmdDelegate)
CmdFn is the required function signature of a plugin command. It should accept a `*CmdDelegate` for interfacing back with the `Engine`.
type CmdLink ¶
CmdLink pairs a regexp to a CmdFn. If the engine matches the regexp against an `IngressMessage`, it will route the command to the `CmdLink`'s `CmdFn`.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the heart of korecomm. It's responsible for routing traffic amongst buffers in a concurrent way, as well as the loading and execution of extensions.
func (*Engine) LoadExtensions ¶
LoadExtensions will attempt to load enabled plugins and extensions. Includes extension init (used for things like establishing connections with platforms).
func (*Engine) Start ¶
func (e *Engine) Start()
Start will cause the engine to start listening on all successfully loaded adapters. On the receipt of any new message from an adapter, it will parse the message and determine if the contents are a command. If the message does contain a command, it will be transformed to an `IngressMessage` and routed to matching plugin commands. If the plugin sends back a message to the originator, it will be transformed to an `EgressMessage` and routed to the originating adapter for transmission via the client.
type Plugin ¶
Plugin is the primary abstraction representing dynamic, extensible behavioral features. In reality, it's a facade that presents a controller public interface for consumers, while delegating much of its functionality to dynamically loaded functions sourced from a shared library.
func LoadPlugin ¶
LoadPlugin loads dynamic plugin behavior from a given .so plugin file