Documentation
¶
Overview ¶
Package subscriber provides types and data structures for subscribers.
Index ¶
Constants ¶
View Source
const ( // Subscribed set by a subscriber in a message when it first connects. Subscribed reason = "Subscribed" // Unsubscribed set by a subscriber when it leaves. Unsubscribed reason = "Unsubscribed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { // NodeName name of the node for which we want to receive the resources. // All the resources that are associated to that node will be sent to the // subscriber. NodeName string // UID identifies the subscriber. UID string // Reason of the message. If it is subscribing or unsubscribing. Reason reason }
Message sent by a subscriber to communicate its presence/absence.
type SubsChan ¶
type SubsChan chan Message
SubsChan a channel used to communicate when new subscribers arrive or existing ones leave.
type Subscribers ¶
type Subscribers struct {
// contains filtered or unexported fields
}
Subscribers for generic items.
func (*Subscribers) AddSubscriberPerNode ¶
func (gc *Subscribers) AddSubscriberPerNode(node, sub string)
AddSubscriberPerNode adds a new subscriber for the given node.
func (*Subscribers) DeleteSubscriberPerNode ¶
func (gc *Subscribers) DeleteSubscriberPerNode(node, sub string)
DeleteSubscriberPerNode given the node and the subscribers UID it removes it.
func (*Subscribers) GetSubscribersPerNode ¶
func (gc *Subscribers) GetSubscribersPerNode(node string) fields.Subscribers
GetSubscribersPerNode returns the subscribers for a given node. It's a copy, safe to save it for later use or modify it.
func (*Subscribers) HasNode ¶
func (gc *Subscribers) HasNode(node string) bool
HasNode returns true if a node has subscribers.
Click to show internal directories.
Click to hide internal directories.