service

package
v0.0.0-...-927e444 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NodeServerAddr

func NodeServerAddr(node *basepb.Node) string

Types

type BaseService

type BaseService struct {
	store.Store
	// contains filtered or unexported fields
}

func NewBaseService

func NewBaseService() (*BaseService, error)

func (*BaseService) AdmClient

func (ns *BaseService) AdmClient() client.AdminClient

func (*BaseService) AskSplit

func (rs *BaseService) AskSplit(ctx context.Context, rng *basepb.Range, force bool) (uint64, []uint64, error)

func (*BaseService) ChangeRangeStoreType

func (rs *BaseService) ChangeRangeStoreType(ctx context.Context, tableID int32, rangeID uint64, storeType basepb.StoreType) error

func (*BaseService) ChangeState

func (ns *BaseService) ChangeState(ctx context.Context, nodeID uint64, state basepb.NodeState) (*basepb.Node, error)

func (*BaseService) CheckState

func (ns *BaseService) CheckState(ctx context.Context, nodeID uint64) (nodeState basepb.NodeState, leaderNum, rangeNum uint64, err error)

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 (ns *BaseService) CreateRangeToNode(ctx context.Context, node *basepb.Node, old *basepb.Range) error

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) GetNode

func (ns *BaseService) GetNode(ctx context.Context, nodeID uint64) (*basepb.Node, error)

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) Heartbeat

func (rs *BaseService) Heartbeat(ctx context.Context, rg *basepb.Range) (*basepb.Range, error)

return true for update , false is not write

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) Online

func (ns *BaseService) Online(ctx context.Context, nodeID uint64) (bool, error)

func (*BaseService) PutBoolConfig

func (cs *BaseService) PutBoolConfig(ctx context.Context, key string, value bool) error

func (*BaseService) QueryAllNodes

func (bs *BaseService) QueryAllNodes(ctx context.Context) ([]*basepb.Node, error)

func (*BaseService) QueryDBByID

func (bs *BaseService) QueryDBByID(ctx context.Context, dbID int32) (int32, error)

func (*BaseService) QueryDatabases

func (bs *BaseService) QueryDatabases(ctx context.Context) ([]int32, error)

func (*BaseService) QueryNode

func (bs *BaseService) QueryNode(ctx context.Context, nodeID uint64) (*basepb.Node, 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 (bs *BaseService) QueryOnlineNodes(ctx context.Context) ([]*basepb.Node, error)

func (*BaseService) QueryRange

func (bs *BaseService) QueryRange(ctx context.Context, tableID int32, rangeID uint64) (*basepb.Range, error)

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 (ns *BaseService) RegisterNode(ctx context.Context, node *basepb.Node, rangeFingers []*mspb.RangeFingerprint) (*basepb.Node, []uint64, error)

func (*BaseService) SyncDelMember

func (ns *BaseService) SyncDelMember(ctx context.Context, old *basepb.Range, peerID uint64) error

func (*BaseService) SyncDeleteRangeToNode

func (ns *BaseService) SyncDeleteRangeToNode(ctx context.Context, old *basepb.Range, peerID uint64, removeNodeID uint64) error

func (*BaseService) TransferLeader

func (rs *BaseService) TransferLeader(ctx context.Context, node *basepb.Node, old *basepb.Range) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL