Documentation
¶
Index ¶
- func NewClient(address string) (*rpc.Client, error)
- func NewGobClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
- func NewGobServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
- func NewJsonClient(address string) (*rpc.Client, error)
- func NewJsonClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
- func NewJsonServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
- func TimeoutCoder(f func(interface{}) error, e interface{}, msg string) error
- type Client
- type CmdType
- type HashKey
- type HashKeyOrder
- type HashRing
- func (h *HashRing) AddNode(node string) *HashRing
- func (h *HashRing) AddWeightedNode(node string, weight int) *HashRing
- func (h *HashRing) GenKey(key string) HashKey
- func (h *HashRing) GetNode(stringKey string) (node string, ok bool)
- func (h *HashRing) GetNodePos(stringKey string) (pos int, ok bool)
- func (h *HashRing) GetNodes(stringKey string, size int) (nodes []string, ok bool)
- func (h *HashRing) RemoveNode(node string) *HashRing
- func (h *HashRing) Size() int
- func (h *HashRing) UpdateWeightedNode(node string, weight int) *HashRing
- func (h *HashRing) UpdateWithWeights(weights map[string]int)
- type HttpClient
- type NestNode
- type NestNodes
- type NestProgress
- type NestService
- type NestServices
- type Node
- type Nodes
- type ParamNode
- type ParamService
- type ParamServiceMutation
- type Progress
- type RPCType
- type RpcClient
- func (this *RpcClient) Hash(url, key string) (string, error)
- func (this *RpcClient) HashRing(url, key string) (string, error)
- func (this *RpcClient) Robin(url string) (string, error)
- func (this *RpcClient) Round(url string) (string, error)
- func (this *RpcClient) Services(name string, state StateType) (service Service)
- type Service
- type Services
- type StateType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewJsonClientCodec ¶ added in v0.0.2
func NewJsonClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
json client
func NewJsonServerCodec ¶ added in v0.0.2
func NewJsonServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
json server
func TimeoutCoder ¶
Types ¶
type Client ¶ added in v0.0.8
type Client interface {
Services(serviceName string, state StateType) Service
Robin(url string) (string, error)
Round(url string) (string, error)
Hash(url, key string) (string, error)
HashRing(url, key string) (string, error)
}
func RiffClient ¶ added in v0.0.8
url : riff://ip:port return Client
type HashKeyOrder ¶ added in v0.0.8
type HashKeyOrder []HashKey
func (HashKeyOrder) Len ¶ added in v0.0.8
func (h HashKeyOrder) Len() int
func (HashKeyOrder) Less ¶ added in v0.0.8
func (h HashKeyOrder) Less(i, j int) bool
func (HashKeyOrder) Swap ¶ added in v0.0.8
func (h HashKeyOrder) Swap(i, j int)
type HashRing ¶ added in v0.0.8
type HashRing struct {
// contains filtered or unexported fields
}
func NewWithWeights ¶ added in v0.0.8
func (*HashRing) AddWeightedNode ¶ added in v0.0.8
func (*HashRing) GetNodePos ¶ added in v0.0.8
func (*HashRing) RemoveNode ¶ added in v0.0.8
func (*HashRing) UpdateWeightedNode ¶ added in v0.0.8
func (*HashRing) UpdateWithWeights ¶ added in v0.0.8
type HttpClient ¶ added in v0.0.8
type HttpClient struct {
// contains filtered or unexported fields
}
todo
type NestNode ¶
type NestNode struct {
Name string `json:"name"`
DataCenter string `json:"dataCenter"`
IP string `json:"ip"`
Port int `json:"port,omitempty"`
RpcPort int `json:"rpcPort,omitempty"`
Version int `json:"version"`
State StateType `json:"state"`
SnapShot string `json:"snapShot,omitempty"`
IsSelf bool `json:"isSelf,omitempty"`
Config string `json:"config,omitempty"`
StatusContent string `json:"statusContent,omitempty"`
StartTime time.Time `json:"startTime,omitempty"`
Progress *NestProgress `json:"progress,omitempty"`
}
type NestProgress ¶ added in v0.0.9
type NestService ¶
type NestService struct {
Name string `json:"name"`
IP string `json:"ip"`
Port int `json:"port,omitempty"`
State StateType `json:"state,omitempty"`
Config string `json:"config,omitempty"`
StatusContent string `json:"statusContent,omitempty"`
StartTime time.Time `json:"startTime,omitempty"`
Progress *NestProgress `json:"progress,omitempty"`
}
type NestServices ¶
type NestServices []*NestService
type Node ¶
type Node struct {
Name string `json:"name"`
DataCenter string `json:"dataCenter"`
IP string `json:"ip"`
RpcPort int `json:"rpcPort,omitempty"`
HttpPort int `json:"httpPort,omitempty"`
Version int `json:"version"`
State StateType `json:"state"`
SnapShot string `json:"snapShot,omitempty"`
IsSelf bool `json:"isSelf,omitempty"`
NestServices `json:"services,omitempty"`
}
type ParamService ¶
type ParamServiceMutation ¶
type RpcClient ¶ added in v0.0.8
type RpcClient struct {
// contains filtered or unexported fields
}
func (*RpcClient) Hash ¶ added in v0.0.8
hash url: http://serviceName or rpc://serviceName http url return http://ip:port rpc url only return ip:port
func (*RpcClient) HashRing ¶ added in v0.0.8
hashring url: http://serviceName or rpc://serviceName http url return http://ip:port rpc url only return ip:port
func (*RpcClient) Robin ¶ added in v0.0.8
robin url: http://serviceName or rpc://serviceName http url return http://ip:port rpc url only return ip:port
func (*RpcClient) Round ¶ added in v0.0.8
round url: http://serviceName or rpc://serviceName http url return http://ip:port rpc url only return ip:port
type StateType ¶
type StateType int
const ( StateAlive StateType = 1 << iota StateSuspect StateDead StateAll = StateAlive | StateSuspect | StateDead )
func StateType_FromName ¶ added in v0.0.5
Click to show internal directories.
Click to hide internal directories.