Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrTermMismatch = errors.New("term mismatch during reconstruction of chunks, please resubmit") ErrInvalidOpNum = errors.New("no op num found when reconstructing chunks") ErrNoExistingChunks = errors.New("no existing chunks but non-zero sequence num") ErrSequenceNumberMismatch = errors.New("sequence number skipped") ErrMissingChunk = errors.New("missing sequence number during reconstruction") )
Functions ¶
func ChunkingApply ¶
func ChunkingApply(cmd, extensions []byte, timeout time.Duration, applyFunc ApplyFunc) raft.ApplyFuture
ChunkingApply takes in a byte slice and chunks into raft.SuggestedMaxDataSize (or less if EOF) chunks, calling Apply on each. It requires a corresponding wrapper around the FSM to handle reconstructing on the other end. Timeout will be the timeout for each individual operation, not total. The return value is a future whose Error() will return only when all underlying Apply futures have had Error() return. Note that any error indicates that the entire operation will not be applied, assuming the correct FSM wrapper is used. If extensions is passed in, it will be set as the Extensions value on the Apply once all chunks are received.
Types ¶
type ChunkingFSM ¶
type ChunkingFSM struct {
// contains filtered or unexported fields
}
func NewChunkingFSM ¶
func NewChunkingFSM(underlying raft.FSM) *ChunkingFSM
func (*ChunkingFSM) Apply ¶
func (c *ChunkingFSM) Apply(l *raft.Log) interface{}
Apply applies the log, handling chunking as needed. The return value will either be an error or whatever is returned from the underlying Apply.
func (*ChunkingFSM) Restore ¶
func (c *ChunkingFSM) Restore(rc io.ReadCloser) error
func (*ChunkingFSM) Snapshot ¶
func (c *ChunkingFSM) Snapshot() (raft.FSMSnapshot, error)
func (*ChunkingFSM) Underlying ¶
func (c *ChunkingFSM) Underlying() raft.FSM
Note: this is used in tests via the Raft package test helper functions, even if it's not used in client code