dtcontext

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//IsDetail deal detail lock
	IsDetail = false
)

Functions

This section is empty.

Types

type DTContext

type DTContext struct {
	GroupID        string
	NodeID         string
	CommChan       map[string]chan interface{}
	ConfirmChan    chan interface{}
	ConfirmMap     *sync.Map
	ModulesHealth  *sync.Map
	ModulesContext *context.Context
	DeviceList     *sync.Map
	DeviceMutex    *sync.Map
	Mutex          *sync.RWMutex
	// DBConn *dtclient.Conn
	State string
}

DTContext context for devicetwin

func InitDTContext

func InitDTContext(context *context.Context) (*DTContext, error)

InitDTContext init dtcontext

func (*DTContext) BuildModelMessage

func (dtc *DTContext) BuildModelMessage(group string, parentID string, resource string, operation string, content interface{}) *model.Message

BuildModelMessage build mode messages

func (*DTContext) CommTo

func (dtc *DTContext) CommTo(dtmName string, content interface{}) error

CommTo communicate

func (*DTContext) GetDevice

func (dtc *DTContext) GetDevice(deviceID string) (*dttype.Device, bool)

GetDevice get device

func (*DTContext) GetMutex

func (dtc *DTContext) GetMutex(deviceID string) (*sync.Mutex, bool)

GetMutex get mutex

func (*DTContext) HeartBeat

func (dtc *DTContext) HeartBeat(dtmName string, content interface{}) error

HeartBeat hearbeat to dtcontroller

func (*DTContext) IsDeviceExist

func (dtc *DTContext) IsDeviceExist(deviceID string) bool

IsDeviceExist judge device is exist

func (*DTContext) Lock

func (dtc *DTContext) Lock(deviceID string) bool

Lock get the lock of the device

func (*DTContext) LockAll

func (dtc *DTContext) LockAll()

LockAll get all lock

func (*DTContext) Send

func (dtc *DTContext) Send(identity string, action string, module string, msg *model.Message) error

Send send result

func (*DTContext) Unlock

func (dtc *DTContext) Unlock(deviceID string) bool

Unlock remove the lock of the device

func (*DTContext) UnlockAll

func (dtc *DTContext) UnlockAll()

UnlockAll get all lock

Jump to

Keyboard shortcuts

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