Documentation ¶
Overview ¶
Package storage is a generated GoMock package.
Index ¶
- Variables
- func ApplyKey(id uint64) string
- func CommitKey(id uint64) string
- func CompactKey(id uint64) string
- func ConfStateKey(id uint64) string
- func HardStateKey(id uint64) string
- type AppendCallback
- type AppendResult
- type MockSnapshotOperator
- type MockSnapshotOperatorMockRecorder
- type SnapshotOperator
- type Storage
- func (s *Storage) Append(ctx context.Context, entries []raftpb.Entry, cb AppendCallback)
- func (s *Storage) Applied() uint64
- func (s *Storage) ApplySnapshot(ctx context.Context, snap raftpb.Snapshot) error
- func (s *Storage) Commit() uint64
- func (s *Storage) Compact(ctx context.Context, i uint64) error
- func (s *Storage) Compacted() uint64
- func (s *Storage) Delete(ctx context.Context)
- func (s *Storage) Entries(lo, hi, maxSize uint64) ([]raftpb.Entry, error)
- func (s *Storage) FirstIndex() (uint64, error)
- func (s *Storage) HardState() raftpb.HardState
- func (s *Storage) InitialState() (raftpb.HardState, raftpb.ConfState, error)
- func (s *Storage) LastIndex() (uint64, error)
- func (s *Storage) SetApplied(ctx context.Context, app uint64)
- func (s *Storage) SetCommit(ctx context.Context, commit uint64)
- func (s *Storage) SetConfState(ctx context.Context, cs raftpb.ConfState, cb meta.StoreCallback)
- func (s *Storage) SetHardState(ctx context.Context, hs raftpb.HardState, cb meta.StoreCallback)
- func (ss *Storage) SetSnapshotOperator(op SnapshotOperator)
- func (s *Storage) Snapshot() (raftpb.Snapshot, error)
- func (s *Storage) Term(i uint64) (uint64, error)
- type WAL
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoEntry = errors.New("no entry") ErrBadEntry = errors.New("bad entry") ErrCompacted = errors.New("appending entries has been compacted") ErrTruncated = errors.New("appending entries has been truncated") )
var ErrClosed = errors.New("WAL: closed")
Functions ¶
func CompactKey ¶
func ConfStateKey ¶
func HardStateKey ¶
Types ¶
type AppendCallback ¶
type AppendCallback = func(AppendResult, error)
type AppendResult ¶
type MockSnapshotOperator ¶
type MockSnapshotOperator struct {
// contains filtered or unexported fields
}
MockSnapshotOperator is a mock of SnapshotOperator interface.
func NewMockSnapshotOperator ¶
func NewMockSnapshotOperator(ctrl *gomock.Controller) *MockSnapshotOperator
NewMockSnapshotOperator creates a new mock instance.
func (*MockSnapshotOperator) ApplySnapshot ¶
func (m *MockSnapshotOperator) ApplySnapshot(data []byte) error
ApplySnapshot mocks base method.
func (*MockSnapshotOperator) EXPECT ¶
func (m *MockSnapshotOperator) EXPECT() *MockSnapshotOperatorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSnapshotOperator) GetSnapshot ¶
func (m *MockSnapshotOperator) GetSnapshot(index uint64) ([]byte, error)
GetSnapshot mocks base method.
type MockSnapshotOperatorMockRecorder ¶
type MockSnapshotOperatorMockRecorder struct {
// contains filtered or unexported fields
}
MockSnapshotOperatorMockRecorder is the mock recorder for MockSnapshotOperator.
func (*MockSnapshotOperatorMockRecorder) ApplySnapshot ¶
func (mr *MockSnapshotOperatorMockRecorder) ApplySnapshot(data interface{}) *gomock.Call
ApplySnapshot indicates an expected call of ApplySnapshot.
func (*MockSnapshotOperatorMockRecorder) GetSnapshot ¶
func (mr *MockSnapshotOperatorMockRecorder) GetSnapshot(index interface{}) *gomock.Call
GetSnapshot indicates an expected call of GetSnapshot.
type SnapshotOperator ¶
type Storage ¶
type Storage struct { // AppendExecutor is the Executor that executes Append, postAppend and Compact. AppendExecutor executor.Executor // contains filtered or unexported fields }
func NewStorage ¶
func NewStorage( ctx context.Context, nodeID vanus.ID, wal *WAL, stateStore *meta.SyncStore, hintStore *meta.AsyncStore, snapOp SnapshotOperator, ) (*Storage, error)
NewStorage creates an empty Storage.
func RecoverStorage ¶
func RecoverStorage( nodeID vanus.ID, wal *WAL, stateStore *meta.SyncStore, hintStore *meta.AsyncStore, snapOp SnapshotOperator, ) (*Storage, error)
func (*Storage) Append ¶
Append appends the new entries to storage. After the call returns, all entries are readable. After the AppendCallback cb fires, all entries are persisted. NOTE: Synchronization is the responsibility of the caller.
func (*Storage) ApplySnapshot ¶
ApplySnapshot overwrites the contents of this Storage object with those of the given snapshot.
func (*Storage) Compact ¶
Compact discards all log entries prior to compactIndex. It is the application's responsibility to not attempt to compact an index greater than raftLog.applied.
func (*Storage) Delete ¶
Delete discard all data of Storage. NOTE: waiting for inflight append calls is the responsibility of the caller.
func (*Storage) Entries ¶
Entries returns a slice of log entries in the range [lo,hi). MaxSize limits the total size of the log entries returned, but Entries returns at least one entry if any.
func (*Storage) FirstIndex ¶
FirstIndex returns the index of the first log entry that is possibly available via Entries (older entries have been incorporated into the latest Snapshot; if storage only contains the dummy entry the first log entry is not available).
func (*Storage) HardState ¶
HardState returns the saved HardState. NOTE: HardState.Commit will always be 0, don't use it.
func (*Storage) InitialState ¶
InitialState returns the saved HardState and ConfState information.
func (*Storage) SetConfState ¶
func (*Storage) SetHardState ¶
SetHardState saves the current HardState.
func (*Storage) SetSnapshotOperator ¶
func (ss *Storage) SetSnapshotOperator(op SnapshotOperator)