hrotti

package
v0.0.0-...-087b33b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2017 License: EPL-1.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	INBOUND  = 1
	OUTBOUND = 2
)

Variables

View Source
var (
	INFO     *log.Logger
	PROTOCOL *log.Logger
	ERROR    *log.Logger
	DEBUG    *log.Logger
)

loggers

Functions

This section is empty.

Types

type BrokerStats

type BrokerStats struct {
	// contains filtered or unexported fields
}

func (*BrokerStats) AddClient

func (b *BrokerStats) AddClient()

type Client

type Client struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

func (*Client) Connected

func (c *Client) Connected() bool

func (*Client) HandleFlow

func (c *Client) HandleFlow(msg ControlPacket, hrotti *Hrotti)

func (*Client) KeepAliveTimer

func (c *Client) KeepAliveTimer(hrotti *Hrotti)

func (*Client) Receive

func (c *Client) Receive(hrotti *Hrotti)

func (*Client) ResetTimer

func (c *Client) ResetTimer()

func (*Client) Send

func (c *Client) Send(hrotti *Hrotti)

func (*Client) Start

func (c *Client) Start(cp *ConnectPacket, hrotti *Hrotti)

func (*Client) Stop

func (c *Client) Stop(sendWill bool, hrotti *Hrotti)

func (*Client) StopForTakeover

func (c *Client) StopForTakeover()

type Hrotti

type Hrotti struct {
	PersistStore Persistence
	// contains filtered or unexported fields
}

func NewHrotti

func NewHrotti(maxQueueDepth int, persistence Persistence) *Hrotti

func (*Hrotti) AddListener

func (h *Hrotti) AddListener(name string, config *ListenerConfig) error

func (*Hrotti) AddSub

func (h *Hrotti) AddSub(client string, subscription string, qos byte)

func (*Hrotti) AddSubscription

func (h *Hrotti) AddSubscription(c *Client, topics []string, qoss []byte) []byte

Add a subscription for a client, taking an array of topics to subscribe to and an associated slice of QoS values for the topics, return a slice of byte values indicating the granted QoS values in topics order.

func (*Hrotti) DeleteSub

func (h *Hrotti) DeleteSub(client string, subscription string)

func (*Hrotti) DeleteSubAll

func (h *Hrotti) DeleteSubAll(client string)

func (*Hrotti) DeliverMessage

func (h *Hrotti) DeliverMessage(topic string, message *PublishPacket)

func (*Hrotti) FindRetained

func (h *Hrotti) FindRetained(id string, topic string, qos byte)

func (*Hrotti) InitClient

func (h *Hrotti) InitClient(conn net.Conn)

func (*Hrotti) RemoveSubscription

func (h *Hrotti) RemoveSubscription(c *Client, topic string) bool

func (*Hrotti) Stop

func (h *Hrotti) Stop()

func (*Hrotti) StopListener

func (h *Hrotti) StopListener(name string) error

type ListenerConfig

type ListenerConfig struct {
	URL *url.URL
}

ListenerConfig is a struct containing a URL

func NewListenerConfig

func NewListenerConfig(rawURL string) *ListenerConfig

NewListenerConfig returns a pointer to a ListenerConfig prepared to listen on the URL specified as rawURL

type MemoryPersistence

type MemoryPersistence struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

the MemoryPersistence struct is a map of client pointers to pointers to a Persistence Entry. So each client has its own map of msgIds/packets.

func (*MemoryPersistence) Add

func (p *MemoryPersistence) Add(client string, direction dirFlag, message ControlPacket) bool

func (*MemoryPersistence) AddBatch

func (p *MemoryPersistence) AddBatch(batch map[string]*PublishPacket)

func (*MemoryPersistence) Close

func (p *MemoryPersistence) Close(client string)

func (*MemoryPersistence) Delete

func (p *MemoryPersistence) Delete(client string, direction dirFlag, uid uuid.UUID) bool

func (*MemoryPersistence) Exists

func (p *MemoryPersistence) Exists(client string) bool

func (*MemoryPersistence) GetAll

func (p *MemoryPersistence) GetAll(client string) (messages []ControlPacket)

func (*MemoryPersistence) Init

func (p *MemoryPersistence) Init() error

func (*MemoryPersistence) Open

func (p *MemoryPersistence) Open(client string)

func (*MemoryPersistence) Replace

func (p *MemoryPersistence) Replace(client string, direction dirFlag, message ControlPacket) bool

type MemoryPersistenceEntry

type MemoryPersistenceEntry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

a persistence entry is a map of msgIds and ControlPackets

type Persistence

type Persistence interface {
	Init() error
	Open(string)
	Close(string)
	Add(string, dirFlag, ControlPacket) bool
	Replace(string, dirFlag, ControlPacket) bool
	AddBatch(map[string]*PublishPacket)
	Delete(string, dirFlag, uuid.UUID) bool
	GetAll(string) []ControlPacket
	Exists(string) bool
}

type State

type State struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*State) SetValue

func (s *State) SetValue(value StateVal)

func (*State) Value

func (s *State) Value() StateVal

type StateVal

type StateVal uint8
const (
	DISCONNECTED  StateVal = 0x00
	CONNECTING    StateVal = 0x01
	CONNECTED     StateVal = 0x02
	DISCONNECTING StateVal = 0x03
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL