Documentation ¶
Index ¶
- type Connection
- func (conn *Connection) Close() error
- func (conn *Connection) GetClient() ultipa.UltipaRpcsClient
- func (conn *Connection) GetControlClient() ultipa.UltipaControlsClient
- func (conn *Connection) HasRole(role ultipa.FollowerRole) bool
- func (conn *Connection) SetRole(role ultipa.FollowerRole)
- func (conn *Connection) SetRoleFromInt32(role int32)
- type ConnectionPool
- func (pool *ConnectionPool) Close() error
- func (pool *ConnectionPool) CreateConnections() error
- func (pool *ConnectionPool) ForceRefreshClusterInfo(graphName string) error
- func (pool *ConnectionPool) GetAnalyticsConn(config *configuration.UltipaConfig) (*Connection, error)
- func (pool *ConnectionPool) GetConn(config *configuration.UltipaConfig) (*Connection, error)
- func (pool *ConnectionPool) GetGlobalMasterConn(config *configuration.UltipaConfig) (*Connection, error)
- func (pool *ConnectionPool) GetMasterConn(config *configuration.UltipaConfig) (*Connection, error)
- func (pool *ConnectionPool) GetRandomConn(config *configuration.UltipaConfig) (*Connection, error)
- func (pool *ConnectionPool) NewContext(config *configuration.RequestConfig) (ctx context.Context, cancel context.CancelFunc, err error)
- func (pool *ConnectionPool) RefreshActives() error
- func (pool *ConnectionPool) RefreshActivesWithSeconds(seconds int32) error
- func (pool *ConnectionPool) RefreshClusterInfo(graphName string) error
- func (pool *ConnectionPool) RunHeartBeat()
- func (pool *ConnectionPool) SetMasterConn(graphName string, conn *Connection)
- type GraphClusterInfo
- type GraphManager
- func (gm *GraphManager) AddFollower(graphName string, conn *Connection)
- func (gm *GraphManager) AddGraph(graphName string)
- func (gm *GraphManager) ClearFollower(graphName string)
- func (gm *GraphManager) DeleteGraph(graphName string)
- func (gm *GraphManager) GetGraph(graphName string) *GraphClusterInfo
- func (gm *GraphManager) GetLeader(graphName string) *Connection
- func (gm *GraphManager) SetLeader(graphName string, conn *Connection)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { Host string Conn *grpc.ClientConn Client ultipa.UltipaRpcsClient Config *configuration.UltipaConfig Role ultipa.FollowerRole // leader, follower, learner, candidate ... Active ultipa.ServerStatus }
func NewConnection ¶
func NewConnection(host string, config *configuration.UltipaConfig) (*Connection, error)
func (*Connection) Close ¶
func (conn *Connection) Close() error
func (*Connection) GetClient ¶
func (conn *Connection) GetClient() ultipa.UltipaRpcsClient
func (*Connection) GetControlClient ¶
func (conn *Connection) GetControlClient() ultipa.UltipaControlsClient
func (*Connection) HasRole ¶
func (conn *Connection) HasRole(role ultipa.FollowerRole) bool
func (*Connection) SetRole ¶
func (conn *Connection) SetRole(role ultipa.FollowerRole)
func (*Connection) SetRoleFromInt32 ¶
func (conn *Connection) SetRoleFromInt32(role int32)
type ConnectionPool ¶
type ConnectionPool struct { GraphMgr *GraphManager // graph name : ClusterInfo Config *configuration.UltipaConfig Connections map[string]*Connection // Host : Connection RandomTick int Actives []*Connection LastActivesTime time.Time IsRaft bool // contains filtered or unexported fields }
handle all connections
func NewConnectionPool ¶
func NewConnectionPool(config *configuration.UltipaConfig) (*ConnectionPool, error)
func (*ConnectionPool) Close ¶
func (pool *ConnectionPool) Close() error
func (*ConnectionPool) CreateConnections ¶
func (pool *ConnectionPool) CreateConnections() error
func (*ConnectionPool) ForceRefreshClusterInfo ¶
func (pool *ConnectionPool) ForceRefreshClusterInfo(graphName string) error
func (*ConnectionPool) GetAnalyticsConn ¶
func (pool *ConnectionPool) GetAnalyticsConn(config *configuration.UltipaConfig) (*Connection, error)
Get Task/Analytics client
func (*ConnectionPool) GetConn ¶
func (pool *ConnectionPool) GetConn(config *configuration.UltipaConfig) (*Connection, error)
Get client by global config
func (*ConnectionPool) GetGlobalMasterConn ¶
func (pool *ConnectionPool) GetGlobalMasterConn(config *configuration.UltipaConfig) (*Connection, error)
Get Master of Global Graph
func (*ConnectionPool) GetMasterConn ¶
func (pool *ConnectionPool) GetMasterConn(config *configuration.UltipaConfig) (*Connection, error)
Get master client
func (*ConnectionPool) GetRandomConn ¶
func (pool *ConnectionPool) GetRandomConn(config *configuration.UltipaConfig) (*Connection, error)
Get random client
func (*ConnectionPool) NewContext ¶
func (pool *ConnectionPool) NewContext(config *configuration.RequestConfig) (ctx context.Context, cancel context.CancelFunc, err error)
set context with timeout and auth info
func (*ConnectionPool) RefreshActives ¶
func (pool *ConnectionPool) RefreshActives() error
更新查看哪些连接还有效
func (*ConnectionPool) RefreshActivesWithSeconds ¶
func (pool *ConnectionPool) RefreshActivesWithSeconds(seconds int32) error
func (*ConnectionPool) RefreshClusterInfo ¶
func (pool *ConnectionPool) RefreshClusterInfo(graphName string) error
sync cluster info from server
func (*ConnectionPool) RunHeartBeat ¶
func (pool *ConnectionPool) RunHeartBeat()
RunHeartBeat used for special network policy for long connection(such like : force disconnection idle socket)
func (*ConnectionPool) SetMasterConn ¶
func (pool *ConnectionPool) SetMasterConn(graphName string, conn *Connection)
SetMasterConn (graphName , *conn) Set master client
type GraphClusterInfo ¶
type GraphClusterInfo struct { Graph string Leader *Connection Followers []*Connection Algos []*Connection LastAlgoIndex int //记录上次使用的 Task 节点索引 }
func (*GraphClusterInfo) GetAnalyticConn ¶
func (gci *GraphClusterInfo) GetAnalyticConn() (*Connection, error)
func (*GraphClusterInfo) HasConn ¶
func (gci *GraphClusterInfo) HasConn(_conn *Connection) bool
type GraphManager ¶
type GraphManager struct {
// contains filtered or unexported fields
}
func NewGraphManager ¶
func NewGraphManager() *GraphManager
func (*GraphManager) AddFollower ¶
func (gm *GraphManager) AddFollower(graphName string, conn *Connection)
func (*GraphManager) AddGraph ¶
func (gm *GraphManager) AddGraph(graphName string)
func (*GraphManager) ClearFollower ¶
func (gm *GraphManager) ClearFollower(graphName string)
func (*GraphManager) DeleteGraph ¶
func (gm *GraphManager) DeleteGraph(graphName string)
func (*GraphManager) GetGraph ¶
func (gm *GraphManager) GetGraph(graphName string) *GraphClusterInfo
func (*GraphManager) GetLeader ¶
func (gm *GraphManager) GetLeader(graphName string) *Connection
func (*GraphManager) SetLeader ¶
func (gm *GraphManager) SetLeader(graphName string, conn *Connection)
Click to show internal directories.
Click to hide internal directories.