api

package
v0.0.0-...-04d676d Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c *Cfg) *api

New creates and initializes a new instance of api.

Types

type Cfg

type Cfg struct {
	Log                log.Logger
	Ctrl               svc.Ctrl
	Metric             *metric.Metric
	PubChan            chan<- *model.Cfg
	PortRPC            uint32
	PortREST           uint32
	CfgProvider        CfgProvider
	DataProvider       DataProvider
	Retry              time.Duration
	PublicKey          string
	PrivateKey         string
	TerminationTimeout time.Duration
}

Cfg is used to initialize an instance of api.

type CfgProvider

type CfgProvider interface {
	GetInitCfg(m *model.Meta) (*model.Cfg, error)
	GetCfg(devID string, t model.Type) (*model.Cfg, error)
	SetCfg(devID string, t model.Type, c *model.Cfg) error
}

CfgProvider is a contract for the configuration provider.

type DataProvider

type DataProvider interface {
	GetDevsData() ([]model.Data, error)
	GetDevData(devID string) (*model.Data, error)
	SaveData(*model.Data) error
}

DataProvider is a contract for the data provider.

type Publisher

type Publisher interface {
	Publish(msg interface{}, channel string) (int64, error)
}

Publisher .

Directories

Path Synopsis
Package mock_api is a generated GoMock package.
Package mock_api is a generated GoMock package.

Jump to

Keyboard shortcuts

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