Documentation ¶
Index ¶
- Constants
- func EtcdKeyReplica(prettyQInstance string, sharding string, replica string) string
- func EtcdKeyReplicaLeader(prettyQInstance string, sharding string) string
- func EtcdKeyReplicaSet(prettyQInstance string, sharding string) string
- func EtcdKeyShardingAll(prettyQInstance string) string
- func EtcdKeyTopic(prettyQInstance string, topic string) string
- func EtcdKeyTopicAll(prettyQInstance string) string
- type EtcdClient
- func (m *EtcdClient) Close()
- func (m *EtcdClient) ElectReplicaLeader(sharding string, previousLeader string, voteLeader string, ...) (success bool, newLeader string, e error)
- func (m *EtcdClient) GetShardings(timeout time.Duration) ([]*EtcdReplica, error)
- func (m *EtcdClient) GetTopics(timeout time.Duration) ([]*EtcdTopic, error)
- type EtcdInstance
- type EtcdReplica
- type EtcdTopic
Constants ¶
View Source
const ( ETCD_BASE = "pretty-q" ETCD_TOPIC = "topic" ETCD_SHARDING = "sharding" ETCD_REPLICA_SET = "replica-set" ETCD_REPLICA_LEADER = "leader" ETCD_REPLICA = "replica" )
Variables ¶
This section is empty.
Functions ¶
func EtcdKeyReplica ¶
func EtcdKeyReplicaLeader ¶
func EtcdKeyReplicaSet ¶
func EtcdKeyShardingAll ¶
func EtcdKeyTopic ¶
func EtcdKeyTopicAll ¶
Types ¶
type EtcdClient ¶
type EtcdClient struct {
// contains filtered or unexported fields
}
etcd客户端,用于查询和更新etcd中pretty-q的元数据,以及实现replica set leader选举等
func NewEtcdClient ¶
func (*EtcdClient) Close ¶
func (m *EtcdClient) Close()
func (*EtcdClient) ElectReplicaLeader ¶
func (m *EtcdClient) ElectReplicaLeader(sharding string, previousLeader string, voteLeader string, timeout time.Duration) (success bool, newLeader string, e error)
对某个sharding的副本集进行leader选举,抢占式先到先得
func (*EtcdClient) GetShardings ¶
func (m *EtcdClient) GetShardings(timeout time.Duration) ([]*EtcdReplica, error)
获取所有的sharding server信息,其中server地址为副本集中leader的地址
type EtcdInstance ¶
type EtcdInstance struct { Name string //prettyQ instance name TopicList []string //topic list ShardingList []string //sharding list }
考虑到多个prettyQ实例使用同一个etcd服务,因此通过instance来区分不同的prettyQ集群
type EtcdReplica ¶
Click to show internal directories.
Click to hide internal directories.