extperipheral

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package extperipheral provides helper functions for creating peripheral extensions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(logger log.Interface, unmarshal codec.UnmarshalFunc, impl PeripheralConnector) types.Handler

Types

type Handler

type Handler struct {
	*extutil.BaseHandler
	// contains filtered or unexported fields
}

func (*Handler) HandleCmd

func (c *Handler) HandleCmd(
	ctx context.Context,
	id, seq uint64,
	kind arhatgopb.CmdType,
	payload []byte,
) (arhatgopb.MsgType, interface{}, error)

type Peripheral

type Peripheral interface {
	Operate(
		ctx context.Context,
		params map[string]string,
		data []byte,
	) ([][]byte, error)

	CollectMetrics(
		ctx context.Context,
		params map[string]string,
	) ([]*arhatgopb.PeripheralMetricsMsg_Value, error)

	Close(ctx context.Context)
}

type PeripheralConnector

type PeripheralConnector interface {
	Connect(
		ctx context.Context,
		target string,
		params map[string]string,
		tlsConfig *arhatgopb.TLSConfig,
	) (Peripheral, error)
}

Jump to

Keyboard shortcuts

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