Documentation ¶
Index ¶
- Constants
- func IsInherited(perm int) bool
- func IsReadable(perm int) bool
- func IsWritable(perm int) bool
- func PermToString(perm int) string
- func SortBrokerData(d []*Broker)
- func SortTopicQueue(q []*TopicQueue)
- type Broker
- type ClusterInfo
- type TopicQueue
- type TopicRouter
- type TopicRouterTable
- func (t *TopicRouterTable) Delete(topic string) *TopicRouter
- func (t *TopicRouterTable) Get(topic string) *TopicRouter
- func (t *TopicRouterTable) Put(topic string, router *TopicRouter) *TopicRouter
- func (t *TopicRouterTable) Routers() []*TopicRouter
- func (t *TopicRouterTable) String() string
- func (t *TopicRouterTable) Topics() []string
Constants ¶
const ( PermInherit = 1 << iota PermWrite PermRead PermPriority )
Variables ¶
This section is empty.
Functions ¶
func IsInherited ¶
func IsReadable ¶
func IsWritable ¶
func PermToString ¶
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) SelectAddress ¶
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.
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 ¶
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