Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
Hash consistently chooses a hash bucket number in the range [0, numBuckets) for the given key. numBuckets must be >= 1.
func JumpConsistentHash ¶
JumpConsistentHash selects a server by serviceMethod and args
Types ¶
type EtcdClientSelector ¶
type EtcdClientSelector struct { EtcdServers []string KeysAPI client.KeysAPI BasePath string //should endwith serviceName Servers []string SelectMode rpcx.SelectMode HashServiceAndArgs HashServiceAndArgs // contains filtered or unexported fields }
EtcdClientSelector is used to select a rpc server from etcd.
func NewEtcdClientSelector ¶
func NewEtcdClientSelector(etcdServers []string, sessionTimeout time.Duration, sm rpcx.SelectMode, timeout time.Duration) *EtcdClientSelector
NewEtcdClientSelector creates a EtcdClientSelector
func (*EtcdClientSelector) Select ¶
func (s *EtcdClientSelector) Select(clientCodecFunc rpcx.ClientCodecFunc, options ...interface{}) (*rpc.Client, error)
Select returns a rpc client
type HashServiceAndArgs ¶
HashServiceAndArgs define a hash function
type MultiClientSelector ¶
type MultiClientSelector struct { Servers []ServerPair SelectMode rpcx.SelectMode HashServiceAndArgs HashServiceAndArgs // contains filtered or unexported fields }
MultiClientSelector is used to select a direct rpc server from a list.
func NewMultiClientSelector ¶
func NewMultiClientSelector(servers []ServerPair, sm rpcx.SelectMode, timeout time.Duration) *MultiClientSelector
NewMultiClientSelector creates a MultiClientSelector
func (*MultiClientSelector) Select ¶
func (s *MultiClientSelector) Select(clientCodecFunc rpcx.ClientCodecFunc, options ...interface{}) (*rpc.Client, error)
Select returns a rpc client
type ZooKeeperClientSelector ¶
type ZooKeeperClientSelector struct { ZKServers []string BasePath string //should endwith serviceName Servers []string SelectMode rpcx.SelectMode HashServiceAndArgs HashServiceAndArgs // contains filtered or unexported fields }
ZooKeeperClientSelector is used to select a rpc server from zookeeper.
func NewZooKeeperClientSelector ¶
func NewZooKeeperClientSelector(zkServers []string, sessionTimeout time.Duration, sm rpcx.SelectMode, timeout time.Duration) *ZooKeeperClientSelector
NewZooKeeperClientSelector creates a ZooKeeperClientSelector
func (*ZooKeeperClientSelector) Select ¶
func (s *ZooKeeperClientSelector) Select(clientCodecFunc rpcx.ClientCodecFunc, options ...interface{}) (*rpc.Client, error)
Select returns a rpc client