Version: v1.1.4 Latest Latest

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

Go to latest
Published: Dec 25, 2020 License: GPL-3.0 Imports: 16 Imported by: 0




This section is empty.


This section is empty.


func MockGetClient

func MockGetClient(t *testing.T, svrConn string) (*xrpc.Client, func())

xrpc client

func MockWaitLeaderEggs

func MockWaitLeaderEggs(servers []*Server, leadernums int)

wait the leader eggs when leadernums >0 if leadernums == 0, we just want to sleep for a heartbeat broadcast


type NodeRPC

type NodeRPC struct {
	// contains filtered or unexported fields

func (*NodeRPC) AddIdleNodes added in v1.0.9

func (n *NodeRPC) AddIdleNodes(req *model.NodeRPCRequest, rsp *model.NodeRPCResponse) error

func (*NodeRPC) AddNodes

func (n *NodeRPC) AddNodes(req *model.NodeRPCRequest, rsp *model.NodeRPCResponse) error

func (*NodeRPC) GetNodes

func (n *NodeRPC) GetNodes(req *model.NodeRPCRequest, rsp *model.NodeRPCResponse) error

func (*NodeRPC) RemoveIdleNodes added in v1.0.9

func (n *NodeRPC) RemoveIdleNodes(req *model.NodeRPCRequest, rsp *model.NodeRPCResponse) error

func (*NodeRPC) RemoveNodes

func (n *NodeRPC) RemoveNodes(req *model.NodeRPCRequest, rsp *model.NodeRPCResponse) error

type RPCS

type RPCS struct {
	NodeRPC   *NodeRPC
	ServerRPC *ServerRPC
	UserRPC   *UserRPC
	HARPC     *raft.HARPC
	RaftRPC   *raft.RaftRPC
	MysqldRPC *mysqld.MysqldRPC
	BackupRPC *mysqld.BackupRPC
	MysqlRPC  *mysql.MysqlRPC

type Server

type Server struct {
	// contains filtered or unexported fields

func MockServers

func MockServers(log *xlog.Log, port int, count int) ([]*Server, func())

func NewServer

func NewServer(conf *config.Config, log *xlog.Log) *Server

func (*Server) Address

func (s *Server) Address() string

func (*Server) GetNodeRPC

func (s *Server) GetNodeRPC() *NodeRPC

func (*Server) GetServerRPC

func (s *Server) GetServerRPC() *ServerRPC

func (*Server) GetState

func (s *Server) GetState() raft.State

func (*Server) GetUserRPC

func (s *Server) GetUserRPC() *UserRPC

func (*Server) Init

func (s *Server) Init()

func (*Server) Shutdown

func (s *Server) Shutdown()

func (*Server) Start

func (s *Server) Start()

start rpc-raft and event&&state-loop

func (*Server) Wait

func (s *Server) Wait()

waits for os signal

type ServerRPC

type ServerRPC struct {
	// contains filtered or unexported fields

func (*ServerRPC) Ping

check the server connection whether OK

func (*ServerRPC) Status

type UserRPC

type UserRPC struct {
	// contains filtered or unexported fields

func (*UserRPC) ChangePasword

func (u *UserRPC) ChangePasword(req *model.MysqlUserRPCRequest, rsp *model.MysqlUserRPCResponse) error

change password

func (*UserRPC) CreateNormalUser

func (u *UserRPC) CreateNormalUser(req *model.MysqlUserRPCRequest, rsp *model.MysqlUserRPCResponse) error

CreateNormalUser used to create a normal user.

func (*UserRPC) CreateSuperUser

func (u *UserRPC) CreateSuperUser(req *model.MysqlUserRPCRequest, rsp *model.MysqlUserRPCResponse) error

CreateSuperUser used to create a admin user with all grants.

func (*UserRPC) CreateUserWithPrivileges

func (u *UserRPC) CreateUserWithPrivileges(req *model.MysqlUserRPCRequest, rsp *model.MysqlUserRPCResponse) error

CreateUserWithPrivileges creates user with privileges. This is used to create normal user.

func (*UserRPC) DropUser

drop user

func (*UserRPC) GetUser

GetUser get mysql user list

Jump to

Keyboard shortcuts

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