metathings_evaluatord_sdk

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_HEADER_SOURCE_ID      = "X-Evaluator-Source-ID"
	HTTP_HEADER_SOURCE_TYPE    = "X-Evaluator-Source-Type"
	HTTP_HEADER_DEVICE_ID      = "X-Evaluator-Device-ID"
	HTTP_HEADER_DATA_CODEC     = "X-Evaluator-Data-Codec"
	HTTP_HEADER_DATA_TIMESTAMP = "X-Evaluator-Data-Timestamp"
	HTTP_HEADER_DATA_TAGS      = "X-Evaluator-Data-Tags"
)
View Source
const (
	TIMER_DEFAULT_CONFIG = "default"
)

Variables

View Source
var (
	ErrUnsupportedDataLauncherFactory = errors.New("unsupported data launcher factory")

	ErrUnsupportedDataEncoder = errors.New("unsupported data encoder")
	ErrUnsupportedDataDecoder = errors.New("unsupported data decoder")
)

Functions

func ExtractDevice added in v1.1.26

func ExtractDevice(ctx context.Context) string

func ExtractTags added in v1.1.26

func ExtractTags(ctx context.Context) map[string]string

func ExtractTimestamp added in v1.1.26

func ExtractTimestamp(ctx context.Context) time.Time

func ExtractToken

func ExtractToken(ctx context.Context) string

func ToData added in v1.1.26

func ToData(d *Data) func(string, interface{}) error

func WithDevice added in v1.1.26

func WithDevice(ctx context.Context, dev string) context.Context

func WithTags added in v1.1.26

func WithTags(ctx context.Context, tags map[string]string) context.Context

func WithTimestamp added in v1.1.26

func WithTimestamp(ctx context.Context, ts time.Time) context.Context

func WithToken

func WithToken(ctx context.Context, tkn string) context.Context

Types

type Data

type Data interface {
	Iter() map[string]interface{}
	Get(string) interface{}
	With(string, interface{}) Data
}

func DataFromBytes

func DataFromBytes(buf []byte) (Data, error)

func DataFromMap

func DataFromMap(raw map[string]interface{}) (Data, error)

type DataDecoder

type DataDecoder interface {
	Decode([]byte) (Data, error)
}

func GetDataDecoder

func GetDataDecoder(name string) (DataDecoder, error)

type DataEncoder

type DataEncoder interface {
	Encode(Data) ([]byte, error)
}

func GetDataEncoder

func GetDataEncoder(name string) (DataEncoder, error)

type DataLauncher

type DataLauncher interface {
	Launch(context.Context, Resource, Data) error
}

func NewDataLauncher

func NewDataLauncher(name string, args ...interface{}) (dl DataLauncher, err error)

func NewDummyDataLauncher added in v1.1.26

func NewDummyDataLauncher(args ...interface{}) (DataLauncher, error)

func NewHttpDataLauncher

func NewHttpDataLauncher(args ...interface{}) (DataLauncher, error)

type DataLauncherFactory

type DataLauncherFactory func(...interface{}) (DataLauncher, error)

type DummyDataLauncher added in v1.1.26

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

func (*DummyDataLauncher) Launch added in v1.1.26

func (ddl *DummyDataLauncher) Launch(ctx context.Context, src Resource, dat Data) error

type HttpDataLauncher

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

func (*HttpDataLauncher) Launch

func (hdl *HttpDataLauncher) Launch(ctx context.Context, src Resource, dat Data) error

type HttpDataLauncherOption

type HttpDataLauncherOption struct {
	Endpoint  string
	DataCodec string
}

func DefaultHttpDataLauncherOption

func DefaultHttpDataLauncherOption() *HttpDataLauncherOption

type JsonDataDecoder

type JsonDataDecoder struct{}

func (*JsonDataDecoder) Decode

func (*JsonDataDecoder) Decode(buf []byte) (Data, error)

type JsonDataEncoder

type JsonDataEncoder struct{}

func (*JsonDataEncoder) Encode

func (*JsonDataEncoder) Encode(dat Data) ([]byte, error)

type Resource

type Resource interface {
	GetId() string
	GetType() string
}

func NewResource

func NewResource(id, typ string) Resource

Jump to

Keyboard shortcuts

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