Commit 1f8723d0 authored by Kevin Atkinson's avatar Kevin Atkinson Committed by Jeromy

Address p.r. feedback

License: MIT
Signed-off-by: default avatarKevin Atkinson <k@kevina.org>
parent 6438fc74
......@@ -76,7 +76,7 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
return conf, nil
}
// DatastoreConfig is an internal function exported to aid in testing.
// DefaultDatastoreConfig is an internal function exported to aid in testing.
func DefaultDatastoreConfig() Datastore {
return Datastore{
StorageMax: "10GB",
......
......@@ -87,7 +87,7 @@ func TestDefaultDatastoreConfig(t *testing.T) {
t.Fatal(err)
}
expected := `{"mounts":[{"mountpoint":{"string":"/blocks"},"path":"blocks","shardFunc":"/repo/flatfs/shard/v1/next-to-last/2","type":"flatfs"},{"mountpoint":{"string":"/"},"path":"datastore","type":"levelds"}],"type":"mount"}`
expected := `{"mounts":[{"mountpoint":"/blocks","path":"blocks","shardFunc":"/repo/flatfs/shard/v1/next-to-last/2","type":"flatfs"},{"mountpoint":"/","path":"datastore","type":"levelds"}],"type":"mount"}`
if dsc.DiskSpec().String() != expected {
t.Errorf("expected '%s' got '%s' as DiskId", expected, dsc.DiskSpec().String())
}
......
......@@ -126,7 +126,7 @@ func (c *mountDatastoreConfig) DiskSpec() DiskSpec {
if c == nil {
c = make(map[string]interface{})
}
c["mountpoint"] = m.prefix
c["mountpoint"] = m.prefix.String()
mounts[i] = c
}
cfg["mounts"] = mounts
......@@ -247,6 +247,7 @@ type memDatastoreConfig struct {
cfg map[string]interface{}
}
// MemDatastoreConfig returns a memory DatastoreConfig from a spec
func MemDatastoreConfig(params map[string]interface{}) (DatastoreConfig, error) {
return &memDatastoreConfig{params}, nil
}
......
......@@ -62,6 +62,8 @@ func (err NoRepoError) Error() string {
const apiFile = "api"
const swarmKeyFile = "swarm.key"
const specFn = "datastore_spec"
var (
// packageLock must be held to while performing any operation that modifies an
......@@ -245,7 +247,7 @@ func initConfig(path string, conf *config.Config) error {
}
func initSpec(path string, conf map[string]interface{}) error {
fn, err := config.Path(path, SpecFn)
fn, err := config.Path(path, specFn)
if err != nil {
return err
}
......@@ -415,10 +417,8 @@ func (r *FSRepo) openDatastore() error {
return nil
}
var SpecFn = "datastore_spec"
func (r *FSRepo) readSpec() (string, error) {
fn, err := config.Path(r.path, SpecFn)
fn, err := config.Path(r.path, specFn)
if err != nil {
return "", err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment