nsqlookupd

package
v0.3.7-HA.1.9.4 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: MIT Imports: 27 Imported by: 0

README

nsqlookupd

nsqlookupd is the daemon that manages topology metadata and serves client requests to discover the location of topics at runtime.

Read the docs

Documentation

Index

Constants

View Source
const (
	MAX_PARTITION_NUM = 255
	MAX_REPLICATOR    = 5
	MAX_LOAD_FACTOR   = 10000
)
View Source
const (
	OLD_VERSION_PID = -11
)

Variables

This section is empty.

Functions

func GetValidPartitionID

func GetValidPartitionID(numStr string) (int, error)

func GetValidPartitionNum

func GetValidPartitionNum(numStr string) (int, error)

func GetValidReplicator

func GetValidReplicator(r string) (int, error)

func GetValidSuggestLF

func GetValidSuggestLF(r string) (int, error)

func HandleBlockRate

func HandleBlockRate(w http.ResponseWriter, req *http.Request, ps httprouter.Params) (interface{}, error)

func SetLogger

func SetLogger(logger levellogger.Logger, level int32)

Types

type ChannelReg

type ChannelReg struct {
	PartitionID string
	PeerId      string
	Channel     string
}

func (ChannelReg) IsMatch

func (k ChannelReg) IsMatch(pid string, peerId string, ch string) bool

type ChannelRegistrations

type ChannelRegistrations []ChannelReg

func (ChannelRegistrations) Channels

func (rr ChannelRegistrations) Channels() []string

type ClientV1

type ClientV1 struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewClientV1

func NewClientV1(conn net.Conn) *ClientV1

func (*ClientV1) String

func (c *ClientV1) String() string

type Context

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

type LookupProtocolV1

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

func (*LookupProtocolV1) Exec

func (p *LookupProtocolV1) Exec(client *ClientV1, reader *bufio.Reader, params []string) ([]byte, error)

func (*LookupProtocolV1) IDENTIFY

func (p *LookupProtocolV1) IDENTIFY(client *ClientV1, reader *bufio.Reader, params []string) ([]byte, error)

func (*LookupProtocolV1) IOLoop

func (p *LookupProtocolV1) IOLoop(conn net.Conn) error

func (*LookupProtocolV1) PING

func (p *LookupProtocolV1) PING(client *ClientV1, params []string) ([]byte, error)

func (*LookupProtocolV1) REGISTER

func (p *LookupProtocolV1) REGISTER(client *ClientV1, reader *bufio.Reader, params []string) ([]byte, error)

func (*LookupProtocolV1) UNREGISTER

func (p *LookupProtocolV1) UNREGISTER(client *ClientV1, reader *bufio.Reader, params []string) ([]byte, error)

type NSQLookupd

type NSQLookupd struct {
	sync.RWMutex

	DB *RegistrationDB
	// contains filtered or unexported fields
}

func New added in v0.3.6

func New(opts *Options) *NSQLookupd

func (*NSQLookupd) Exit

func (l *NSQLookupd) Exit()

func (*NSQLookupd) Main

func (l *NSQLookupd) Main()

func (*NSQLookupd) RealHTTPAddr added in v0.3.3

func (l *NSQLookupd) RealHTTPAddr() *net.TCPAddr

func (*NSQLookupd) RealTCPAddr added in v0.3.3

func (l *NSQLookupd) RealTCPAddr() *net.TCPAddr

type NodeStat

type NodeStat struct {
	Hostname         string  `json:"hostname"`
	BroadcastAddress string  `json:"broadcast_address"`
	TCPPort          int     `json:"tcp_port"`
	HTTPPort         int     `json:"http_port"`
	LeaderLoadFactor float64 `json:"leader_load_factor"`
	NodeLoadFactor   float64 `json:"node_load_factor"`
}

type Options added in v0.3.6

type Options struct {
	Verbose bool `flag:"verbose"`

	TCPAddress         string `flag:"tcp-address"`
	HTTPAddress        string `flag:"http-address"`
	RPCPort            string `flag:"rpc-port"`
	BroadcastAddress   string `flag:"broadcast-address"`
	BroadcastInterface string `flag:"broadcast-interface"`

	ReverseProxyPort string `flag:"reverse-proxy-port"`

	ClusterID                  string `flag:"cluster-id"`
	ClusterLeadershipAddresses string `flag:"cluster-leadership-addresses" cfg:"cluster_leadership_addresses"`

	InactiveProducerTimeout  time.Duration `flag:"inactive-producer-timeout"`
	NsqdPingTimeout          time.Duration `flag:"nsqd-ping-timeout"`
	BalanceInterval          []string      `flag:"balance-interval"`
	AllowWriteWithNoChannels bool          `flag:"allow-write-with-nochannels"`

	LogLevel int32  `flag:"log-level" cfg:"log_level"`
	LogDir   string `flag:"log-dir" cfg:"log_dir"`
	Logger   levellogger.Logger
}

func NewOptions added in v0.3.6

func NewOptions() *Options

type PeerInfo

type PeerInfo struct {
	Id               string `json:"id"`
	RemoteAddress    string `json:"remote_address"`
	Hostname         string `json:"hostname"`
	BroadcastAddress string `json:"broadcast_address"`
	TCPPort          int    `json:"tcp_port"`
	HTTPPort         int    `json:"http_port"`
	Version          string `json:"version"`
	// the node id used in the cluster.
	DistributedID string `json:"distributed_id"`
	// contains filtered or unexported fields
}

func (*PeerInfo) IsOldPeer

func (self *PeerInfo) IsOldPeer() bool

type PeerInfoList

type PeerInfoList []*PeerInfo

func (PeerInfoList) FilterByActive

func (pp PeerInfoList) FilterByActive(inactivityTimeout time.Duration) PeerInfoList

type Producer

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

func (*Producer) IsTombstoned

func (p *Producer) IsTombstoned() bool

func (*Producer) String

func (p *Producer) String() string

func (*Producer) Tombstone

func (p *Producer) Tombstone()

func (*Producer) UndoTombstone

func (p *Producer) UndoTombstone()

type Producers

type Producers []*Producer

func (Producers) FilterByActive

func (pp Producers) FilterByActive(inactivityTimeout time.Duration, filterTomb bool) Producers

func (Producers) PeerInfo

func (pp Producers) PeerInfo() []*PeerInfo

type RegistrationDB

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

func NewRegistrationDB

func NewRegistrationDB() *RegistrationDB

func (*RegistrationDB) AddChannelReg

func (r *RegistrationDB) AddChannelReg(topic string, k ChannelReg) bool

add a registration key

func (*RegistrationDB) AddTopicProducer

func (r *RegistrationDB) AddTopicProducer(topic string, pidStr string, p *Producer) bool

func (*RegistrationDB) DelTombstoneLookupdNode

func (r *RegistrationDB) DelTombstoneLookupdNode(nid string) bool

func (*RegistrationDB) FindChannelRegs

func (r *RegistrationDB) FindChannelRegs(topic string, pid string) ChannelRegistrations

func (*RegistrationDB) FindPeerTopics

func (r *RegistrationDB) FindPeerTopics(id string) map[string]TopicRegistrations

func (*RegistrationDB) FindTopicProducers

func (r *RegistrationDB) FindTopicProducers(topic string, pid string) TopicRegistrations

func (*RegistrationDB) FindTopics

func (r *RegistrationDB) FindTopics() []string

func (*RegistrationDB) GetAllPeerClients

func (r *RegistrationDB) GetAllPeerClients() PeerInfoList

func (*RegistrationDB) IsTombstoneLookupdNode

func (r *RegistrationDB) IsTombstoneLookupdNode(nid string) bool

func (*RegistrationDB) RemoveAllByPeerId

func (r *RegistrationDB) RemoveAllByPeerId(id string)

remove all topic producers and channels related with peer id

func (*RegistrationDB) RemoveChannelReg

func (r *RegistrationDB) RemoveChannelReg(topic string, k ChannelReg) bool

func (*RegistrationDB) RemoveTopicProducer

func (r *RegistrationDB) RemoveTopicProducer(topic string, pid string, id string) bool

func (*RegistrationDB) SearchPeerClientByClusterID

func (r *RegistrationDB) SearchPeerClientByClusterID(id string) *PeerInfo

func (*RegistrationDB) SearchPeerClientByID

func (r *RegistrationDB) SearchPeerClientByID(id string) *PeerInfo

func (*RegistrationDB) TombstoneLookupdNode

func (r *RegistrationDB) TombstoneLookupdNode(nid string, pinfo PeerInfo)

type TopicProducerReg

type TopicProducerReg struct {
	PartitionID  string
	ProducerNode *Producer
}

type TopicRegistrations

type TopicRegistrations []TopicProducerReg

func (TopicRegistrations) FilterByActive

func (pp TopicRegistrations) FilterByActive(inactivityTimeout time.Duration, filterTomb bool) TopicRegistrations

Jump to

Keyboard shortcuts

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