Documentation
¶
Overview ¶
Package kaetzchen implements support for provider side auto-responder agents.
Package kaetzchen implements support for provider side auto-responder agents.
Index ¶
- Constants
- Variables
- type BuiltInCtorFn
- type CBORPluginWorker
- func (k *CBORPluginWorker) IsKaetzchen(recipient [constants.RecipientIDLength]byte) bool
- func (k *CBORPluginWorker) KaetzchenForPKI() ServiceMap
- func (k *CBORPluginWorker) OnKaetzchen(pkt *packet.Packet)
- func (k *CBORPluginWorker) RegisterKaetzchen(capa string) error
- func (k *CBORPluginWorker) UnregisterKaetzchen(capa string) error
- type Kaetzchen
- type KaetzchenWorker
- func (k *KaetzchenWorker) IsKaetzchen(recipient [sConstants.RecipientIDLength]byte) bool
- func (k *KaetzchenWorker) KaetzchenForPKI() map[string]map[string]interface{}
- func (k *KaetzchenWorker) OnKaetzchen(pkt *packet.Packet)
- func (k *KaetzchenWorker) RegisterKaetzchen(capa string) error
- func (k *KaetzchenWorker) UnregisterKaetzchen(capa string) error
- type Parameters
- type PluginChans
- type PluginName
- type PluginParameters
- type ServiceMap
Constants ¶
const EchoCapability = "echo"
EchoCapability is the standardized capability for the echo service.
const InboundPacketsChannelSize = 1000
const ParameterEndpoint = "endpoint"
ParameterEndpoint is the mandatory Parameter key indicationg the Kaetzchen's endpoint.
const TestDestCapability = "testdest"
Variables ¶
var BuiltInCtors = map[string]BuiltInCtorFn{ EchoCapability: func(cfg *config.Kaetzchen, glue glue.Glue) (Kaetzchen, error) { return NewEcho(cfg, glue, EchoCapability) }, TestDestCapability: func(cfg *config.Kaetzchen, glue glue.Glue) (Kaetzchen, error) { return NewEcho(cfg, glue, TestDestCapability) }, }
BuiltInCtors are the constructors for all built-in Kaetzchen.
var ErrNoResponse = errors.New("kaetzchen: message has no response")
ErrNoResponse is the error returned from OnRequest() when there is no response to be sent (rather than an empty response).
Functions ¶
This section is empty.
Types ¶
type BuiltInCtorFn ¶
BuiltInCtorFn is the constructor type for a built-in Kaetzchen.
type CBORPluginWorker ¶
CBORPluginWorker is similar to Kaetzchen worker but uses CBOR over UNIX domain socket to talk to plugins.
func NewCBORPluginWorker ¶
func NewCBORPluginWorker(glue glue.Glue) (*CBORPluginWorker, error)
NewCBORPluginWorker returns a new CBORPluginWorker
func (*CBORPluginWorker) IsKaetzchen ¶
func (k *CBORPluginWorker) IsKaetzchen(recipient [constants.RecipientIDLength]byte) bool
IsKaetzchen returns true if the given recipient is one of our workers.
func (*CBORPluginWorker) KaetzchenForPKI ¶
func (k *CBORPluginWorker) KaetzchenForPKI() ServiceMap
KaetzchenForPKI returns the plugins Parameters map for publication in the PKI doc.
func (*CBORPluginWorker) OnKaetzchen ¶
func (k *CBORPluginWorker) OnKaetzchen(pkt *packet.Packet)
OnKaetzchen enqueues the pkt for processing by our thread pool of plugins.
func (*CBORPluginWorker) RegisterKaetzchen ¶ added in v0.0.35
func (k *CBORPluginWorker) RegisterKaetzchen(capa string) error
RegisterKaetzchen adds a Kaetzchen service to the set of available Kaetzchen
func (*CBORPluginWorker) UnregisterKaetzchen ¶ added in v0.0.35
func (k *CBORPluginWorker) UnregisterKaetzchen(capa string) error
UnregisterKaetzchen stops a CBORPluginKaetzczhen and removes it from the set of available Kaetzchen
type Kaetzchen ¶
type Kaetzchen interface { // Capability returns the agent's functionality for publication in // the ServiceNode's descriptor. Capability() string // Parameters returns the agent's paramenters for publication in // the ServiceNode's descriptor. Parameters() Parameters // OnRequest is the method that is called when the ServiceNode receives // a request designed for a particular agent. The caller will handle // extracting the payload component of the message. // // Implementations MUST: // // * Be thread (go routine) safe. // // * Return ErrNoResponse if there is no response to be sent. A nil // byte slice and nil error will result in a response with a 0 byte // payload being sent. // // * NOT assume payload will be valid past the call to OnRequest. // Any contents that need to be preserved, MUST be copied out, // except if it is only used as a part of the response body. OnRequest(id uint64, payload []byte, hasSURB bool) ([]byte, error) // Halt cleans up the agent prior to de-registration and teardown. Halt() }
Kaetzchen is the interface implemented by each auto-responder agent.
type KaetzchenWorker ¶
func (*KaetzchenWorker) IsKaetzchen ¶
func (k *KaetzchenWorker) IsKaetzchen(recipient [sConstants.RecipientIDLength]byte) bool
func (*KaetzchenWorker) KaetzchenForPKI ¶
func (k *KaetzchenWorker) KaetzchenForPKI() map[string]map[string]interface{}
func (*KaetzchenWorker) OnKaetzchen ¶
func (k *KaetzchenWorker) OnKaetzchen(pkt *packet.Packet)
func (*KaetzchenWorker) RegisterKaetzchen ¶ added in v0.0.35
func (k *KaetzchenWorker) RegisterKaetzchen(capa string) error
RegisterKaetzchen adds an internal Kaetzchen service to the set of available Kaetzchen
func (*KaetzchenWorker) UnregisterKaetzchen ¶ added in v0.0.35
func (k *KaetzchenWorker) UnregisterKaetzchen(capa string) error
UnregisterKaetzchen removes a running internal Kaetzchen service from the set of available Kaetzchen
type Parameters ¶
type Parameters map[string]interface{}
Parameters is the map describing each Kaetzchen's parameters to be published in the ServiceNode's descriptor.
type PluginChans ¶
type PluginChans = map[[constants.RecipientIDLength]byte]chan interface{}
PluginChans maps from Recipient ID to channel.
type PluginParameters ¶
type PluginParameters = map[PluginName]interface{}
PluginParameters maps from parameter key to value.
type ServiceMap ¶
type ServiceMap = map[PluginName]PluginParameters
ServiceMap maps from plugin name to plugin parameters and is used by Mix Descriptors which describe Providers with plugins. Each plugin can optionally set one or more parameters.