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

badger: add truncate flag #5625

Merged
merged 1 commit into from
Nov 28, 2018
Merged

badger: add truncate flag #5625

merged 1 commit into from
Nov 28, 2018

Conversation

schomatis
Copy link
Contributor

@schomatis schomatis commented Oct 22, 2018

Depends on ipfs/go-ipfs-config#20 (merged).

Closes: #5275.

@schomatis schomatis added the topic/badger Topic badger label Oct 22, 2018
@schomatis schomatis self-assigned this Oct 22, 2018
Copy link
Member

@magik6k magik6k left a 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

@@ -382,6 +383,17 @@ func BadgerdsDatastoreConfig(params map[string]interface{}) (DatastoreConfig, er
}
}

truncate, ok := params["truncate"]
Copy link
Member

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
}

Copy link
Contributor Author

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.

@ghost ghost added the status/in-progress In progress label Oct 22, 2018
@schomatis
Copy link
Contributor Author

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

Good point, added it to the documentation.

Stebalien added a commit that referenced this pull request Nov 27, 2018
* AutoRelay options for #5785.
* Badger truncate-by-default option for #5275, #5625.

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
@Stebalien
Copy link
Member

@schomatis, @magik6k this is now (finally) unblocked.

@schomatis
Copy link
Contributor Author

The entire badgerdsDatastoreConfig structure seems to have been moved now, not sure where.

@magik6k
Copy link
Member

magik6k commented Nov 28, 2018

License: MIT
Signed-off-by: Lucas Molas <schomatis@gmail.com>
@schomatis
Copy link
Contributor Author

Thank you both! Rebased.

@schomatis schomatis removed the status/in-progress In progress label Nov 28, 2018
@schomatis schomatis changed the title [WIP] badger: add truncate flag badger: add truncate flag Nov 28, 2018
@Stebalien Stebalien merged commit fffa3ec into ipfs:master Nov 28, 2018
@schomatis schomatis deleted the feat/badger/add-truncate-option branch November 28, 2018 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/badger Topic badger
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants