You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add lance_dataset_restore for rolling back to a prior version (#18)
## Summary
- Adds `lance_dataset_restore(dataset, version)` — commits a new
manifest whose fragments match `version` and returns a fresh handle at
that version
- The caller's original handle is untouched; both must be closed
separately
- C++ gets a `lance::Dataset::restore(version)` member returning a new
`Dataset`
## Motivation
With `lance_dataset_versions` (#17) C/C++ callers can list the history,
but there was no way to actually roll back to an older version. This
closes the remaining piece of read-side version management from the
Phase 3 roadmap.
## Contract
- A new manifest is **always** written, even when `version` already
matches the current latest, so the caller's "make `version` the new
latest" intent holds unconditionally under concurrent writers.
- `version == 0` is rejected with `LANCE_ERR_INVALID_ARGUMENT` (it is
`lance_dataset_open`'s "latest" sentinel).
- Errors: `LANCE_ERR_INVALID_ARGUMENT` (NULL handle or `version == 0`),
`LANCE_ERR_NOT_FOUND` (unknown version), `LANCE_ERR_COMMIT_CONFLICT`
(concurrent commit, typically another restore).
## Test plan
- `cargo test` — 5 Rust tests:
- prior-version happy path (version bump + row count, original handle
untouched)
- restore-to-current-latest writes a new manifest (version bumps by
exactly one, visible on reopen)
- unknown version → `NotFound`
- `version == 0` rejection
- NULL handle rejection
- `cargo clippy --all-targets -- -D warnings` and `cargo fmt --check`
clean
- `cargo test --test compile_and_run_test -- --ignored` — C and C++
end-to-end tests exercise restore-to-current and assert the version bump
Closes#12.
0 commit comments