etcdserver: clean NewServer

This commit is contained in:
Xiang Li
2014-10-11 21:03:03 +08:00
parent 57ae19b500
commit a85ec90d68
2 changed files with 119 additions and 106 deletions

View File

@ -3,6 +3,7 @@ package etcdserver
import (
"fmt"
"net/http"
"path"
"github.com/coreos/etcd/pkg/types"
)
@ -40,3 +41,14 @@ func (c *ServerConfig) Verify() error {
}
return nil
}
func (c *ServerConfig) WALDir() string { return path.Join(c.DataDir, "wal") }
func (c *ServerConfig) SnapDir() string { return path.Join(c.DataDir, "snap") }
func (c *ServerConfig) ID() uint64 { return c.Cluster.FindName(c.Name).ID }
// IsBootstrap returns ture if a bootstrap method is provided.
func (c *ServerConfig) IsBootstrap() bool {
return c.DiscoveryURL != "" || c.ClusterState == ClusterStateValueNew
}