emqd

package
v0.0.0-...-1c24e16 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

func NewChannel

func NewChannel(topicName, channelName string, emqd *EMQD) *Channel

func (*Channel) AddClient

func (c *Channel) AddClient(client *Client) error

func (*Channel) Close

func (c *Channel) Close() error

func (*Channel) Delete

func (c *Channel) Delete() error

func (*Channel) Empty

func (c *Channel) Empty()

清空数据

func (*Channel) Exiting

func (c *Channel) Exiting() bool

func (*Channel) GetMemoryMsgChan

func (c *Channel) GetMemoryMsgChan() chan *Message

func (*Channel) GetName

func (c *Channel) GetName() string

func (*Channel) PutMessage

func (c *Channel) PutMessage(m *Message) error

func (*Channel) RemoveClient

func (c *Channel) RemoveClient(clientID int64)

func (*Channel) RequeueMessage

func (c *Channel) RequeueMessage(clientID int64, id protocol.MessageID) error

func (*Channel) StartInFlight

func (c *Channel) StartInFlight(msg *Message, clientID int64)

type ChannelMetadata

type ChannelMetadata struct {
	Name string `json:"name"`
}

type Client

type Client struct {
	ID int64
	// contains filtered or unexported fields
}

func NewClient

func NewClient(id int64, conn net.Conn) *Client

func (*Client) Close

func (c *Client) Close() error

type EMQD

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

func NewEMQD

func NewEMQD(opts *Options) (*EMQD, error)

func (*EMQD) Exit

func (e *EMQD) Exit()

func (*EMQD) GetMetadata

func (e *EMQD) GetMetadata() *Metadata

func (*EMQD) GetOpts

func (e *EMQD) GetOpts() *Options

func (*EMQD) GetTopic

func (e *EMQD) GetTopic(topicName string) *Topic

func (*EMQD) LoadMetadata

func (e *EMQD) LoadMetadata() error

func (*EMQD) Main

func (e *EMQD) Main() error

func (*EMQD) Notify

func (e *EMQD) Notify(v interface{})

EMQD中的数据发生了变化

func (*EMQD) PersistMetadata

func (e *EMQD) PersistMetadata() error

type HTTPServer

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

func (*HTTPServer) ServeHTTP

func (s *HTTPServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

type IdentifyData

type IdentifyData struct {
}

type LookupPeer

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

func NewLookupPeer

func NewLookupPeer(addr string) *LookupPeer

func (*LookupPeer) Close

func (lp *LookupPeer) Close() error

func (*LookupPeer) Command

func (lp *LookupPeer) Command(cmd *command.Command) ([]byte, error)

func (*LookupPeer) Connect

func (lp *LookupPeer) Connect(e *EMQD) error

func (*LookupPeer) Read

func (lp *LookupPeer) Read(data []byte) (int, error)

func (*LookupPeer) Write

func (lp *LookupPeer) Write(data []byte) (int, error)

type Message

type Message struct {
	ClientID int64
	*protocol.Message
}

func NewMessage

func NewMessage(id protocol.MessageID, body []byte) *Message

type Metadata

type Metadata struct {
	Topics []TopicMetadata `json:"topics"`
}

type Options

type Options struct {
	ID                  int64
	TCPAddress          string
	HTTPAddress         string
	LookupdTCPAddresses []string
	DataPath            string
	MemQueueSize        int64
	MinMsgSize          int64
	MaxMsgSize          int64
	MaxBytesPerFile     int64
	SyncEvery           int64
	SyncTimeout         time.Duration
}

func NewOptions

func NewOptions() *Options

type PeerInfo

type PeerInfo struct {
	TCPPort          int    `json:"tcp_port"`
	HTTPPort         int    `json:"http_port"`
	BroadcastAddress string `json:"broadcast_address"`
}

type Protocol

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

协议结构体 用来组织emqd和client的关联处理

func (*Protocol) Exec

func (p *Protocol) Exec(client *Client, params [][]byte) ([]byte, error)

func (*Protocol) IDENTITY

func (p *Protocol) IDENTITY(client *Client, params [][]byte) ([]byte, error)

func (*Protocol) IOLoop

func (p *Protocol) IOLoop(c protocol.Client) error

func (*Protocol) MessagePump

func (p *Protocol) MessagePump(client *Client, startedChan chan bool)

func (*Protocol) NOP

func (p *Protocol) NOP(client *Client, params [][]byte) ([]byte, error)

func (*Protocol) NewClient

func (p *Protocol) NewClient(conn net.Conn) protocol.Client

func (*Protocol) PUB

func (p *Protocol) PUB(client *Client, params [][]byte) ([]byte, error)

func (*Protocol) REQ

func (p *Protocol) REQ(client *Client, params [][]byte) ([]byte, error)

func (*Protocol) SUB

func (p *Protocol) SUB(client *Client, params [][]byte) ([]byte, error)

func (*Protocol) Send

func (p *Protocol) Send(client *Client, frameType int32, data []byte) error

func (*Protocol) SendMessage

func (p *Protocol) SendMessage(client *Client, msg *Message) error

type Resp

type Resp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func ErrResp

func ErrResp(message string) *Resp

type TCPServer

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

func (*TCPServer) Close

func (s *TCPServer) Close()

func (*TCPServer) Handle

func (t *TCPServer) Handle(conn net.Conn)

type Topic

type Topic struct {
	MessageID uint64
	// contains filtered or unexported fields
}

func NewTopic

func NewTopic(topicName string, emqd *EMQD) *Topic

func (*Topic) Close

func (t *Topic) Close() error

关闭,但不删除

func (*Topic) Delete

func (t *Topic) Delete() error

删除

func (*Topic) Exiting

func (t *Topic) Exiting() bool

func (*Topic) GenerateID

func (t *Topic) GenerateID() protocol.MessageID

TODO:

func (*Topic) GetChannel

func (t *Topic) GetChannel(channelName string) *Channel

func (*Topic) GetChans

func (t *Topic) GetChans() []*Channel

func (*Topic) GetName

func (t *Topic) GetName() string

func (*Topic) PutMessage

func (t *Topic) PutMessage(m *Message) error

func (*Topic) Start

func (t *Topic) Start()

type TopicMetadata

type TopicMetadata struct {
	Name     string            `json:"name"`
	Channels []ChannelMetadata `json:"channels"`
}

Jump to

Keyboard shortcuts

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