etcdserver: rename db file into a formal directory
and rename it to a formal namerelease-2.3
parent
51f1ee055e
commit
05c74bd890
|
@ -119,6 +119,8 @@ func (c *ServerConfig) WALDir() string {
|
||||||
|
|
||||||
func (c *ServerConfig) SnapDir() string { return path.Join(c.MemberDir(), "snap") }
|
func (c *ServerConfig) SnapDir() string { return path.Join(c.MemberDir(), "snap") }
|
||||||
|
|
||||||
|
func (c *ServerConfig) StorageDir() string { return path.Join(c.MemberDir(), "storage") }
|
||||||
|
|
||||||
func (c *ServerConfig) ShouldDiscover() bool { return c.DiscoveryURL != "" }
|
func (c *ServerConfig) ShouldDiscover() bool { return c.DiscoveryURL != "" }
|
||||||
|
|
||||||
// ReqTimeout returns timeout for request to finish.
|
// ReqTimeout returns timeout for request to finish.
|
||||||
|
|
|
@ -62,6 +62,8 @@ const (
|
||||||
|
|
||||||
purgeFileInterval = 30 * time.Second
|
purgeFileInterval = 30 * time.Second
|
||||||
monitorVersionInterval = 5 * time.Second
|
monitorVersionInterval = 5 * time.Second
|
||||||
|
|
||||||
|
databaseFilename = "db"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -181,8 +183,7 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
|
||||||
var id types.ID
|
var id types.ID
|
||||||
var cl *cluster
|
var cl *cluster
|
||||||
|
|
||||||
demoFile := path.Join(cfg.MemberDir(), "v3demo")
|
if !cfg.V3demo && fileutil.Exist(path.Join(cfg.StorageDir(), databaseFilename)) {
|
||||||
if !cfg.V3demo && fileutil.Exist(demoFile) {
|
|
||||||
return nil, errors.New("experimental-v3demo cannot be disabled once it is enabled")
|
return nil, errors.New("experimental-v3demo cannot be disabled once it is enabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +331,11 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg.V3demo {
|
if cfg.V3demo {
|
||||||
srv.kv = dstorage.New(demoFile)
|
err = os.MkdirAll(cfg.StorageDir(), privateDirMode)
|
||||||
|
if err != nil && err != os.ErrExist {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
srv.kv = dstorage.New(path.Join(cfg.StorageDir(), databaseFilename))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move transport initialization near the definition of remote
|
// TODO: move transport initialization near the definition of remote
|
||||||
|
|
Loading…
Reference in New Issue