Documentation ¶
Index ¶
- Constants
- func CheckKeyInRegion(key []byte, region *metapb.Region) error
- func CheckKeyInRegionExclusive(key []byte, region *metapb.Region) error
- func CheckKeyInRegionInclusive(key []byte, region *metapb.Region) error
- func CheckPeerID(req *raft_cmdpb.RaftCmdRequest, peerID uint64) error
- func CheckRegionEpoch(req *raft_cmdpb.RaftCmdRequest, region *metapb.Region, includeRegion bool) error
- func CheckStoreID(req *raft_cmdpb.RaftCmdRequest, storeID uint64) error
- func CheckTerm(req *raft_cmdpb.RaftCmdRequest, term uint64) error
- func CloneMsg(origin, cloned proto.Message) error
- func ConfStateFromRegion(region *metapb.Region) (confState eraftpb.ConfState)
- func FindPeer(region *metapb.Region, storeID uint64) *metapb.Peer
- func IsEpochStale(epoch *metapb.RegionEpoch, checkEpoch *metapb.RegionEpoch) bool
- func IsFirstVoteMessage(msg *eraftpb.Message) bool
- func IsInitialMsg(msg *eraftpb.Message) bool
- func IsVoteMessage(msg *eraftpb.Message) bool
- func NewTestEngines() *engine_util.Engines
- func PeerEqual(l, r *metapb.Peer) bool
- func RaftstoreErrToPbError(e error) *errorpb.Error
- func RegionEqual(l, r *metapb.Region) bool
- func RemovePeer(region *metapb.Region, storeID uint64) *metapb.Peer
- func SafeCopy(b []byte) []byte
- type ErrEpochNotMatch
- type ErrKeyNotInRegion
- type ErrNotLeader
- type ErrRegionNotFound
- type ErrStaleCommand
- type ErrStoreNotMatch
Constants ¶
const InvalidID uint64 = 0
const RaftInvalidIndex uint64 = 0
Variables ¶
This section is empty.
Functions ¶
func CheckKeyInRegion ¶
/ Check if key in region range [`start_key`, `end_key`).
func CheckKeyInRegionExclusive ¶
/ Check if key in region range (`start_key`, `end_key`).
func CheckKeyInRegionInclusive ¶
/ Check if key in region range [`start_key`, `end_key`].
func CheckPeerID ¶
func CheckPeerID(req *raft_cmdpb.RaftCmdRequest, peerID uint64) error
func CheckRegionEpoch ¶
func CheckRegionEpoch(req *raft_cmdpb.RaftCmdRequest, region *metapb.Region, includeRegion bool) error
func CheckStoreID ¶
func CheckStoreID(req *raft_cmdpb.RaftCmdRequest, storeID uint64) error
func CheckTerm ¶
func CheckTerm(req *raft_cmdpb.RaftCmdRequest, term uint64) error
func ConfStateFromRegion ¶
func IsEpochStale ¶
func IsEpochStale(epoch *metapb.RegionEpoch, checkEpoch *metapb.RegionEpoch) bool
/ check whether epoch is staler than check_epoch.
func IsFirstVoteMessage ¶
/ `is_first_vote_msg` checks `msg` is the first vote message or not. It's used for / when the message is received but there is no such region in `Store::region_peers` and the / region overlaps with others. In this case we should put `msg` into `pending_votes` instead of / create the peer.
func IsInitialMsg ¶
/ `is_initial_msg` checks whether the `msg` can be used to initialize a new peer or not. There could be two cases:
- Target peer already exists but has not established communication with leader yet
- Target peer is added newly due to member change or region split, but it's not created yet
For both cases the region start key and end key are attached in RequestVote and Heartbeat message for the store of that peer to check whether to create a new peer when receiving these messages, or just to wait for a pending region split to perform later.
func IsVoteMessage ¶
func NewTestEngines ¶
func NewTestEngines() *engine_util.Engines
func RaftstoreErrToPbError ¶
func RegionEqual ¶
Types ¶
type ErrEpochNotMatch ¶
func (*ErrEpochNotMatch) Error ¶
func (e *ErrEpochNotMatch) Error() string
type ErrKeyNotInRegion ¶
func (*ErrKeyNotInRegion) Error ¶
func (e *ErrKeyNotInRegion) Error() string
type ErrNotLeader ¶
func (*ErrNotLeader) Error ¶
func (e *ErrNotLeader) Error() string
type ErrRegionNotFound ¶
type ErrRegionNotFound struct {
RegionId uint64
}
func (*ErrRegionNotFound) Error ¶
func (e *ErrRegionNotFound) Error() string
type ErrStaleCommand ¶
type ErrStaleCommand struct{}
func (*ErrStaleCommand) Error ¶
func (e *ErrStaleCommand) Error() string
type ErrStoreNotMatch ¶
func (*ErrStoreNotMatch) Error ¶
func (e *ErrStoreNotMatch) Error() string