-
Notifications
You must be signed in to change notification settings - Fork 21
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
Update Datastore Interface #36
Conversation
Hm. Yeah, we should definitely make it sync by default. Thanks for catching this!
The guarantee of the interface is that all keys under the prefix will be synced, not that other keys won't also be synced. I'd expect most datastores to just sync everything. |
Ah. I see. There's no way to actually call sync other than to write a new value. |
That's what it looks like, but some of the internals are a little confusing. It seems like if the thing that writes the journal implements However, I don't think there are any provided journal writers that implement A few options:
Thoughts? |
For now, let's do this. If syndtr/goleveldb#310 gets merged, we can reconsider. |
@@ -224,6 +231,6 @@ func (d *Datastore) NewTransaction(readOnly bool) (ds.Txn, error) { | |||
if err != nil { | |||
return nil, err | |||
} | |||
accessor := &accessor{tx} | |||
accessor := &accessor{ldb: tx, syncWrites: false} |
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.
false
was chosen here because it's the default behavior and since the internal transaction totally ignores WriteOptions
anyway.
df60e4e
to
28fa23c
Compare
28fa23c
to
d7c8228
Compare
Per ipfs/go-datastore#140 the Datastore interface is being updated to support asynchronous writes.
This PR should be approved before the above PR is merged. After ipfs/go-datastore#140 is merged then this PR should have its go.mod updated and merged.
A couple quirks about adding the
Sync(prefix)
function to this LevelDB wrapper: