|
|
@@ -24,13 +24,13 @@ import (
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
+ "github.com/coreos/etcd/etcdserver/api/snap"
|
|
|
stats "github.com/coreos/etcd/etcdserver/api/v2stats"
|
|
|
"github.com/coreos/etcd/pkg/fileutil"
|
|
|
"github.com/coreos/etcd/pkg/types"
|
|
|
"github.com/coreos/etcd/raft"
|
|
|
"github.com/coreos/etcd/raft/raftpb"
|
|
|
"github.com/coreos/etcd/rafthttp"
|
|
|
- "github.com/coreos/etcd/raftsnap"
|
|
|
"github.com/coreos/etcd/wal"
|
|
|
"github.com/coreos/etcd/wal/walpb"
|
|
|
|
|
|
@@ -61,8 +61,8 @@ type raftNode struct {
|
|
|
raftStorage *raft.MemoryStorage
|
|
|
wal *wal.WAL
|
|
|
|
|
|
- snapshotter *raftsnap.Snapshotter
|
|
|
- snapshotterReady chan *raftsnap.Snapshotter // signals when snapshotter is ready
|
|
|
+ snapshotter *snap.Snapshotter
|
|
|
+ snapshotterReady chan *snap.Snapshotter // signals when snapshotter is ready
|
|
|
|
|
|
snapCount uint64
|
|
|
transport *rafthttp.Transport
|
|
|
@@ -79,7 +79,7 @@ var defaultSnapshotCount uint64 = 10000
|
|
|
// commit channel, followed by a nil message (to indicate the channel is
|
|
|
// current), then new log entries. To shutdown, close proposeC and read errorC.
|
|
|
func newRaftNode(id int, peers []string, join bool, getSnapshot func() ([]byte, error), proposeC <-chan string,
|
|
|
- confChangeC <-chan raftpb.ConfChange) (<-chan *string, <-chan error, <-chan *raftsnap.Snapshotter) {
|
|
|
+ confChangeC <-chan raftpb.ConfChange) (<-chan *string, <-chan error, <-chan *snap.Snapshotter) {
|
|
|
|
|
|
commitC := make(chan *string)
|
|
|
errorC := make(chan error)
|
|
|
@@ -100,7 +100,7 @@ func newRaftNode(id int, peers []string, join bool, getSnapshot func() ([]byte,
|
|
|
httpstopc: make(chan struct{}),
|
|
|
httpdonec: make(chan struct{}),
|
|
|
|
|
|
- snapshotterReady: make(chan *raftsnap.Snapshotter, 1),
|
|
|
+ snapshotterReady: make(chan *snap.Snapshotter, 1),
|
|
|
// rest of structure populated after WAL replay
|
|
|
}
|
|
|
go rc.startRaft()
|
|
|
@@ -190,7 +190,7 @@ func (rc *raftNode) publishEntries(ents []raftpb.Entry) bool {
|
|
|
|
|
|
func (rc *raftNode) loadSnapshot() *raftpb.Snapshot {
|
|
|
snapshot, err := rc.snapshotter.Load()
|
|
|
- if err != nil && err != raftsnap.ErrNoSnapshot {
|
|
|
+ if err != nil && err != snap.ErrNoSnapshot {
|
|
|
log.Fatalf("raftexample: error loading snapshot (%v)", err)
|
|
|
}
|
|
|
return snapshot
|
|
|
@@ -263,7 +263,7 @@ func (rc *raftNode) startRaft() {
|
|
|
log.Fatalf("raftexample: cannot create dir for snapshot (%v)", err)
|
|
|
}
|
|
|
}
|
|
|
- rc.snapshotter = raftsnap.New(zap.NewExample(), rc.snapdir)
|
|
|
+ rc.snapshotter = snap.New(zap.NewExample(), rc.snapdir)
|
|
|
rc.snapshotterReady <- rc.snapshotter
|
|
|
|
|
|
oldwal := wal.Exist(rc.waldir)
|