dtmanager

package
v1.0.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//RestDealType update from mqtt
	RestDealType = 0
	//SyncDealType update form cloud sync
	SyncDealType = 1
	//DetailDealType detail update from cloud
	DetailDealType = 2
	//SyncTwinDeleteDealType twin delete when sync
	SyncTwinDeleteDealType = 3
	//DealActual deal actual
	DealActual = 1
	//DealExpected deal exepected
	DealExpected = 0
)

Variables

View Source
var (
	//ActionCallBack map for action to callback
	ActionCallBack map[string]CallBack
)

Functions

func Added

func Added(context *dtcontext.DTContext, toAdd []dttype.Device, baseMessage dttype.BaseMessage, delta bool)

Added add device to the edge group

func DealDeviceTwin

func DealDeviceTwin(context *dtcontext.DTContext, deviceID string, eventID string, msgTwin map[string]*dttype.MsgTwin, dealType int) error

DealDeviceTwin deal device twin

func DealGetMembership

func DealGetMembership(context *dtcontext.DTContext, payload []byte) error

DealGetMembership deal get membership event

func DealGetTwin

func DealGetTwin(context *dtcontext.DTContext, deviceID string, payload []byte) error

DealGetTwin deal get twin event

func DealMsgAttr

func DealMsgAttr(context *dtcontext.DTContext, deviceID string, msgAttrs map[string]*dttype.MsgAttr, dealType int) dttype.DealAttrResult

DealMsgAttr get diff,0:update, 1:detail

func DealMsgTwin

func DealMsgTwin(context *dtcontext.DTContext, deviceID string, msgTwins map[string]*dttype.MsgTwin, dealType int) dttype.DealTwinResult

DealMsgTwin get diff while updating twin

func DeviceUpdated

func DeviceUpdated(context *dtcontext.DTContext, deviceID string, attributes map[string]*dttype.MsgAttr, baseMessage dttype.BaseMessage, dealType int) (interface{}, error)

DeviceUpdated update device attributes

func Removed

func Removed(context *dtcontext.DTContext, toRemove []dttype.Device, baseMessage dttype.BaseMessage, delta bool)

Removed remove device from the edge group

func SyncDeviceFromSqlite

func SyncDeviceFromSqlite(context *dtcontext.DTContext, deviceID string) error

SyncDeviceFromSqlite sync device from sqlite

func Updated

func Updated(context *dtcontext.DTContext, deviceID string, payload []byte)

Updated update the snapshot

Types

type CallBack

type CallBack func(*dtcontext.DTContext, string, interface{}) (interface{}, error)

CallBack for deal

type CommWorker

type CommWorker struct {
	Worker
	Group string
}

CommWorker deal app response event

func (CommWorker) Start

func (cw CommWorker) Start()

Start worker

type DTWorker

type DTWorker interface {
	Start()
}

DTWorker worker for devicetwin

type DeviceWorker

type DeviceWorker struct {
	Worker
	Group string
}

DeviceWorker deal device event

func (DeviceWorker) Start

func (dw DeviceWorker) Start()

Start worker

type MemWorker

type MemWorker struct {
	Worker
	Group string
}

MemWorker deal membership event

func (MemWorker) Start

func (mw MemWorker) Start()

Start worker

type TwinWorker

type TwinWorker struct {
	Worker
	Group string
}

TwinWorker deal twin event

func (TwinWorker) Start

func (tw TwinWorker) Start()

Start worker

type Worker

type Worker struct {
	ReceiverChan  chan interface{}
	ConfirmChan   chan interface{}
	HeartBeatChan chan interface{}
	DTContexts    *dtcontext.DTContext
}

Worker actual

Jump to

Keyboard shortcuts

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