Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
1f8723d0
Commit
1f8723d0
authored
Jul 14, 2017
by
Kevin Atkinson
Committed by
Jeromy
Sep 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address p.r. feedback
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
6438fc74
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
repo/config/init.go
repo/config/init.go
+1
-1
repo/fsrepo/config_test.go
repo/fsrepo/config_test.go
+1
-1
repo/fsrepo/datastores.go
repo/fsrepo/datastores.go
+2
-1
repo/fsrepo/fsrepo.go
repo/fsrepo/fsrepo.go
+4
-4
No files found.
repo/config/init.go
View file @
1f8723d0
...
...
@@ -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.
//
Default
DatastoreConfig is an internal function exported to aid in testing.
func
DefaultDatastoreConfig
()
Datastore
{
return
Datastore
{
StorageMax
:
"10GB"
,
...
...
repo/fsrepo/config_test.go
View file @
1f8723d0
...
...
@@ -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
())
}
...
...
repo/fsrepo/datastores.go
View file @
1f8723d0
...
...
@@ -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
}
...
...
repo/fsrepo/fsrepo.go
View file @
1f8723d0
...
...
@@ -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
,
S
pecFn
)
fn
,
err
:=
config
.
Path
(
path
,
s
pecFn
)
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
,
S
pecFn
)
fn
,
err
:=
config
.
Path
(
r
.
path
,
s
pecFn
)
if
err
!=
nil
{
return
""
,
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment