Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more configurable datastore configs #3575

Merged
merged 18 commits into from
Sep 4, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Error out on unknown levelds compression rather than assuming the def…
…ault

License: MIT
Signed-off-by: Kevin Atkinson <[email protected]>
kevina authored and whyrusleeping committed Sep 3, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a99448f0de958e73e11b26f33400d69cea618391
6 changes: 3 additions & 3 deletions repo/fsrepo/datastores.go
Original file line number Diff line number Diff line change
@@ -200,15 +200,15 @@ func LeveldsDatastoreConfig(params map[string]interface{}) (DatastoreConfig, err
return nil, fmt.Errorf("'path' field is missing or not string")
}

switch params["compression"].(string) {
switch cm := params["compression"].(string); cm {
case "none":
c.compression = ldbopts.NoCompression
case "snappy":
c.compression = ldbopts.SnappyCompression
case "":
fallthrough
default:
c.compression = ldbopts.DefaultCompression
Copy link
Member

@Stebalien Stebalien Jul 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it ignores garbage values (e.g., "snapy" will silently ignored). If so, this should probably return an error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but didn't write that bit of code so I left it as is. @whyrusleeping agree with @Stebalien?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agreed. That makes sense

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevina, while we're at it, it would be nice to fix this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oversight, fixed now.

default:
return nil, fmt.Errorf("unrecognized value for compression: %s", cm)
}

return &c, nil