nsqlookupd

package
v0.0.0-...-94081c8 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: MIT Imports: 20 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 (
	LOG_DEBUG = lg.DEBUG
	LOG_INFO  = lg.INFO
	LOG_WARN  = lg.WARN
	LOG_ERROR = lg.ERROR
	LOG_FATAL = lg.FATAL
)

Variables

This section is empty.

Functions

This section is empty.

Types

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 Logger

type Logger lg.Logger

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

func New(opts *Options) (*NSQLookupd, error)

func (*NSQLookupd) Exit

func (l *NSQLookupd) Exit()

func (*NSQLookupd) Main

func (l *NSQLookupd) Main() error

Main starts an instance of nsqlookupd and returns an error if there was a problem starting up.

func (*NSQLookupd) RealHTTPAddr

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

func (*NSQLookupd) RealTCPAddr

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

type Options

type Options struct {
	LogLevel  lg.LogLevel `flag:"log-level"`
	LogPrefix string      `flag:"log-prefix"`
	Logger    Logger

	TCPAddress       string `flag:"tcp-address"`
	HTTPAddress      string `flag:"http-address"`
	BroadcastAddress string `flag:"broadcast-address"`

	InactiveProducerTimeout time.Duration `flag:"inactive-producer-timeout"`
	TombstoneLifetime       time.Duration `flag:"tombstone-lifetime"`
}

func NewOptions

func NewOptions() *Options

type PeerInfo

type PeerInfo struct {
	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"`
	// contains filtered or unexported fields
}

type Producer

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

func (*Producer) IsTombstoned

func (p *Producer) IsTombstoned(lifetime time.Duration) bool

func (*Producer) String

func (p *Producer) String() string

func (*Producer) Tombstone

func (p *Producer) Tombstone()

type ProducerMap

type ProducerMap map[string]*Producer

type Producers

type Producers []*Producer

func ProducerMap2Slice

func ProducerMap2Slice(pm ProducerMap) Producers

func (Producers) FilterByActive

func (pp Producers) FilterByActive(inactivityTimeout time.Duration, tombstoneLifetime time.Duration) Producers

func (Producers) PeerInfo

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

type Registration

type Registration struct {
	Category string
	Key      string
	SubKey   string
}

func (Registration) IsMatch

func (k Registration) IsMatch(category string, key string, subkey string) bool

type RegistrationDB

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

func NewRegistrationDB

func NewRegistrationDB() *RegistrationDB

func (*RegistrationDB) AddProducer

func (r *RegistrationDB) AddProducer(k Registration, p *Producer) bool

add a producer to a registration

func (*RegistrationDB) AddRegistration

func (r *RegistrationDB) AddRegistration(k Registration)

add a registration key

func (*RegistrationDB) FindProducers

func (r *RegistrationDB) FindProducers(category string, key string, subkey string) Producers

func (*RegistrationDB) FindRegistrations

func (r *RegistrationDB) FindRegistrations(category string, key string, subkey string) Registrations

func (*RegistrationDB) LookupRegistrations

func (r *RegistrationDB) LookupRegistrations(id string) Registrations

func (*RegistrationDB) RemoveProducer

func (r *RegistrationDB) RemoveProducer(k Registration, id string) (bool, int)

remove a producer from a registration

func (*RegistrationDB) RemoveRegistration

func (r *RegistrationDB) RemoveRegistration(k Registration)

remove a Registration and all it's producers

type Registrations

type Registrations []Registration

func (Registrations) Filter

func (rr Registrations) Filter(category string, key string, subkey string) Registrations

func (Registrations) Keys

func (rr Registrations) Keys() []string

func (Registrations) SubKeys

func (rr Registrations) SubKeys() []string

Jump to

Keyboard shortcuts

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