Documentation ¶
Index ¶
- Constants
- 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 HttpClient
- type NestNode
- type NestNodes
- type NestProgress
- type NestService
- type NestServices
- type Node
- type Nodes
- type ParamNode
- type ParamService
- type ParamServiceMutation
- type RpcClient
- func (s *RpcClient) ConsistentHash(key, url string) (string, error)
- func (s *RpcClient) Hash(key, url string) (string, error)
- func (s *RpcClient) Random(url string) (string, error)
- func (s *RpcClient) RoundRobin(url string) (string, error)
- func (s *RpcClient) Services(name string, state StateType) (service Service)
- type Service
- type Services
- type StateType
Constants ¶
View Source
const ( RPCGob byte = iota RPCJson )
Variables ¶
This section is empty.
Functions ¶
func NewJsonClientCodec ¶
func NewJsonClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
json client
func NewJsonServerCodec ¶
func NewJsonServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
json server
func TimeoutCoder ¶
Types ¶
type Client ¶
type HashKeyOrder ¶
type HashKeyOrder []HashKey
func (HashKeyOrder) Len ¶
func (h HashKeyOrder) Len() int
func (HashKeyOrder) Less ¶
func (h HashKeyOrder) Less(i, j int) bool
func (HashKeyOrder) Swap ¶
func (h HashKeyOrder) Swap(i, j int)
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 ¶
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 ¶
type RpcClient struct {
// contains filtered or unexported fields
}
func (*RpcClient) ConsistentHash ¶ added in v0.0.27
hashring url: http://serviceName or rpc://serviceName http url return http://ip:port rpc url only return ip:port
func (*RpcClient) Hash ¶
hash url: http://serviceName or rpc://serviceName http url return http://ip:port rpc url only return ip:port
func (*RpcClient) Random ¶ added in v0.0.27
random url: http://serviceName or rpc://serviceName http url return http://ip:port rpc url only return ip:port
func (*RpcClient) RoundRobin ¶ added in v0.0.27
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 ¶
Click to show internal directories.
Click to hide internal directories.