Documentation
¶
Index ¶
- type Broker
- func (b *Broker) AddSubscribeTopicNode(topic string, id string, subs *SubscriberConfig, topicNode chan bool) error
- func (b *Broker) AddTopic(topic string, topicCfg *TopicConfig, topicReady chan bool)
- func (b *Broker) GetTopicNode(topic string) *TopicNode
- func (b *Broker) IncMsgCount(topic string) error
- func (b *Broker) NotifyAllSubscribers(topic string, topicReady chan bool)
- func (b *Broker) PrintAllTree()
- func (b *Broker) Start()
- type BrokerConfigs
- type Session
- type SessionConfig
- type SessionManager
- func (sm *SessionManager) AddSession(sessionCfg *SessionConfig, chSession chan *Session)
- func (sm *SessionManager) CheckSession(partition *SessionPartition, wg *sync.WaitGroup, currentTimestamp *time.Time)
- func (sm *SessionManager) CheckSessionTimeouts() error
- func (sm *SessionManager) DebugPrint()
- func (sm *SessionManager) Exist(id string) bool
- func (sm *SessionManager) GetSessionCount() int
- func (sm *SessionManager) RemoveSession(id string, keepAlive int16)
- func (sm *SessionManager) UpdateSession(sessionCfg *SessionConfig, chSession chan *Session)
- type SessionPartition
- type SubscriberConfig
- type TopicConfig
- type TopicNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct { Root *TopicNode SessionMg *SessionManager // contains filtered or unexported fields }
func NewBroker ¶
func NewBroker(b *BrokerConfigs) *Broker
NewBroker inicializa um novo corretor MQTT com um nó raiz
func (*Broker) AddSubscribeTopicNode ¶
func (*Broker) AddTopic ¶
func (b *Broker) AddTopic(topic string, topicCfg *TopicConfig, topicReady chan bool)
func (*Broker) GetTopicNode ¶
func (*Broker) IncMsgCount ¶
func (*Broker) NotifyAllSubscribers ¶
func (*Broker) PrintAllTree ¶
func (b *Broker) PrintAllTree()
PrintTree imprime a árvore de tópicos a partir do nó fornecido
type BrokerConfigs ¶
type BrokerConfigs struct { Name string Address string TypeConnection connection.TypeConnection }
Broker representa a entidade do corretor MQTT
type SessionConfig ¶
type SessionConfig struct { Id string KeepAlive int16 Clean bool // contains filtered or unexported fields }
session.go
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
SessionManager gerencia sessões MQTT
func NewSessionManager ¶
func NewSessionManager() *SessionManager
NewSessionManager creates a new SessionManager
func (*SessionManager) AddSession ¶
func (sm *SessionManager) AddSession(sessionCfg *SessionConfig, chSession chan *Session)
AddSession adds a new session to the top of the list
func (*SessionManager) CheckSession ¶
func (sm *SessionManager) CheckSession(partition *SessionPartition, wg *sync.WaitGroup, currentTimestamp *time.Time)
func (*SessionManager) CheckSessionTimeouts ¶
func (sm *SessionManager) CheckSessionTimeouts() error
CheckSessionTimeouts verifica e remove sessões cujo tempo limite expirou
func (*SessionManager) DebugPrint ¶
func (sm *SessionManager) DebugPrint()
func (*SessionManager) Exist ¶
func (sm *SessionManager) Exist(id string) bool
func (*SessionManager) GetSessionCount ¶
func (sm *SessionManager) GetSessionCount() int
func (*SessionManager) RemoveSession ¶
func (sm *SessionManager) RemoveSession(id string, keepAlive int16)
RemoveSession removes sessions from the map and updates pointers
func (*SessionManager) UpdateSession ¶
func (sm *SessionManager) UpdateSession(sessionCfg *SessionConfig, chSession chan *Session)
UpdateSession moves the updated session to the top of the list
type SessionPartition ¶
type SessionPartition struct {
// contains filtered or unexported fields
}
type SubscriberConfig ¶
type TopicConfig ¶
type TopicNode ¶
type TopicNode struct { Name string `json:"name"` Topic string `json:"topic"` TopicConfig *TopicConfig `json:"topicCfg,omitempty"` Subscribers map[string]*SubscriberConfig `json:"subscribers"` // Lista de sub-tópicos associados a este tópico MessageCount int `json:"messageCount"` SubscribersCount int `json:"subscribersCount"` Children map[string]*TopicNode `json:"children,omitempty"` //map[string]*TopicNode // contains filtered or unexported fields }
Topic.go
Click to show internal directories.
Click to hide internal directories.