Documentation ¶
Index ¶
Constants ¶
const ( ActionPut = "put" ActionDelete = "delete" )
const
const (
EventKVChange = "kv-changed"
)
const
Variables ¶
This section is empty.
Functions ¶
func ObserveOnce ¶
ObserveOnce observe key changes by (key or labels) or (key and labels)
Types ¶
type EventHandler ¶
type EventHandler struct { }
EventHandler handler serf custom event
func (*EventHandler) HandleEvent ¶
func (h *EventHandler) HandleEvent(e serf.Event)
HandleEvent send event to subscribers
type KVChangeEvent ¶
type KVChangeEvent struct { Key string Action string //include: put,delete Labels map[string]string DomainID string Project string }
KVChangeEvent is event between kie nodes, and broadcast by serf
func NewKVChangeEvent ¶
func NewKVChangeEvent(payload []byte) (*KVChangeEvent, error)
NewKVChangeEvent create a struct base on event payload
type Observer ¶
type Observer struct { UUID string RemoteIP string UserAgent string Event chan *KVChangeEvent }
Observer represents a client polling request
type Topic ¶
type Topic struct { Key string `json:"key,omitempty"` Labels map[string]string `json:"-"` LabelsFormat string `json:"labels,omitempty"` DomainID string `json:"domainID,omitempty"` Project string `json:"project,omitempty"` MatchType string `json:"match,omitempty"` }
Topic can be subscribe
func ParseTopicString ¶
ParseTopicString parse topic string to topic struct
func (*Topic) Match ¶
func (t *Topic) Match(event *KVChangeEvent) bool
Match compare event with topic If the match type is set to exact in long pulling request, only update request with exactly the same label of pulling request will match the request and will trigger an immediate return.
If the match type is not set, it will be matched when pulling request labels is equal to update request labels or a subset of it.