Documentation ¶
Index ¶
Constants ¶
View Source
const ( ResNode = "node" ResMember = "membership" ResTwin = "twin" ResAuth = "auth_info" ResDevice = "device" )
constants for resource types
View Source
const ( OpGet = "get" OpResult = "get_result" OpList = "list" OpDetail = "detail" OpDelta = "delta" OpDoc = "document" OpUpdate = "updated" OpInsert = "insert" OpDelete = "deleted" OpConnect = "connected" OpDisConnect = "disconnected" OpKeepalive = "keepalive" )
constants for resource operations
View Source
const ( SrcCloudHub = "cloudhub" SrcController = "controller" SrcManager = "edgemgr" )
constants for message source
View Source
const (
GpResource = "resource"
)
constants for message group
Variables ¶
This section is empty.
Functions ¶
func EventToMessage ¶
EventToMessage converts an event to a model message
func NewResource ¶
NewResource constructs a resource field using resource type and ID
Types ¶
type Event ¶
type Event struct { Group string `json:"msg_group"` Source string `json:"source"` UserGroup UserGroupInfo `json:"user_group"` ID string `json:"msg_id"` ParentID string `json:"parent_msg_id"` Timestamp int64 `json:"timestamp"` Content interface{} `json:"content"` }
Event represents message communicated between cloud hub and edge hub
func MessageToEvent ¶
MessageToEvent converts a model message to an event
func (*Event) GetContent ¶
GetContent dumps the content to string
func (*Event) IsFromEdge ¶
isFromEdge judges if the event is sent from edge
func (*Event) IsNodeStopped ¶
IsNodeStopped indicates if the node is stopped or running
type UserGroupInfo ¶
UserGroupInfo struct
Click to show internal directories.
Click to hide internal directories.