mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: rename db file into a formal directory
and rename it to a formal name
This commit is contained in:
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) StorageDir() string { return path.Join(c.MemberDir(), "storage") }
|
||||
|
||||
func (c *ServerConfig) ShouldDiscover() bool { return c.DiscoveryURL != "" }
|
||||
|
||||
// ReqTimeout returns timeout for request to finish.
|
||||
|
@ -62,6 +62,8 @@ const (
|
||||
|
||||
purgeFileInterval = 30 * time.Second
|
||||
monitorVersionInterval = 5 * time.Second
|
||||
|
||||
databaseFilename = "db"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -181,8 +183,7 @@ func NewServer(cfg *ServerConfig) (*EtcdServer, error) {
|
||||
var id types.ID
|
||||
var cl *cluster
|
||||
|
||||
demoFile := path.Join(cfg.MemberDir(), "v3demo")
|
||||
if !cfg.V3demo && fileutil.Exist(demoFile) {
|
||||
if !cfg.V3demo && fileutil.Exist(path.Join(cfg.StorageDir(), databaseFilename)) {
|
||||
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 {
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user