-
Notifications
You must be signed in to change notification settings - Fork 429
Introduce diskann-record crate to support serialization + deserialization of DiskANN indexes
#1188
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
45ddbcf
split saveload PR into two -- core with all the Save[Saveable]/Load[L…
suhasjs 7d29f1c
making copilot review happy
suhasjs f064610
making copilot review happy
suhasjs 5ca175c
moved up one level since both load/save paths use them
suhasjs 2cd7e6e
removed ContextInner; added new SaveContext, LoadContext traits; save…
suhasjs 6cea251
added file-level tests to improve coverage
suhasjs 14ceecc
Changed SaveContext::write to take Option<&str>. This allows us to wr…
suhasjs 407ff32
gave Reader a new(); added Display and from_str to Version, serde cal…
suhasjs 07f0020
added fallback to None if key does not pass validation in SaveContext…
suhasjs 0c7da43
added a quick short README
suhasjs 3f82e6b
abstracted away Backend --> Writer now stores a dyn WriterInner + add…
suhasjs 6c51b91
added ReaderInner trait to allow trait object inside Reader + doc upd…
suhasjs db62599
Made Write pub(crate); removed Bytes and its serde path; added explic…
suhasjs a404c05
cleanup failed save in DiskSaveContext; treat hint as None in MemoryS…
suhasjs e177357
more test coverage
suhasjs 11cbc89
making cargo fmt happy
suhasjs d5e4087
updated README; dropped 'patch' from VERSION
suhasjs 89b894f
improved test coverage for disk + memory backends
suhasjs aaaea47
bugfix NaN + infinity handling (thanks to Jordan)
suhasjs eb85f26
NaN + inf handling part 2 -- fix test
suhasjs bf8c318
improve test coverage for number.rs
suhasjs 740e977
make cargo fmt happy
suhasjs c2e83b1
readme update
suhasjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| [package] | ||
| name = "diskann-record" | ||
| version.workspace = true | ||
| description.workspace = true | ||
| authors.workspace = true | ||
| repository.workspace = true | ||
| license.workspace = true | ||
| edition = "2024" | ||
|
|
||
| [dependencies] | ||
| anyhow.workspace = true | ||
| serde = { workspace = true, features = ["derive"], optional = true } | ||
| serde_json = { workspace = true, optional = true } | ||
|
|
||
| [features] | ||
| default = ["disk"] | ||
| serde = ["dep:serde"] | ||
| disk = ["serde", "dep:serde_json"] | ||
|
|
||
| [dev-dependencies] | ||
| tempfile.workspace = true | ||
|
|
||
| [lints] | ||
| workspace = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # DiskANN Record | ||
|
|
||
| This crate provides a small framework for persisting structured Rust values (`struct`, `enum`, | ||
| `Option<T>`, `Vec<T>`, and primitives) as a manifest (can be serialized to JSON) plus a set | ||
| of side-car binary artifacts, and reloading them later. It is can be used by `diskann` | ||
| providers and indexes to implement durable, consistent and backward-compatible checkpoints. | ||
|
|
||
| Types describe how they map to a versioned record by implementing the `save::Save` and | ||
| `load::Load` traits; the `save_fields!` and `load_fields!` macros handle the | ||
| field-by-field plumbing for plain structs. Every record carries a `Version` so loaders | ||
| can detect schema changes and either upgrade or fall back through a probing chain. | ||
|
|
||
| The goal is to allow crates like `diskann` to checkpoint their state without depending on | ||
| a particular serialization backend. Currently, this crate implements `Disk` and `Memory` backends | ||
| -- `Disk` for persistent storage and `Memory` for in-memory operations. | ||
| `Memory` pipes the output of its `SaveContext` directly into the input of its `LoadContext`, so it is not compatible with other backends. | ||
| A hypothetical `ObjectStore` backend could be implemented to be compatible with `Disk` backends to support caching and other advanced features. | ||
|
|
||
| This crate has minimal dependencies by design. | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.