instance

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2023 License: MIT Imports: 23 Imported by: 0

README

Component Runner

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMetricKey

func GetMetricKey(entityID string, m Metric) string

func GetPrevMetricKey

func GetPrevMetricKey(entityID string, m Metric) string

func NewApiNode

func NewApiNode(instance m.Component, conf *Configuration) (*module.Node, error)

func UpdateWithConfigurableDefinitions

func UpdateWithConfigurableDefinitions(portName string, original []byte, updateWith []byte, configurableDefinitions map[string]*ajson.Node) ([]byte, error)

Types

type Configuration

type Configuration struct {
	sync.RWMutex
	ID string // uuid
	// for nats subject
	FlowID string
	//Label  string
	//Name   string
	// where send message next
	DestinationMap map[string][]MapPort
	// fromNode => string => PortConfig
	PortConfigMap map[string]map[string]PortConfig
	Revision      int64
	// asked to be running
	Run         bool
	ComponentID string
	Data        map[string]interface{}
}

func (*Configuration) GetPortConfig

func (c *Configuration) GetPortConfig(portName string, from *string) *PortConfig

func (*Configuration) ShouldRun

func (c *Configuration) ShouldRun() bool

type MapPort

type MapPort struct {
	From   string
	To     string
	EdgeID string
}

type Metric

type Metric int
const (
	MetricNodeRunning Metric = iota
	MetricEdgeMessageSent
	MetricEdgeMessageReceived
	MetricNodeMessageSent
	MetricNodeMessageReceived
	MetricEdgeActive
)

func GetEntityAndMetric

func GetEntityAndMetric(key string) (string, Metric, bool, error)

func (Metric) String

func (m Metric) String() string

type Msg

type Msg struct {
	Subject string
	Data    interface{}
	// contains filtered or unexported fields
}

Msg being sent via instances edges

func NewMsg

func NewMsg(data interface{}, clb func(data interface{}) error) *Msg

func NewMsgWithSubject

func NewMsgWithSubject(subj string, data interface{}, clb func(data interface{}) error) *Msg

func (*Msg) Respond

func (m *Msg) Respond(data interface{}) error

type PortConfig

type PortConfig struct {
	FromNode      string
	Configuration []byte
	Schema        []byte
}

type Runner

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

func NewRunner

func NewRunner(component m.Component, module m.Info) *Runner

func (*Runner) Configure

func (c *Runner) Configure(ctx context.Context, msg *Msg)

func (*Runner) Discovery

func (c *Runner) Discovery(ctx context.Context) discovery.Node

func (*Runner) IsRunning

func (c *Runner) IsRunning() bool

func (*Runner) Run

func (c *Runner) Run(ctx context.Context, runConfigMsg *Msg, inputCh chan *Msg, outputCh chan *Msg) error

func (*Runner) SetConfig

func (c *Runner) SetConfig(config *module.RunnerConfig) *Runner

func (*Runner) SetLogger

func (c *Runner) SetLogger(l zerolog.Logger) *Runner

type TagDefinition

type TagDefinition struct {
	Path       string
	Definition string
}

Jump to

Keyboard shortcuts

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