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

Add explicit snapshots to README #42

Merged
merged 5 commits into from
Dec 20, 2024
Merged

Add explicit snapshots to README #42

merged 5 commits into from
Dec 20, 2024

Conversation

vweevers
Copy link
Member

@vweevers vweevers commented Sep 25, 2022

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:

  • It would be a third API surface. We have the main database API surface which is roughly equal to that of a sublevel, and would now add another API surface which only has read methods, e.g. 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.
  • It would have a higher complexity once you factor in sublevels. I.e. to make db.sublevel().snapshot().get(key) read from the snapshot but also prefix the given key. By instead doing db.sublevel().get(key, { snapshot }), the sublevel can just forward that snapshot option to its parent database.
  • Furthermore, with the token-based approach, you can pass a snapshot to multiple sublevels, which cleanly solves the main use case of retrieving data from an index (see example).

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:

README.md Outdated Show resolved Hide resolved
@vweevers vweevers marked this pull request as ready for review December 20, 2024 21:49
@vweevers vweevers changed the title Define explicit snapshots Add explicit snapshots to README Dec 20, 2024
@vweevers vweevers merged commit a8485a2 into main Dec 20, 2024
10 checks passed
@vweevers vweevers deleted the explicit-snapshots branch December 20, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant