Documentation ¶
Index ¶
- Constants
- type ApulisHeader
- type Message
- func (msg *Message) BuildHeader(ID, parentID string, timestamp int64) *Message
- func (msg *Message) BuildRouter(source, group, res, opr string) *Message
- func (msg *Message) Clone(message *Message) *Message
- func (msg *Message) FillBody(content interface{}) *Message
- func (msg *Message) GetContent() interface{}
- func (msg *Message) GetGroup() string
- func (msg *Message) GetID() string
- func (msg *Message) GetOperation() string
- func (msg *Message) GetParentID() string
- func (msg *Message) GetResource() string
- func (msg *Message) GetResourceVersion() string
- func (msg *Message) GetSource() string
- func (msg *Message) GetTimestamp() int64
- func (msg *Message) IsSync() bool
- func (msg *Message) NewRespByMessage(message *Message, content interface{}) *Message
- func (msg *Message) SetResourceOperation(res, opr string) *Message
- func (msg *Message) SetResourceVersion(resourceVersion string) *Message
- func (msg *Message) SetRoute(source, group string) *Message
- func (msg *Message) UpdateID() *Message
- type MessageHeader
- type MessageRoute
Constants ¶
const ( InsertOperation = "insert" DeleteOperation = "delete" QueryOperation = "query" UpdateOperation = "update" ResponseOperation = "response" ResponseErrorOperation = "error" ResourceTypePod = "pod" ResourceTypeConfigmap = "configmap" ResourceTypeSecret = "secret" ResourceTypeNode = "node" ResourceTypePodlist = "podlist" ResourceTypePodStatus = "podstatus" ResourceTypeNodeStatus = "nodestatus" )
Constants for database operations and resource type settings
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApulisHeader ¶
type ApulisHeader struct { ClusterId int64 `json:"clusterId"` GroupId int64 `json:"groupId"` UserId int64 `json:"userId"` }
ApulisHeader struct
type Message ¶
type Message struct { Header MessageHeader `json:"header" binding:"required,dive"` Router MessageRoute `json:"route" binding:"required,dive"` Content interface{} `json:"content" binding:"required"` }
Message struct
func NewErrorMessage ¶
NewErrorMessage returns a new error message by a message received
func NewMessage ¶
NewMessage returns a new basic message: model.NewMessage().BuildRouter().FillBody()
func NewRawMessage ¶
func NewRawMessage() *Message
NewRawMessage returns a new raw message: model.NewRawMessage().BuildHeader().BuildRouter().FillBody()
func (*Message) BuildHeader ¶
BuildHeader builds message header. You can also use for updating message header
func (*Message) BuildRouter ¶
BuildRouter sets route and resource operation in message
func (*Message) GetContent ¶
func (msg *Message) GetContent() interface{}
GetContent returns message content
func (*Message) GetOperation ¶
GetOperation returns message route operation string
func (*Message) GetParentID ¶
GetParentID returns message parent id
func (*Message) GetResource ¶
GetResource returns message route resource
func (*Message) GetResourceVersion ¶
GetResourceVersion returns message resource version
func (*Message) GetTimestamp ¶
GetTimestamp returns message timestamp
func (*Message) NewRespByMessage ¶
NewRespByMessage returns a new response message by a message received
func (*Message) SetResourceOperation ¶
SetResourceOperation sets router resource and operation in message
func (*Message) SetResourceVersion ¶
SetResourceVersion sets resource version in message header
type MessageHeader ¶
type MessageHeader struct { // the message uuid ID string `json:"msg_id" binding:"required"` // the response message parentid must be same with message received // please use NewRespByMessage to new response message ParentID string `json:"parent_msg_id,omitempty"` // the time of creating Timestamp int64 `json:"timestamp" binding:"required"` // specific resource version for the message, if any. // it's currently backed by resource version of the k8s object saved in the Content field. // kubeedge leverages the concept of message resource version to achieve reliable transmission. ResourceVersion string `json:"resourceversion,omitempty"` // the flag will be set in sendsync Sync bool `json:"sync,omitempty"` }
MessageHeader defines message header details
type MessageRoute ¶
type MessageRoute struct { // where the message come from Source string `json:"source" binding:"required"` // where the message will broadcasted to Group string `json:"group,omitempty"` // what's the operation on resource Operation string `json:"operation" binding:"required"` // what's the resource want to operate Resource string `json:"resource,omitempty"` }
MessageRoute contains structure of message