Documentation ¶
Index ¶
- func NodeServerAddr(node *basepb.Node) string
- type BaseService
- func (ns *BaseService) AdmClient() client.AdminClient
- func (rs *BaseService) AskSplit(ctx context.Context, rng *basepb.Range, force bool) (uint64, []uint64, error)
- func (rs *BaseService) ChangeRangeStoreType(ctx context.Context, tableID int32, rangeID uint64, storeType basepb.StoreType) error
- func (ns *BaseService) ChangeState(ctx context.Context, nodeID uint64, state basepb.NodeState) (*basepb.Node, error)
- func (ns *BaseService) CheckState(ctx context.Context, nodeID uint64) (nodeState basepb.NodeState, leaderNum, rangeNum uint64, err error)
- func (cs *BaseService) ConfigAutoSplit(ctx context.Context) bool
- func (cs *BaseService) ConfigBalanced(ctx context.Context) bool
- func (cs *BaseService) ConfigFailOver(ctx context.Context) bool
- func (ns *BaseService) CreateRangeToNode(ctx context.Context, node *basepb.Node, old *basepb.Range) error
- func (cs *BaseService) CreateRanges(ctx context.Context, req *mspb.CreateRangesRequest) error
- func (cs *BaseService) DeleteRanges(ctx context.Context, req *mspb.DeleteRangesRequest) error
- func (ns *BaseService) DsClient() client.SchClient
- func (ns *BaseService) GetNode(ctx context.Context, nodeID uint64) (*basepb.Node, error)
- func (rs *BaseService) GetRoute(ctx context.Context, max int, dbID, tableID int32, key []byte, hasAll bool) ([]*basepb.Range, error)
- func (rs *BaseService) Heartbeat(ctx context.Context, rg *basepb.Range) (*basepb.Range, error)
- func (ns *BaseService) NodeHeartbeat(ctx context.Context, nodeID uint64) error
- func (bs *BaseService) NodeInfo(ctx context.Context, node *basepb.Node) (*dspb.NodeInfoResponse, error)
- func (ns *BaseService) Online(ctx context.Context, nodeID uint64) (bool, error)
- func (cs *BaseService) PutBoolConfig(ctx context.Context, key string, value bool) error
- func (bs *BaseService) QueryAllNodes(ctx context.Context) ([]*basepb.Node, error)
- func (bs *BaseService) QueryDBByID(ctx context.Context, dbID int32) (int32, error)
- func (bs *BaseService) QueryDatabases(ctx context.Context) ([]int32, error)
- func (bs *BaseService) QueryNode(ctx context.Context, nodeID uint64) (*basepb.Node, error)
- func (ps *BaseService) QueryNodeHandlerMap(ctx context.Context, targetNode map[uint64]bool) (map[uint64]*basepb.Node, map[uint64]*NodeHandler, error)
- func (bs *BaseService) QueryOnlineNodes(ctx context.Context) ([]*basepb.Node, error)
- func (bs *BaseService) QueryRange(ctx context.Context, tableID int32, rangeID uint64) (*basepb.Range, error)
- func (bs *BaseService) QueryRanges(ctx context.Context, tableID, indexID int32) ([]*basepb.Range, error)
- func (bs *BaseService) QueryTableByID(ctx context.Context, dbID, tableID int32) (*entity.TableRecord, error)
- func (bs *BaseService) QueryTablesByDBID(ctx context.Context, dbID int32) ([]*entity.TableRecord, error)
- func (ns *BaseService) RegisterNode(ctx context.Context, node *basepb.Node, rangeFingers []*mspb.RangeFingerprint) (*basepb.Node, []uint64, error)
- func (ns *BaseService) SyncDelMember(ctx context.Context, old *basepb.Range, peerID uint64) error
- func (ns *BaseService) SyncDeleteRangeToNode(ctx context.Context, old *basepb.Range, peerID uint64, removeNodeID uint64) error
- func (rs *BaseService) TransferLeader(ctx context.Context, node *basepb.Node, old *basepb.Range) error
- type NodeHandler
- type NodeHandlerMap
- type RangeHandler
- func (rh *RangeHandler) CanChangeLeader(handlerMap NodeHandlerMap) error
- func (rh *RangeHandler) CanCreateRange(handlerMap NodeHandlerMap) error
- func (rh *RangeHandler) CanDeleteRange(handlerMap NodeHandlerMap) error
- func (rh *RangeHandler) Compare(o *RangeHandler) int
- func (rh RangeHandler) MaxNumberPeer(nMap NodeHandlerMap) (*basepb.Peer, error)
- func (rh RangeHandler) MinNumberPeer(nMap NodeHandlerMap) (*basepb.Peer, error)
- func (rh *RangeHandler) VersionEqual(to *RangeHandler) bool
- type WatcherService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NodeServerAddr ¶
Types ¶
type BaseService ¶
func NewBaseService ¶
func NewBaseService() (*BaseService, error)
func (*BaseService) AdmClient ¶
func (ns *BaseService) AdmClient() client.AdminClient
func (*BaseService) ChangeRangeStoreType ¶
func (*BaseService) ChangeState ¶
func (*BaseService) CheckState ¶
func (*BaseService) ConfigAutoSplit ¶
func (cs *BaseService) ConfigAutoSplit(ctx context.Context) bool
func (*BaseService) ConfigBalanced ¶
func (cs *BaseService) ConfigBalanced(ctx context.Context) bool
func (*BaseService) ConfigFailOver ¶
func (cs *BaseService) ConfigFailOver(ctx context.Context) bool
func (*BaseService) CreateRangeToNode ¶
func (*BaseService) CreateRanges ¶
func (cs *BaseService) CreateRanges(ctx context.Context, req *mspb.CreateRangesRequest) error
new services..........................................................................................................................................
func (*BaseService) DeleteRanges ¶
func (cs *BaseService) DeleteRanges(ctx context.Context, req *mspb.DeleteRangesRequest) error
func (*BaseService) DsClient ¶
func (ns *BaseService) DsClient() client.SchClient
func (*BaseService) GetRoute ¶
func (rs *BaseService) GetRoute(ctx context.Context, max int, dbID, tableID int32, key []byte, hasAll bool) ([]*basepb.Range, error)
if tableID ==0 it will return all ranges
func (*BaseService) NodeHeartbeat ¶
func (ns *BaseService) NodeHeartbeat(ctx context.Context, nodeID uint64) error
func (*BaseService) NodeInfo ¶
func (bs *BaseService) NodeInfo(ctx context.Context, node *basepb.Node) (*dspb.NodeInfoResponse, error)
func (*BaseService) PutBoolConfig ¶
func (*BaseService) QueryAllNodes ¶
func (*BaseService) QueryDBByID ¶
func (*BaseService) QueryDatabases ¶
func (bs *BaseService) QueryDatabases(ctx context.Context) ([]int32, error)
func (*BaseService) QueryNodeHandlerMap ¶
func (ps *BaseService) QueryNodeHandlerMap(ctx context.Context, targetNode map[uint64]bool) (map[uint64]*basepb.Node, map[uint64]*NodeHandler, error)
only get target node , if targetNode is nil , return all
func (*BaseService) QueryOnlineNodes ¶
func (*BaseService) QueryRange ¶
func (*BaseService) QueryRanges ¶
func (bs *BaseService) QueryRanges(ctx context.Context, tableID, indexID int32) ([]*basepb.Range, error)
if tableID ==0 it will return all ranges , if table not exist it not return any error
func (*BaseService) QueryTableByID ¶
func (bs *BaseService) QueryTableByID(ctx context.Context, dbID, tableID int32) (*entity.TableRecord, error)
func (*BaseService) QueryTablesByDBID ¶
func (bs *BaseService) QueryTablesByDBID(ctx context.Context, dbID int32) ([]*entity.TableRecord, error)
func (*BaseService) RegisterNode ¶
func (*BaseService) SyncDelMember ¶
func (*BaseService) SyncDeleteRangeToNode ¶
func (*BaseService) TransferLeader ¶
type NodeHandler ¶
type NodeHandler struct { *basepb.Node RangeHanders map[uint64]*RangeHandler Stats *dspb.NodeStats RangeNum int LeaderNum int OutSnapshot int InSnapshot int }
func (*NodeHandler) CheckMemory ¶
func (nh *NodeHandler) CheckMemory() error
func (*NodeHandler) GetRH ¶
func (nh *NodeHandler) GetRH(rangeID uint64) *RangeHandler
func (*NodeHandler) GetRangeHandler ¶
func (nh *NodeHandler) GetRangeHandler(rangeID uint64) (*RangeHandler, error)
type NodeHandlerMap ¶
type NodeHandlerMap map[uint64]*NodeHandler
func (NodeHandlerMap) MinArriveNodeByRange ¶
func (maps NodeHandlerMap) MinArriveNodeByRange(storeType basepb.StoreType, rng *basepb.Range) (result *NodeHandler, err error)
find can arrive min range number node
func (NodeHandlerMap) SortLeadersNum ¶
func (maps NodeHandlerMap) SortLeadersNum(storeType basepb.StoreType) []*NodeHandler
func (NodeHandlerMap) SortRangesByType ¶
func (maps NodeHandlerMap) SortRangesByType(storeType basepb.StoreType) []*NodeHandler
type RangeHandler ¶
type RangeHandler struct { *basepb.Range IsLeader bool Peer *basepb.Peer PeersStatus []*basepb.PeerStatus Status *dspb.RangeStats Term uint64 }
func (*RangeHandler) CanChangeLeader ¶
func (rh *RangeHandler) CanChangeLeader(handlerMap NodeHandlerMap) error
func (*RangeHandler) CanCreateRange ¶
func (rh *RangeHandler) CanCreateRange(handlerMap NodeHandlerMap) error
func (*RangeHandler) CanDeleteRange ¶
func (rh *RangeHandler) CanDeleteRange(handlerMap NodeHandlerMap) error
func (*RangeHandler) Compare ¶
func (rh *RangeHandler) Compare(o *RangeHandler) int
func (RangeHandler) MaxNumberPeer ¶
func (rh RangeHandler) MaxNumberPeer(nMap NodeHandlerMap) (*basepb.Peer, error)
func (RangeHandler) MinNumberPeer ¶
func (rh RangeHandler) MinNumberPeer(nMap NodeHandlerMap) (*basepb.Peer, error)
func (*RangeHandler) VersionEqual ¶
func (rh *RangeHandler) VersionEqual(to *RangeHandler) bool
type WatcherService ¶
type WatcherService struct {
// contains filtered or unexported fields
}
func NewWatcherService ¶
func NewWatcherService(service *BaseService) *WatcherService
func (*WatcherService) Cancel ¶
func (ws *WatcherService) Cancel()
func (*WatcherService) StartWatcher ¶
func (ws *WatcherService) StartWatcher()
func (*WatcherService) Version ¶
func (ws *WatcherService) Version() uint64
func (*WatcherService) Watcher ¶
func (ws *WatcherService) Watcher(ctx context.Context, version uint64) []*basepb.WatcherEvent
Click to show internal directories.
Click to hide internal directories.