Skip to content

Commit

Permalink
fix: allow the levelds compression level to be unspecified
Browse files Browse the repository at this point in the history
Otherwise, the user will get a confusing panic. And given that we
support "", we might as well support nil.
  • Loading branch information
Stebalien authored and aschmahmann committed Oct 15, 2021
1 parent 2bb2f64 commit 8526849
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/plugins/levelds/levelds.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ func (*leveldsPlugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
return nil, fmt.Errorf("'path' field is missing or not string")
}

switch cm := params["compression"].(string); cm {
switch cm := params["compression"]; cm {
case "none":
c.compression = ldbopts.NoCompression
case "snappy":
c.compression = ldbopts.SnappyCompression
case "":
case "", nil:
c.compression = ldbopts.DefaultCompression
default:
return nil, fmt.Errorf("unrecognized value for compression: %s", cm)
Expand Down

0 comments on commit 8526849

Please sign in to comment.