Documentation
¶
Index ¶
- Constants
- Variables
- func IsInstallMode() bool
- func IsUninstallMode() bool
- type Category
- type Config
- type Controller
- type ControllerGRPCClient
- func (m *ControllerGRPCClient) Config() (map[string]string, error)
- func (m *ControllerGRPCClient) OnEvent(event Event) error
- func (m *ControllerGRPCClient) SetConfig(config map[string]string) error
- func (m *ControllerGRPCClient) Start(host ControllerHost) error
- func (m *ControllerGRPCClient) Stop() error
- type ControllerGRPCHostClient
- type ControllerGRPCHostServer
- type ControllerGRPCPPlugin
- type ControllerGRPCServer
- func (m *ControllerGRPCServer) Config(ctx context.Context, req *proto.Empty) (*proto.ConfigResponse, error)
- func (m *ControllerGRPCServer) OnEvent(ctx context.Context, req *proto.OnEventRequest) (*proto.Empty, error)
- func (m *ControllerGRPCServer) SetConfig(ctx context.Context, req *proto.SetConfigRequest) (*proto.Empty, error)
- func (m *ControllerGRPCServer) Start(ctx context.Context, req *proto.StartRequest) (*proto.Empty, error)
- func (m *ControllerGRPCServer) Stop(ctx context.Context, req *proto.Empty) (*proto.Empty, error)
- type ControllerHost
- type Event
- type Metadata
- type Sensor
- type SensorGRPCClient
- type SensorGRPCHostClient
- type SensorGRPCHostServer
- type SensorGRPCPPlugin
- type SensorGRPCServer
- func (m *SensorGRPCServer) Config(ctx context.Context, req *proto.Empty) (*proto.ConfigResponse, error)
- func (m *SensorGRPCServer) OnEvent(ctx context.Context, req *proto.OnEventRequest) (*proto.Empty, error)
- func (m *SensorGRPCServer) SetConfig(ctx context.Context, req *proto.SetConfigRequest) (*proto.Empty, error)
- func (m *SensorGRPCServer) Start(ctx context.Context, req *proto.StartRequest) (*proto.Empty, error)
- func (m *SensorGRPCServer) Stop(ctx context.Context, req *proto.Empty) (*proto.Empty, error)
- type SensorHost
- type Source
- type Style
- type Whisper
Constants ¶
const ( // CategoryUnknown is the category used when the category is not known CategoryUnknown = iota // CategoryIntelligence is the category used by intelligences CategoryIntelligence // CategoryController is the category used by controllers CategoryController // CategorySensor is the category used by sensors CategorySensor // CategorySidekick is the category used by the main sidekick process CategorySidekick )
Variables ¶
var ControllerPluginMap = map[string]plugin.Plugin{ "controller": &ControllerGRPCPPlugin{}, }
ControllerPluginMap is the map of plugins we can dispense.
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Handshake is a collection of information used to initialize communication between plugin and hosot
var SensorPluginMap = map[string]plugin.Plugin{ "sensor": &SensorGRPCPPlugin{}, }
SensorPluginMap is the map of plugins we can dispense.
Functions ¶
func IsInstallMode ¶
func IsInstallMode() bool
IsInstallMode determines if the plugin is executed in a way meant to be for installation
func IsUninstallMode ¶
func IsUninstallMode() bool
IsUninstallMode determines if the plugin is executed in a way meant to be for uninstallation
Types ¶
type Category ¶
type Category int
Category is a grouping of entity type
func (Category) MarshalJSON ¶
MarshalJSON returns a json serialization of the category
func (Category) MarshalYAML ¶
MarshalYAML returns a yaml serialization of the category
func (*Category) UnmarshalJSON ¶
UnmarshalJSON sets the category from the json data
func (*Category) UnmarshalYAML ¶
UnmarshalYAML sets the category from the yaml data
type Controller ¶
type Controller interface {
Config() (map[string]string, error)
SetConfig(map[string]string) error
OnEvent(Event) error
Start(ControllerHost) error
Stop() error
}
Controller is an interface that defines the methods required of all controller plugins
type ControllerGRPCClient ¶
type ControllerGRPCClient struct {
Metadata Metadata
// contains filtered or unexported fields
}
ControllerGRPCClient is used by the controller plugin host to facilitate host initiated communication with controller plugins
func (*ControllerGRPCClient) Config ¶
func (m *ControllerGRPCClient) Config() (map[string]string, error)
Config is called by the host to retrieve the configuration of the plugin
func (*ControllerGRPCClient) OnEvent ¶
func (m *ControllerGRPCClient) OnEvent(event Event) error
OnEvent is called by the host to send an event to the controller
func (*ControllerGRPCClient) SetConfig ¶
func (m *ControllerGRPCClient) SetConfig(config map[string]string) error
SetConfig is called by the host to set the configuration of the plugin
func (*ControllerGRPCClient) Start ¶
func (m *ControllerGRPCClient) Start(host ControllerHost) error
Start is called by the host when the plugin is started to provide access to the host process
func (*ControllerGRPCClient) Stop ¶
func (m *ControllerGRPCClient) Stop() error
Stop is called by the host when the plugin is stopped
type ControllerGRPCHostClient ¶
type ControllerGRPCHostClient struct {
// contains filtered or unexported fields
}
ControllerGRPCHostClient is used by the controller plugin to facilitate plugin initiated communication with the host
func (*ControllerGRPCHostClient) EmitWhisper ¶
func (m *ControllerGRPCHostClient) EmitWhisper(whisper Whisper) error
EmitWhisper is used by controller plugins to send whispers to sidekick
type ControllerGRPCHostServer ¶
type ControllerGRPCHostServer struct {
// This is the real implementation
Impl ControllerHost
Metadata Metadata
}
ControllerGRPCHostServer is used by the controller plugin host to receive plugin initiated communication
func (*ControllerGRPCHostServer) EmitWhisper ¶
func (m *ControllerGRPCHostServer) EmitWhisper(ctx context.Context, req *proto.EmitWhisperRequest) (*proto.Empty, error)
EmitWhisper is used by controller plugins to send whispers to sidekick
type ControllerGRPCPPlugin ¶
type ControllerGRPCPPlugin struct {
plugin.NetRPCUnsupportedPlugin
Impl Controller
}
ControllerGRPCPPlugin is a structure used to define the parameters of the plugin communication
func (*ControllerGRPCPPlugin) GRPCClient ¶
func (p *ControllerGRPCPPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient is used to generate controller clients that can be used by the host
func (*ControllerGRPCPPlugin) GRPCServer ¶
func (p *ControllerGRPCPPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
GRPCServer is used to register the controller plugin with the GRPC server
type ControllerGRPCServer ¶
type ControllerGRPCServer struct {
Impl Controller
// contains filtered or unexported fields
}
ControllerGRPCServer is used by the controller plugin to receive host initiated communication
func (*ControllerGRPCServer) Config ¶
func (m *ControllerGRPCServer) Config(ctx context.Context, req *proto.Empty) (*proto.ConfigResponse, error)
Config is called by the host to retrieve the configuration of the plugin
func (*ControllerGRPCServer) OnEvent ¶
func (m *ControllerGRPCServer) OnEvent(ctx context.Context, req *proto.OnEventRequest) (*proto.Empty, error)
OnEvent is called by the host to send an event to the plugin
func (*ControllerGRPCServer) SetConfig ¶
func (m *ControllerGRPCServer) SetConfig(ctx context.Context, req *proto.SetConfigRequest) (*proto.Empty, error)
SetConfig is called by the host to set the configuration of the plugin
func (*ControllerGRPCServer) Start ¶
func (m *ControllerGRPCServer) Start(ctx context.Context, req *proto.StartRequest) (*proto.Empty, error)
Start is called by the host when the plugin is started to provide access to the host process
type ControllerHost ¶
ControllerHost is an interface that defines what methods plugins can expect from the host
type Event ¶
Event is a structure that defines a sensor event
func NewTextEvent ¶
NewTextEvent generates a new event with the given text
type Metadata ¶
type Metadata struct {
// Author is the creator of the entity
Author string `json:"author" yaml:"author"`
// Category is a grouping of entity type
// Ex: "intelligence", "loop", "sensor"
Category Category `json:"category" yaml:"category"`
// Created is the time when the entity was created
Created time.Time `json:"created" yaml:"created"`
// Description is a short explaintion of the entity
Description string `json:"description" yaml:"description"`
// ID is a unique identifier for this entity
ID string `json:"id" yaml:"id"`
// Icon is a URL for an icon representing this entity
Icon string `json:"icon" yaml:"icon"`
// Name is a human readable identifier for this entity
Name string `json:"name" yaml:"name"`
// Organization is the name of the organization to which the Author belongs
Organization string `json:"organization" yaml:"organization"`
// Specification is a string indication which version
// of the specification is being used to describe this entity
Specification string `json:"specification" yaml:"specification"`
// Updated is the time when the entity was last updated
Updated time.Time `json:"updated" yaml:"updated"`
// Version is a semver version of this entity
Version string `json:"version" yaml:"version"`
}
Metadata is data about an entity
type Sensor ¶
type Sensor interface {
Config() (Config, error)
SetConfig(Config) error
Start(SensorHost) error
Stop() error
OnEvent(Event) error
}
Sensor is an interface that defines the methods required of all sensor plugins
type SensorGRPCClient ¶
type SensorGRPCClient struct {
Metadata Metadata
// contains filtered or unexported fields
}
SensorGRPCClient is used by the sensor plugin host to facilitate host initiated communication with sensor plugins
func (*SensorGRPCClient) Config ¶
func (m *SensorGRPCClient) Config() (Config, error)
Config is called by the host to retrieve the configuration of the plugin
func (*SensorGRPCClient) OnEvent ¶
func (m *SensorGRPCClient) OnEvent(event Event) error
OnEvent is called by the host to send an event to the sensor
func (*SensorGRPCClient) SetConfig ¶
func (m *SensorGRPCClient) SetConfig(config Config) error
SetConfig is called by the host to set the configuration of the plugin
func (*SensorGRPCClient) Start ¶
func (m *SensorGRPCClient) Start(host SensorHost) error
Start is called by the host when the plugin is started to provide access to the host process
func (*SensorGRPCClient) Stop ¶
func (m *SensorGRPCClient) Stop() error
Stop is called by the host when the plugin is stopped
type SensorGRPCHostClient ¶
type SensorGRPCHostClient struct {
// contains filtered or unexported fields
}
SensorGRPCHostClient is used by the sensor plugin to facilitate plugin initiated communication with the host
func (*SensorGRPCHostClient) EmitEvent ¶
func (m *SensorGRPCHostClient) EmitEvent(event Event) error
EmitEvent is used by sensor plugins to send events to the host
type SensorGRPCHostServer ¶
type SensorGRPCHostServer struct {
// This is the real implementation
Impl SensorHost
Metadata Metadata
}
SensorGRPCHostServer is used by the sensor plugin host to receive plugin initiated communication
func (*SensorGRPCHostServer) EmitEvent ¶
func (m *SensorGRPCHostServer) EmitEvent(ctx context.Context, req *proto.EmitEventRequest) (*proto.Empty, error)
EmitEvent is used by sensor plugins to send events to the host
type SensorGRPCPPlugin ¶
type SensorGRPCPPlugin struct {
plugin.NetRPCUnsupportedPlugin
Impl Sensor
}
SensorGRPCPPlugin is a structure used to define the parameters of the plugin communication
func (*SensorGRPCPPlugin) GRPCClient ¶
func (p *SensorGRPCPPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
GRPCClient is used to generate sensor clients that can be used by the host
func (*SensorGRPCPPlugin) GRPCServer ¶
func (p *SensorGRPCPPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
GRPCServer is used to register the sensor plugin with the GRPC server
type SensorGRPCServer ¶
type SensorGRPCServer struct {
Impl Sensor
// contains filtered or unexported fields
}
SensorGRPCServer is used by the sensor plugin to receive host initiated communication
func (*SensorGRPCServer) Config ¶
func (m *SensorGRPCServer) Config(ctx context.Context, req *proto.Empty) (*proto.ConfigResponse, error)
Config is called by the host to retrieve the configuration of the plugin
func (*SensorGRPCServer) OnEvent ¶
func (m *SensorGRPCServer) OnEvent(ctx context.Context, req *proto.OnEventRequest) (*proto.Empty, error)
OnEvent is called by the host to send an event to the plugin
func (*SensorGRPCServer) SetConfig ¶
func (m *SensorGRPCServer) SetConfig(ctx context.Context, req *proto.SetConfigRequest) (*proto.Empty, error)
SetConfig is called by the host to set the configuration of the plugin
func (*SensorGRPCServer) Start ¶
func (m *SensorGRPCServer) Start(ctx context.Context, req *proto.StartRequest) (*proto.Empty, error)
Start is called by the host when the plugin is started to provide access to the host process
type SensorHost ¶
SensorHost is an interface that defines what methods plugins can expect from the host
type Source ¶
type Source struct {
// Author is the creator of the entity
Author string `json:"author" yaml:"author"`
// Category is a grouping of entity type
// Ex: "intelligence", "loop", "sensor"
Category Category `json:"category" yaml:"category"`
// ID is a unique identifier for this entity
ID string `json:"id" yaml:"id"`
// Name is a human readable identifier for this entity
Name string `json:"name" yaml:"name"`
// Organization is the name of the organization to which the Author belongs
Organization string `json:"organization" yaml:"organization"`
// Version is a semver version of this entity
Version string `json:"version" yaml:"version"`
}
Source is information about the origin of the data
type Style ¶
type Style struct {
BackgroundColor string `json:"backgroundColor"`
HighlightColor string `json:"highlightColor"`
PrimaryColor string `json:"primaryColor"`
}
Style contains fields for specifying whisper style
type Whisper ¶
type Whisper struct {
Markdown string `json:"markdown"`
CreatedAt time.Time `json:"createdAt"`
ID string `json:"id"`
Icon string `json:"icon"` // Material Icon name https://material.io/resources/icons/
Label string `json:"label"`
Style Style `json:"style"`
Source Source `json:"source"`
}
Whisper is the information output of a loop
Source Files
¶
- category.go
- cmd.go
- config.go
- controller.go
- controllerGrpcClient.go
- controllerGrpcHostClient.go
- controllerGrpcHostServer.go
- controllerGrpcServer.go
- controllerPlugin.go
- controllerhost.go
- event.go
- handshake.go
- metadata.go
- sensor.go
- sensorGrpcClient.go
- sensorGrpcHostClient.go
- sensorGrpcHostServer.go
- sensorGrpcServer.go
- sensorHost.go
- sensorPlugin.go
- source.go
- style.go
- whisper.go