-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
badger: add truncate flag #5625
badger: add truncate flag #5625
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also note (or change) the behaviour this has with syncWirtes on Windows: https://github.com/ipfs/go-ds-badger/blob/master/datastore.go#L64
repo/fsrepo/datastores.go
Outdated
@@ -382,6 +383,17 @@ func BadgerdsDatastoreConfig(params map[string]interface{}) (DatastoreConfig, er | |||
} | |||
} | |||
|
|||
truncate, ok := params["truncate"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about (could do this with syncWrites
above too):
c.truncate, ok = params["truncate"].(bool)
if !ok {
c.truncate = true
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is much cleaner (I didn't even knew I could perform those two operations in the same line) but it will silently fail for cases when the user puts the value as a string, e.g., "syncWrites": "false"
will actually be interpreted as true
without the user even noticing it.
Good point, added it to the documentation. |
@schomatis, @magik6k this is now (finally) unblocked. |
The entire |
License: MIT Signed-off-by: Lucas Molas <schomatis@gmail.com>
Thank you both! Rebased. |
Depends on ipfs/go-ipfs-config#20 (merged).
Closes: #5275.