route

package
v0.0.0-...-693787e Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermInherit = 1 << iota
	PermWrite
	PermRead
	PermPriority
)

Variables

This section is empty.

Functions

func IsInherited

func IsInherited(perm int) bool

func IsReadable

func IsReadable(perm int) bool

func IsWritable

func IsWritable(perm int) bool

func PermToString

func PermToString(perm int) string

func SortBrokerData

func SortBrokerData(d []*Broker)

SortBrokerData sort the Broker slice by broker name

func SortTopicQueue

func SortTopicQueue(q []*TopicQueue)

SortTopicQueue sort the queues of topic by broker name

Types

type Broker

type Broker struct {
	Cluster   string           `json:"cluster"`
	Name      string           `json:"brokerName"`
	Addresses map[int32]string `json:"brokerAddrs"`
}

Broker describes broker

func (*Broker) Equal

func (b *Broker) Equal(o *Broker) bool

Equal compares with other broker

func (*Broker) SelectAddress

func (b *Broker) SelectAddress() string

SelectAddress selects a (preferably master) broker address from the registered list. If the master's address cannot be found, a slave broker address is selected in a random manner.

func (*Broker) String

func (b *Broker) String() string

type ClusterInfo

type ClusterInfo struct {
	BrokerAddr  map[string]*Broker  `json:"brokerAddrTable"`  // key:broker name
	ClusterAddr map[string][]string `json:"clusterAddrTable"` // key:cluster name, value:broker name
}

ClusterInfo the cluster address information

func (*ClusterInfo) String

func (c *ClusterInfo) String() string

type TopicQueue

type TopicQueue struct {
	BrokerName string `json:"brokerName"`
	ReadCount  int    `json:"readQueueNums"`
	WriteCount int    `json:"writeQueueNums"`
	Perm       int    `json:"perm"`
	SyncFlag   int    `json:"topicSynFlag"`
}

TopicQueue the topic queue information in the broker

func (*TopicQueue) Equal

func (tq *TopicQueue) Equal(o *TopicQueue) bool

Equal judge equals with other topic queue

func (*TopicQueue) String

func (tq *TopicQueue) String() string

type TopicRouter

type TopicRouter struct {
	OrderTopicConf string              `json:"orderTopicConf"`
	Queues         []*TopicQueue       `json:"queueDatas"`
	Brokers        []*Broker           `json:"brokerDatas"`
	FilterServer   map[string][]string `json:"filterServerTable"`
}

TopicRouter topic route information NOTE: donot modified directly

func (*TopicRouter) Equal

func (t *TopicRouter) Equal(o *TopicRouter) bool

Equal judge equals with other topic route information

func (*TopicRouter) String

func (t *TopicRouter) String() string

type TopicRouterTable

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

TopicRouterTable contains routers of topic

func NewTopicRouterTable

func NewTopicRouterTable() *TopicRouterTable

NewTopicRouterTable creates topic's router table, the operations are thread-safe

func (*TopicRouterTable) Delete

func (t *TopicRouterTable) Delete(topic string) *TopicRouter

Delete deletes routers of topic

func (*TopicRouterTable) Get

func (t *TopicRouterTable) Get(topic string) *TopicRouter

Get get the routers of topic

func (*TopicRouterTable) Put

func (t *TopicRouterTable) Put(topic string, router *TopicRouter) *TopicRouter

Put stores routers of topic

func (*TopicRouterTable) Routers

func (t *TopicRouterTable) Routers() []*TopicRouter

Routers return all the routers

func (*TopicRouterTable) String

func (t *TopicRouterTable) String() string

func (*TopicRouterTable) Topics

func (t *TopicRouterTable) Topics() []string

Topics return all the topics

Jump to

Keyboard shortcuts

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