Merge pull request #3248 from xiang90/v3

initial v3 demo
This commit is contained in:
Xiang Li
2015-08-10 13:59:03 -07:00
16 changed files with 863 additions and 151 deletions

View File

@ -20,6 +20,7 @@ import (
"fmt"
"math/rand"
"net/http"
"os"
"path"
"regexp"
"sync/atomic"
@ -43,6 +44,7 @@ import (
"github.com/coreos/etcd/raft/raftpb"
"github.com/coreos/etcd/rafthttp"
"github.com/coreos/etcd/snap"
dstorage "github.com/coreos/etcd/storage"
"github.com/coreos/etcd/store"
"github.com/coreos/etcd/version"
"github.com/coreos/etcd/wal"
@ -158,6 +160,7 @@ type EtcdServer struct {
cluster *cluster
store store.Store
kv dstorage.KV
stats *stats.ServerStats
lstats *stats.LeaderStats
@ -315,6 +318,13 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
forceVersionC: make(chan struct{}),
}
if cfg.V3demo {
srv.kv = dstorage.New(path.Join(cfg.DataDir, "member", "v3demo"))
} else {
// we do not care about the error of the removal
os.RemoveAll(path.Join(cfg.DataDir, "member", "v3demo"))
}
// TODO: move transport initialization near the definition of remote
tr := rafthttp.NewTransporter(cfg.Transport, id, cl.ID(), srv, srv.errorc, sstats, lstats)
// add all remotes into transport