Documentation ¶
Index ¶
- Constants
- 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) GetContentData() ([]byte, error)
- func (msg *Message) GetDestination() string
- 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) GetType() string
- func (msg *Message) IsEmpty() bool
- func (msg *Message) IsSync() bool
- func (msg *Message) NewRespByMessage(message *Message, content interface{}) *Message
- func (msg *Message) SetDestination(dest string) *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) SetType(msgType string) *Message
- func (msg *Message) String() string
- func (msg *Message) UpdateID() *Message
- type MessageHeader
- type MessageRoute
Constants ¶
const ( InsertOperation = "insert" DeleteOperation = "delete" QueryOperation = "query" UpdateOperation = "update" PatchOperation = "patch" UploadOperation = "upload" ResponseOperation = "response" ResponseErrorOperation = "error" ResourceTypePod = "pod" ResourceTypeEvent = "event" ResourceTypeConfigmap = "configmap" ResourceTypeServiceAccountToken = "serviceaccounttoken" ResourceTypeSecret = "secret" ResourceTypeNode = "node" ResourceTypePodlist = "podlist" ResourceTypePodStatus = "podstatus" ResourceTypePodPatch = "podpatch" ResourceTypeNodeStatus = "nodestatus" ResourceTypeNodePatch = "nodepatch" ResourceTypeRule = "rule" ResourceTypeRuleEndpoint = "ruleendpoint" ResourceTypeRuleStatus = "rulestatus" ResourceTypeLease = "lease" ResourceTypeSaAccess = "serviceaccountaccess" ResourceTypeCSR = "certificatesigningrequest" ResourceTypeK8sCA = "k8s/ca.crt" )
Constants for database operations and resource type settings
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { Header MessageHeader `json:"header"` Router MessageRoute `json:"route,omitempty"` Content interface{} `json:"content"` }
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) GetContentData ¶
GetContentData returns message content data
func (*Message) GetDestination ¶ added in v1.9.3
GetDestination get destination
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) SetDestination ¶ added in v1.9.3
SetDestination set destination
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"` // 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"` // 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"` // message type indicates the context type that delivers the message, such as channel, unixsocket, etc. // if the value is empty, the channel context type will be used. MessageType string `json:"type,omitempty"` }
MessageHeader defines message header details
type MessageRoute ¶
type MessageRoute struct { // where the message come from Source string `json:"source,omitempty"` // where the message will send to Destination string `json:"destination,omitempty"` // where the message will broadcast to Group string `json:"group,omitempty"` // what's the operation on resource Operation string `json:"operation,omitempty"` // what's the resource want to operate Resource string `json:"resource,omitempty"` }
MessageRoute contains structure of message