Create an StorageRecorder interface to fix unexported-return
Signed-off-by: adeyemi <adeyemi.aladesawe@gmail.com>
This commit is contained in:
parent
eb7607bd8b
commit
c0c9f7c344
@ -22,42 +22,42 @@ import (
|
|||||||
"go.etcd.io/raft/v3/raftpb"
|
"go.etcd.io/raft/v3/raftpb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type storageRecorder struct {
|
type StorageRecorder struct {
|
||||||
testutil.Recorder
|
testutil.Recorder
|
||||||
dbPath string // must have '/' suffix if set
|
dbPath string // must have '/' suffix if set
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStorageRecorder(db string) *storageRecorder {
|
func NewStorageRecorder(db string) *StorageRecorder {
|
||||||
return &storageRecorder{&testutil.RecorderBuffered{}, db}
|
return &StorageRecorder{&testutil.RecorderBuffered{}, db}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStorageRecorderStream(db string) *storageRecorder {
|
func NewStorageRecorderStream(db string) *StorageRecorder {
|
||||||
return &storageRecorder{testutil.NewRecorderStream(), db}
|
return &StorageRecorder{testutil.NewRecorderStream(), db}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *storageRecorder) Save(st raftpb.HardState, ents []raftpb.Entry) error {
|
func (p *StorageRecorder) Save(st raftpb.HardState, ents []raftpb.Entry) error {
|
||||||
p.Record(testutil.Action{Name: "Save"})
|
p.Record(testutil.Action{Name: "Save"})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *storageRecorder) SaveSnap(st raftpb.Snapshot) error {
|
func (p *StorageRecorder) SaveSnap(st raftpb.Snapshot) error {
|
||||||
if !raft.IsEmptySnap(st) {
|
if !raft.IsEmptySnap(st) {
|
||||||
p.Record(testutil.Action{Name: "SaveSnap"})
|
p.Record(testutil.Action{Name: "SaveSnap"})
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *storageRecorder) Release(st raftpb.Snapshot) error {
|
func (p *StorageRecorder) Release(st raftpb.Snapshot) error {
|
||||||
if !raft.IsEmptySnap(st) {
|
if !raft.IsEmptySnap(st) {
|
||||||
p.Record(testutil.Action{Name: "Release"})
|
p.Record(testutil.Action{Name: "Release"})
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *storageRecorder) Sync() error {
|
func (p *StorageRecorder) Sync() error {
|
||||||
p.Record(testutil.Action{Name: "Sync"})
|
p.Record(testutil.Action{Name: "Sync"})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *storageRecorder) Close() error { return nil }
|
func (p *StorageRecorder) Close() error { return nil }
|
||||||
func (p *storageRecorder) MinimalEtcdVersion() *semver.Version { return nil }
|
func (p *StorageRecorder) MinimalEtcdVersion() *semver.Version { return nil }
|
||||||
|
Loading…
Reference in New Issue
Block a user