agent

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Path     = "./config.toml"
	Hearbeat = "heartbeat.>"
	Commands = "commands"
	Config   = "config"
)

Variables

View Source
var (

	// ErrMalformedEntity indicates malformed entity specification
	ErrMalformedEntity = errors.New("malformed entity specification")

	// ErrInvalidQueryParams indicates malformed URL
	ErrInvalidQueryParams = errors.New("invalid query params")
)

Functions

This section is empty.

Types

type Heartbeat added in v0.11.0

type Heartbeat interface {
	Update()
	Info() Info
}

Heartbeat specifies api for updating status and keeping track on services that are sending heartbeat to NATS.

func NewHeartbeat added in v0.11.0

func NewHeartbeat(name, svcType string, interval time.Duration) Heartbeat

interval - duration of interval if service doesnt send heartbeat during interval it is marked offline

type Info added in v0.11.0

type Info struct {
	Name     string    `json:"name"`
	LastSeen time.Time `json:"last_seen"`
	Status   string    `json:"status"`
	Type     string    `json:"type"`
	Terminal int       `json:"terminal"`
}

type Service

type Service interface {
	// Execute command
	Execute(string, string) (string, error)

	// Control command
	Control(string, string) error

	// Update configuration file
	AddConfig(config.Config) error

	// Config returns Config struct created from config file
	Config() config.Config

	// Saves config file
	ServiceConfig(uuid, cmdStr string) error

	// Services returns service list
	Services() []Info

	// Terminal used for terminal control of gateway
	Terminal(string, string) error

	// Publish message
	Publish(string, string) error
}

Service specifies API for publishing messages and subscribing to topics.

func New

func New(mc paho.Client, cfg *config.Config, ec edgex.Client, nc *nats.Conn, logger log.Logger) (Service, error)

New returns agent service implementation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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