broker

package
v0.0.0-...-0139eb0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxTime time.Time = time.Unix(1<<63-1, 0)
View Source
var ZeroTime time.Time

Functions

func HTTPServer

func HTTPServer(s *httpServer) error

func TCPServer

func TCPServer(listener net.Listener, handler TCPHandler, logger *zap.Logger) error

TCPServer creates a new TCP server.

Types

type Conn

type Conn struct {

	// Meta mutext
	MetaLock sync.Mutex

	HeartbeatTimeout             time.Duration
	FlushInterval                time.Duration
	PollSubscribeMessageInterval time.Duration

	ExitChan chan int
	// contains filtered or unexported fields
}

Conn is the broker connection.

func (*Conn) Close

func (c *Conn) Close() error

Close the connection.

func (*Conn) DeleteSubTopic

func (c *Conn) DeleteSubTopic(ctx context.Context, topicName string)

func (*Conn) Flush

func (c *Conn) Flush() error

Flush the send buffer.

func (*Conn) ID

func (c *Conn) ID() uint64

func (*Conn) IOLoop

func (c *Conn) IOLoop(ctx context.Context) error

IOLoop for a upcoming connection.

func (*Conn) Kind

func (c *Conn) Kind() topic.SubscriberKind

func (*Conn) LUID

func (c *Conn) LUID() uint64

LUID (local UID) of a specific connection.

func (*Conn) Send

func (c *Conn) Send(ctx context.Context, b []byte) error

Send data to the peer.

func (*Conn) SendMessage

func (c *Conn) SendMessage(ctx context.Context, msg *topic.Message) error

SendMessage sends only a *publish* message to the client.

func (*Conn) StoreSubTopic

func (c *Conn) StoreSubTopic(ctx context.Context, topicName string, ssid []uint64)

type MessageIDRing

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

func NewMessageIDRing

func NewMessageIDRing() *MessageIDRing

func (*MessageIDRing) FreeID

func (r *MessageIDRing) FreeID(mid uint16)

func (*MessageIDRing) GetID

func (r *MessageIDRing) GetID() (uint16, error)

type Server

type Server struct {
	MStore storage.MStorage
	SStore storage.SStorage
	// contains filtered or unexported fields
}

Server that backs the broker.

func NewServer

func NewServer(cfg *config.Config) (*Server, error)

NewServer creates a new server.

func (*Server) Exit

func (s *Server) Exit()

Exit terminates the server.

func (*Server) Start

func (s *Server) Start() error

Start the server.

type TCPHandler

type TCPHandler interface {
	Handle(net.Conn)
}

TCPHandler is the interface for handling TCP connections.

Jump to

Keyboard shortcuts

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