Documentation ¶
Index ¶
- Constants
- Variables
- func GetClusterNodeOK(nCluster uint64) bool
- func Init()
- func NewDiskKV(clusterID uint64, nodeID uint64, s *server.Server, p *StartRun) sm.IOnDiskStateMachine
- func ReraftInit(s *server.Server, port string) error
- type ClusterInfo
- type DLog
- func (l *DLog) Debugf(format string, args ...interface{})
- func (l *DLog) Errorf(format string, args ...interface{})
- func (l *DLog) Infof(format string, args ...interface{})
- func (l *DLog) Panicf(format string, args ...interface{})
- func (l *DLog) SetLevel(logger.LogLevel)
- func (l *DLog) Warningf(format string, args ...interface{})
- type DiskKV
- func (pD *DiskKV) Close() error
- func (pD *DiskKV) GetHash() (uint64, error)
- func (pD *DiskKV) Lookup(key interface{}) (interface{}, error)
- func (pD *DiskKV) OnDisk() bool
- func (pD *DiskKV) Open(stopc <-chan struct{}) (uint64, uint64, error)
- func (pD *DiskKV) PrepareSnapshot() (interface{}, error)
- func (pD *DiskKV) RecoverFromSnapshot(r io.Reader, done <-chan struct{}) error
- func (pD *DiskKV) SaveSnapshot(ctx interface{}, w io.Writer, done <-chan struct{}) error
- func (pD *DiskKV) Sync() error
- func (pD *DiskKV) Update(es []sm.Entry) ([]sm.Entry, error)
- type Membership
- type MembershipV2
- type NodeHostInfo
- type NodeHostInfoV2
- type NodeInfo
- type QData
- type Queue
- type RetType
- type StartRun
- func (p *StartRun) AddNode(nodeId uint64, address string, retryTime int) (RetType, error)
- func (p *StartRun) AddObserver(nodeId uint64, address string) (RetType, error)
- func (p *StartRun) AddWitness(nodeId uint64, address string) (RetType, error)
- func (p *StartRun) Clean() error
- func (p *StartRun) DelNode(nodeId uint64, retryTime int) (RetType, error)
- func (p *StartRun) FullSync() error
- func (p *StartRun) GetClusterMembership() (string, RetType, error)
- func (p *StartRun) GetLeaderId() (uint64, RetType, error)
- func (p *StartRun) GetNodeHostInfo() (string, RetType, error)
- func (p *StartRun) GetOK() (bool, RetType, error)
- func (p *StartRun) LeaderTransfer(targetNodeID uint64) (RetType, error)
- func (p *StartRun) LoadConfig(s *server.Server)
- func (p *StartRun) Propose(msg []byte, retryTime int) (RetType, error)
- func (p *StartRun) RemoveData(nNodeID uint64) (RetType, error)
- func (p *StartRun) StatInfo() (string, RetType, error)
- func (p *StartRun) StopNodeHost() (RetType, error)
- func (p *StartRun) SyncPropose(msg []byte) (statemachine.Result, error)
Constants ¶
View Source
const ( ADD string = "add" ADD_OBSERVER string = "addobserver" ADD_WITNESS string = "addwitness" REMOVE string = "remove" TRANSFER string = "transfer" GET_LEADER string = "getleader" GET_NODEHOST_INFO string = "getnodehostinfo" GET_CLUSTER_MEM_SHIP string = "getclustermembership" REMOVE_DATA string = "removedata" OK string = "ok" FULLSYNC string = "fullsync" STAT_INFO string = "statinfo" DERAFT string = "deraft" RERAFT string = "reraft" LOGCOMPACT string = "logcompact" )
View Source
const ( DefaultWorkNum = 32 DefaultQueueLength = 8 << 10 )
Variables ¶
View Source
var DefaultLogger = &DLog{}
View Source
var UpdateOtherNodeDoing = []byte("&OtherNode*")
View Source
var UpdateSelfNodeDoing = []byte("&SelfNode*")
Functions ¶
func GetClusterNodeOK ¶
Types ¶
type ClusterInfo ¶
type ClusterInfo struct { ClusterID uint64 `json:"clusterID"` NodeID uint64 `json:"nodeID"` Nodes map[uint64]string `json:"nodes"` ConfigChangeIndex uint64 `json:"configChangeIndex"` StateMachineType uint64 `json:"stateMachineType"` IsLeader bool `json:"isLeader"` IsObserver bool `json:"isObserver"` IsWitness bool `json:"isWitness "` Pending bool `json:"pending"` }
type DiskKV ¶
type DiskKV struct {
// contains filtered or unexported fields
}
func (*DiskKV) PrepareSnapshot ¶
func (*DiskKV) RecoverFromSnapshot ¶
func (*DiskKV) SaveSnapshot ¶
type Membership ¶
type Membership struct { ConfigChangeID uint64 `json:"config_changeid"` Nodes map[uint64]string `json:"nodes"` Observers map[uint64]string `json:"observers"` NonVotings map[uint64]string `json:"nonvotings"` Witnesses map[uint64]string `json:"witnesses"` Removed map[uint64]struct{} `json:"removed"` }
type MembershipV2 ¶
type MembershipV2 struct {
Info Membership `json:"info"`
}
func (*MembershipV2) InitByDragonboatMembership ¶
func (m *MembershipV2) InitByDragonboatMembership(ms *braft.Membership)
func (*MembershipV2) Marshal ¶
func (m *MembershipV2) Marshal() (string, error)
type NodeHostInfo ¶
type NodeHostInfo struct { RaftAddress string `json:"raftAddress"` ClusterInfoList []ClusterInfo `json:"clusterInfoList"` LogInfo []NodeInfo `json:"LogInfo"` }
type NodeHostInfoV2 ¶
type NodeHostInfoV2 struct {
Info braft.NodeHostInfo `json:"info"`
}
type StartRun ¶
type StartRun struct { ClusterId uint64 NodeID uint64 Addr string Join bool IsObserver bool IsWitness bool TimeOut time.Duration RetryTimes int SnapshotTimeOut int AsyncPropose bool RaftReady bool Mu sync.Mutex ClusterStatOnce sync.Once AddrList map[uint64]string WalDir string NodeHostDir string HostName string Nhc dconfig.NodeHostConfig Nh *braft.NodeHost Rc dconfig.Config // contains filtered or unexported fields }
func (*StartRun) AddObserver ¶
func (*StartRun) AddWitness ¶
func (*StartRun) GetClusterMembership ¶
func (*StartRun) LeaderTransfer ¶
func (*StartRun) LoadConfig ¶
func (*StartRun) StopNodeHost ¶
func (*StartRun) SyncPropose ¶
func (p *StartRun) SyncPropose(msg []byte) (statemachine.Result, error)
Click to show internal directories.
Click to hide internal directories.