Documentation ¶
Index ¶
- func FormatDate(date int64) string
- func GetNodeStats(perfClient *aggregate.PerfClient) (map[string]*aggregate.NodeStat, error)
- func GetPartitionStat(perfSession *aggregate.PerfSession, counter string) map[string]float64
- func SortStructsByField(structs []interface{}, key string)
- func Str2Gpid(gpid string) (*base.Gpid, error)
- type PegasusNode
- type PegasusNodeManager
- func (m *PegasusNodeManager) GetAllNodes(ntype session.NodeType) []*PegasusNode
- func (m *PegasusNodeManager) GetNode(addr string, ntype session.NodeType) (*PegasusNode, error)
- func (m *PegasusNodeManager) GetPerfSession(addr string, ntype session.NodeType) *aggregate.PerfSession
- func (m *PegasusNodeManager) MustGetReplica(addr string) *PegasusNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDate ¶
func GetNodeStats ¶
GetNodeStats returns a mapping of [node address => node stats]
func GetPartitionStat ¶
func GetPartitionStat(perfSession *aggregate.PerfSession, counter string) map[string]float64
func SortStructsByField ¶
func SortStructsByField(structs []interface{}, key string)
Types ¶
type PegasusNode ¶
type PegasusNode struct { IP net.IP Port int Hostname string Type session.NodeType // contains filtered or unexported fields }
PegasusNode is a representation of MetaServer and ReplicaServer. Compared to session.NodeSession, it extends with more detailed information.
func NewNodeFromTCPAddr ¶
func NewNodeFromTCPAddr(addr string, ntype session.NodeType) *PegasusNode
NewNodeFromTCPAddr creates a node from tcp address. NOTE:
- Will not initialize TCP connection unless needed.
- Should not be called too frequently because it costs 1 DNS resolution.
func (*PegasusNode) CombinedAddr ¶
func (n *PegasusNode) CombinedAddr() string
CombinedAddr returns a string combining with tcp address and hostname.
func (*PegasusNode) RPCAddress ¶
func (n *PegasusNode) RPCAddress() *base.RPCAddress
func (*PegasusNode) Replica ¶
func (n *PegasusNode) Replica() *session.ReplicaSession
Replica returns a ReplicaSession if this node is a ReplicaServer. Will initialize the TCP connection.
func (*PegasusNode) Session ¶
func (n *PegasusNode) Session() session.NodeSession
Session returns a tcp session to the node. Will initialize the TCP connection.
func (*PegasusNode) String ¶
func (n *PegasusNode) String() string
func (*PegasusNode) TCPAddr ¶
func (n *PegasusNode) TCPAddr() string
TCPAddr returns the tcp address of the node
type PegasusNodeManager ¶
type PegasusNodeManager struct { // filled on initialization, won't be updated after that. MetaAddresses []string // contains filtered or unexported fields }
PegasusNodeManager manages the sessions of all types of Pegasus node.
func NewPegasusNodeManager ¶
func NewPegasusNodeManager(metaAddrs []string, replicaAddrs []string) *PegasusNodeManager
NewPegasusNodeManager creates a PegasusNodeManager.
func (*PegasusNodeManager) GetAllNodes ¶
func (m *PegasusNodeManager) GetAllNodes(ntype session.NodeType) []*PegasusNode
GetAllNodes returns all nodes that matches the type. The result could be inconsistent with the latest cluster state. Please use MetaManager.ListNodes whenever possible.
func (*PegasusNodeManager) GetNode ¶
func (m *PegasusNodeManager) GetNode(addr string, ntype session.NodeType) (*PegasusNode, error)
GetNode returns the specified node if it exists.
func (*PegasusNodeManager) GetPerfSession ¶
func (m *PegasusNodeManager) GetPerfSession(addr string, ntype session.NodeType) *aggregate.PerfSession
func (*PegasusNodeManager) MustGetReplica ¶
func (m *PegasusNodeManager) MustGetReplica(addr string) *PegasusNode
MustGetReplica returns a replica node even if it doens't exist before. User should assure the validity of the given info.