baseline

package
v5.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 16 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 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 BaselineService
}

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 {
	Config          pluginutils.PluginConfig
	ClientConfig    *plugin.ClientConfig
	Client          *plugin.Client
	BaselineService BaselineService
}

func NewBaselinePlugin

func NewBaselinePlugin(config pluginutils.PluginConfig) *BaselinePlugin

func P

func P() (*BaselinePlugin, error)

P is used to access the global plugin singleton

func (*BaselinePlugin) Handler

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

func (*BaselinePlugin) HandlerPrefix

func (p *BaselinePlugin) HandlerPrefix() string

func (*BaselinePlugin) Running added in v5.4.0

func (p *BaselinePlugin) Running() bool

func (*BaselinePlugin) ServicePort added in v5.1.0

func (p *BaselinePlugin) ServicePort() int

func (*BaselinePlugin) Start

func (p *BaselinePlugin) Start() error

func (*BaselinePlugin) Stop

func (p *BaselinePlugin) Stop() error

type BaselineService added in v5.1.0

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

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

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) BuildBaselineValues added in v5.1.0

func (m *GRPCClient) BuildBaselineValues(baselineID int64) error

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 BaselineService
	proto.UnimplementedBaselineServer
}

func (*GRPCServer) BuildBaselineValues added in v5.1.0

func (m *GRPCServer) BuildBaselineValues(ctx context.Context, req *proto.BuildBaselineRequest) (*empty.Empty, error)

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