raftgroup

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RaftApplyHandler

type RaftApplyHandler func(*ms_raftcmdpb.Request, uint64) (*ms_raftcmdpb.Response, error)

type RaftApplySnapshotHandler

type RaftApplySnapshotHandler func([]raftproto.Peer, *SnapshotKVIterator) error

type RaftFatalEventHandler

type RaftFatalEventHandler func(*raft.FatalError)

type RaftGetSnapshotHandler

type RaftGetSnapshotHandler func() (model.Snapshot, error)

type RaftGroup

type RaftGroup struct {
	// contains filtered or unexported fields
}

func NewRaftGroup

func NewRaftGroup(id uint64, raftServer *raft.RaftServer, startKey, endKey []byte) *RaftGroup

func (*RaftGroup) Apply

func (rg *RaftGroup) Apply(command []byte, index uint64) (res interface{}, err error)

func (*RaftGroup) ApplyMemberChange

func (rg *RaftGroup) ApplyMemberChange(confChange *raftproto.ConfChange, index uint64) (res interface{}, err error)

func (*RaftGroup) ApplySnapshot

func (rg *RaftGroup) ApplySnapshot(peers []raftproto.Peer, rawIter raftproto.SnapIterator) error

func (*RaftGroup) ChangePeer

func (rg *RaftGroup) ChangePeer(ctx context.Context, typ raftproto.ConfChangeType, nodeId uint64) error

func (*RaftGroup) Create

func (rg *RaftGroup) Create(raftConfig *raft.RaftConfig) error

func (*RaftGroup) GetDownPeers

func (rg *RaftGroup) GetDownPeers(rangeId uint64) []raft.DownReplica

func (*RaftGroup) GetPendingPeers

func (rg *RaftGroup) GetPendingPeers(rangeId uint64) []uint64

func (*RaftGroup) HandleFatalEvent

func (rg *RaftGroup) HandleFatalEvent(err *raft.FatalError)

func (*RaftGroup) HandleLeaderChange

func (rg *RaftGroup) HandleLeaderChange(leader uint64)

func (*RaftGroup) IsLeader

func (rg *RaftGroup) IsLeader() bool

func (*RaftGroup) LeaderTerm

func (rg *RaftGroup) LeaderTerm() (leader, term uint64)

func (*RaftGroup) LeaderTransfer

func (rg *RaftGroup) LeaderTransfer(ctx context.Context, rangeId uint64) error

func (*RaftGroup) RegisterApplyHandle

func (rg *RaftGroup) RegisterApplyHandle(handler RaftApplyHandler)

func (*RaftGroup) RegisterApplySnapshotHandle

func (rg *RaftGroup) RegisterApplySnapshotHandle(handler RaftApplySnapshotHandler)

func (*RaftGroup) RegisterFatalEventHandle

func (rg *RaftGroup) RegisterFatalEventHandle(handler RaftFatalEventHandler)

func (*RaftGroup) RegisterGetSnapshotHandle

func (rg *RaftGroup) RegisterGetSnapshotHandle(handler RaftGetSnapshotHandler)

func (*RaftGroup) RegisterLeaderChangeHandle

func (rg *RaftGroup) RegisterLeaderChangeHandle(handler RaftLeaderChangeHandler)

func (*RaftGroup) RegisterPeerChangeHandle

func (rg *RaftGroup) RegisterPeerChangeHandle(handler RaftPeerChangeHandler)

func (*RaftGroup) Release

func (rg *RaftGroup) Release()

func (*RaftGroup) Snapshot

func (rg *RaftGroup) Snapshot() (raftproto.Snapshot, error)

TODO raft index with config command

func (*RaftGroup) Submit

func (rg *RaftGroup) Submit(ctx context.Context, cmd []byte) (interface{}, error)

func (*RaftGroup) SubmitCommand

func (rg *RaftGroup) SubmitCommand(ctx context.Context, req *ms_raftcmdpb.Request) (*ms_raftcmdpb.Response, error)

type RaftLeaderChangeHandler

type RaftLeaderChangeHandler func(uint64)

type RaftPeerChangeHandler

type RaftPeerChangeHandler func(*raftproto.ConfChange) (interface{}, error)

type RaftSnapshot

type RaftSnapshot struct {
	// contains filtered or unexported fields
}

func NewRaftSnapshot

func NewRaftSnapshot(snap model.Snapshot, applyIndex uint64, beginKey, endKey []byte) *RaftSnapshot

func (*RaftSnapshot) ApplyIndex

func (s *RaftSnapshot) ApplyIndex() uint64

func (*RaftSnapshot) Close

func (s *RaftSnapshot) Close()

func (*RaftSnapshot) Next

func (s *RaftSnapshot) Next() ([]byte, error)

type SnapshotKVIterator

type SnapshotKVIterator struct {
	// contains filtered or unexported fields
}

func NewSnapshotKVIterator

func NewSnapshotKVIterator(rawIter raftproto.SnapIterator) *SnapshotKVIterator

func (*SnapshotKVIterator) Next

func (i *SnapshotKVIterator) Next() (kvPair *ms_raftcmdpb.RaftKvPair, err error)

Jump to

Keyboard shortcuts

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