Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a documentation-only PR, acting as an RFC. I opted for a token-based approach (as suggested by Rod Vagg in Level/community#45) instead of a dedicated snapshot API surface (as suggested by @juliangruber in Level/community#47). Main reasons for not choosing the latter:
db.snapshot().get()
. If you could pass around a snapshot as if it was a regular database (like you can with sublevels) then I'd be cool with it. But for that to happen, we'd have to implement write methods and thus transactions as well, which I consider to be out of scope although transactions are in fact a use case of snapshots.db.sublevel().snapshot().get(key)
read from the snapshot but also prefix the given key. By instead doingdb.sublevel().get(key, { snapshot })
, the sublevel can just forward that snapshot option to its parent database.I renamed the existing snapshot mechanism to "implicit snapshots" and attempted to clarify the behavior of those as well.
Several related issues can be closed, because this PR:
db.get()
doesn't read from a snapshot leveldown#796 (which should be moved rather than closed).