Documentation ¶
Index ¶
- Constants
- func BindRespError(resp *raft_cmdpb.RaftCmdResponse, err error)
- func BindRespTerm(resp *raft_cmdpb.RaftCmdResponse, term uint64)
- func BootstrapStore(engines *engine_util.Engines, clusterID, storeID uint64) error
- func ClearMeta(engines *engine_util.Engines, kvWB, raftWB *engine_util.WriteBatch, ...) error
- func ClearPrepareBootstrap(engines *engine_util.Engines, regionID uint64) error
- func ClearPrepareBootstrapState(engines *engine_util.Engines) error
- func CreateRaftstore(cfg *config.Config) (*RaftstoreRouter, *Raftstore)
- func ErrResp(err error) *raft_cmdpb.RaftCmdResponse
- func ErrRespRegionNotFound(regionID uint64) *raft_cmdpb.RaftCmdResponse
- func ErrRespStaleCommand(term uint64) *raft_cmdpb.RaftCmdResponse
- func ErrRespWithTerm(err error, term uint64) *raft_cmdpb.RaftCmdResponse
- func NewPeer(storeId uint64, cfg *config.Config, engines *engine_util.Engines, ...) (*peer, error)
- func NotifyReqRegionRemoved(regionId uint64, cb *message.Callback)
- func NotifyStaleReq(term uint64, cb *message.Callback)
- func PrepareBootstrap(engines *engine_util.Engines, storeID, regionID, peerID uint64) (*metapb.Region, error)
- func PrepareBootstrapCluster(engines *engine_util.Engines, region *metapb.Region) error
- type ApplySnapResult
- type GlobalContext
- type Node
- func (n *Node) BootstrapCluster(ctx context.Context, engines *engine_util.Engines, firstRegion *metapb.Region) (newCluster bool, err error)
- func (n *Node) GetDBPath() string
- func (n *Node) GetStoreID() uint64
- func (n *Node) Start(ctx context.Context, engines *engine_util.Engines, trans Transport, ...) error
- func (n *Node) Stop()
- type PeerStorage
- func (ps *PeerStorage) Append(entries []eraftpb.Entry, raftWB *engine_util.WriteBatch) error
- func (ps *PeerStorage) AppliedIndex() uint64
- func (ps *PeerStorage) ApplySnapshot(snapshot *eraftpb.Snapshot, kvWB *engine_util.WriteBatch, ...) (*ApplySnapResult, error)
- func (ps *PeerStorage) ClearData()
- func (ps *PeerStorage) Entries(low, high uint64) ([]eraftpb.Entry, error)
- func (ps *PeerStorage) FirstIndex() (uint64, error)
- func (ps *PeerStorage) InitialState() (eraftpb.HardState, eraftpb.ConfState, error)
- func (ps *PeerStorage) LastIndex() (uint64, error)
- func (ps *PeerStorage) Region() *metapb.Region
- func (ps *PeerStorage) SaveReadyState(ready *raft.Ready) (*ApplySnapResult, error)
- func (ps *PeerStorage) SetRegion(region *metapb.Region)
- func (ps *PeerStorage) Snapshot() (eraftpb.Snapshot, error)
- func (ps *PeerStorage) Term(idx uint64) (uint64, error)
- type PeerTick
- type Raftstore
- type RaftstoreRouter
- type StoreTick
- type Transport
Constants ¶
View Source
const ( InitEpochVer uint64 = 1 InitEpochConfVer uint64 = 1 )
View Source
const ( MaxCheckClusterBootstrappedRetryCount = 60 CheckClusterBootstrapRetrySeconds = 3 )
View Source
const SnapMgrGcTickInterval = 1 * time.Minute
Variables ¶
This section is empty.
Functions ¶
func BindRespError ¶
func BindRespError(resp *raft_cmdpb.RaftCmdResponse, err error)
func BindRespTerm ¶
func BindRespTerm(resp *raft_cmdpb.RaftCmdResponse, term uint64)
func BootstrapStore ¶
func BootstrapStore(engines *engine_util.Engines, clusterID, storeID uint64) error
func ClearMeta ¶
func ClearMeta(engines *engine_util.Engines, kvWB, raftWB *engine_util.WriteBatch, regionID uint64, lastIndex uint64) error
ClearMeta delete stale metadata like raftState, applyState, regionState and raft log entries
func ClearPrepareBootstrap ¶
func ClearPrepareBootstrap(engines *engine_util.Engines, regionID uint64) error
func ClearPrepareBootstrapState ¶
func ClearPrepareBootstrapState(engines *engine_util.Engines) error
func CreateRaftstore ¶
func CreateRaftstore(cfg *config.Config) (*RaftstoreRouter, *Raftstore)
func ErrResp ¶
func ErrResp(err error) *raft_cmdpb.RaftCmdResponse
func ErrRespRegionNotFound ¶
func ErrRespRegionNotFound(regionID uint64) *raft_cmdpb.RaftCmdResponse
func ErrRespStaleCommand ¶
func ErrRespStaleCommand(term uint64) *raft_cmdpb.RaftCmdResponse
func ErrRespWithTerm ¶
func ErrRespWithTerm(err error, term uint64) *raft_cmdpb.RaftCmdResponse
func NotifyReqRegionRemoved ¶
func NotifyStaleReq ¶
func PrepareBootstrap ¶
func PrepareBootstrapCluster ¶
func PrepareBootstrapCluster(engines *engine_util.Engines, region *metapb.Region) error
Types ¶
type ApplySnapResult ¶
type GlobalContext ¶
type GlobalContext struct {
// contains filtered or unexported fields
}
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) BootstrapCluster ¶
func (*Node) GetStoreID ¶
type PeerStorage ¶
type PeerStorage struct { // Engine include two badger instance: Raft and Kv Engines *engine_util.Engines // Tag used for logging Tag string // contains filtered or unexported fields }
func NewPeerStorage ¶
func NewPeerStorage(engines *engine_util.Engines, region *metapb.Region, regionSched chan<- worker.Task, tag string) (*PeerStorage, error)
NewPeerStorage get the persist raftState from engines and return a peer storage
func (*PeerStorage) Append ¶
func (ps *PeerStorage) Append(entries []eraftpb.Entry, raftWB *engine_util.WriteBatch) error
Append the given entries to the raft log and update ps.raftState also delete log entries that will never be committed
func (*PeerStorage) AppliedIndex ¶
func (ps *PeerStorage) AppliedIndex() uint64
func (*PeerStorage) ApplySnapshot ¶
func (ps *PeerStorage) ApplySnapshot(snapshot *eraftpb.Snapshot, kvWB *engine_util.WriteBatch, raftWB *engine_util.WriteBatch) (*ApplySnapResult, error)
Apply the peer with given snapshot
func (*PeerStorage) ClearData ¶
func (ps *PeerStorage) ClearData()
func (*PeerStorage) Entries ¶
func (ps *PeerStorage) Entries(low, high uint64) ([]eraftpb.Entry, error)
func (*PeerStorage) FirstIndex ¶
func (ps *PeerStorage) FirstIndex() (uint64, error)
func (*PeerStorage) InitialState ¶
func (*PeerStorage) LastIndex ¶
func (ps *PeerStorage) LastIndex() (uint64, error)
func (*PeerStorage) Region ¶
func (ps *PeerStorage) Region() *metapb.Region
func (*PeerStorage) SaveReadyState ¶
func (ps *PeerStorage) SaveReadyState(ready *raft.Ready) (*ApplySnapResult, error)
Save memory states to disk. Do not modify ready in this function, this is a requirement to advance the ready object properly later.
func (*PeerStorage) SetRegion ¶
func (ps *PeerStorage) SetRegion(region *metapb.Region)
type RaftstoreRouter ¶
type RaftstoreRouter struct {
// contains filtered or unexported fields
}
func NewRaftstoreRouter ¶
func NewRaftstoreRouter(router *router) *RaftstoreRouter
func (*RaftstoreRouter) Send ¶
func (r *RaftstoreRouter) Send(regionID uint64, msg message.Msg) error
func (*RaftstoreRouter) SendRaftCommand ¶
func (r *RaftstoreRouter) SendRaftCommand(req *raft_cmdpb.RaftCmdRequest, cb *message.Callback) error
func (*RaftstoreRouter) SendRaftMessage ¶
func (r *RaftstoreRouter) SendRaftMessage(msg *raft_serverpb.RaftMessage) error
type Transport ¶
type Transport interface {
Send(msg *rspb.RaftMessage) error
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.