baseline

package
v5.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Handshake = plugin.HandshakeConfig{

	ProtocolVersion:  1,
	MagicCookieKey:   "BASIC_PLUGIN",
	MagicCookieValue: "hello",
}

Handshake is a common handshake that is shared by plugin and host.

Functions

func Register

func Register(plugin *BaselinePlugin) func()

Types

type Baseline

type Baseline interface {
	// GetBaselineValue(id int64, factID int64, situationID int64, situationInstanceID int64, time time.Time) (BaselineValue, error)
	GetBaselineValues(id int64, factID int64, situationID int64, situationInstanceID int64, time time.Time) (map[string]BaselineValue, error)
}

Baseline is the interface that we're exposing as a plugin.

type BaselineGRPCPlugin

type BaselineGRPCPlugin struct {
	// GRPCPlugin must still implement the Plugin interface
	plugin.Plugin
	// Concrete implementation, written in Go. This is only used for plugins that are written in Go.
	Impl Baseline
}

func (*BaselineGRPCPlugin) GRPCClient

func (p *BaselineGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*BaselineGRPCPlugin) GRPCServer

func (p *BaselineGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type BaselinePlugin

type BaselinePlugin struct {
	Name         string
	ClientConfig *plugin.ClientConfig
	Client       *plugin.Client
	Baseline     Baseline
}

func NewBaselinePlugin

func NewBaselinePlugin() *BaselinePlugin

func P

func P() (*BaselinePlugin, error)

P is used to access the global plugin singleton

func (*BaselinePlugin) Handler

func (m *BaselinePlugin) Handler() http.Handler

func (*BaselinePlugin) HandlerPrefix

func (m *BaselinePlugin) HandlerPrefix() string

func (*BaselinePlugin) Start

func (m *BaselinePlugin) Start() error

func (*BaselinePlugin) Stop

func (m *BaselinePlugin) Stop() error

func (*BaselinePlugin) Test

func (m *BaselinePlugin) Test()

type BaselineValue

type BaselineValue struct {
	Time       time.Time `json:"time,omitempty"`
	Value      float64   `json:"value,omitempty"`
	ValueLower float64   `json:"valueLower,omitempty"`
	ValueUpper float64   `json:"valueUpper,omitempty"`
	Avg        float64   `json:"avg,omitempty"`
	Std        float64   `json:"std,omitempty"`
	Median     float64   `json:"median,omitempty"`
}

type GRPCClient

type GRPCClient struct {
	// contains filtered or unexported fields
}

GRPCClient is an implementation of Baseline that talks over RPC.

func (*GRPCClient) GetBaselineValues

func (m *GRPCClient) GetBaselineValues(id int64, factID int64, situationID int64, situationInstanceID int64, ti time.Time) (map[string]BaselineValue, error)

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl Baseline
}

func (*GRPCServer) GetBaselineValues

func (m *GRPCServer) GetBaselineValues(ctx context.Context, req *proto.BaselineValueRequest) (*proto.BaselineValues, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL