https://github.com/ralith/carchive
Archive encoding for content addressing
https://github.com/ralith/carchive
Last synced: over 1 year ago
JSON representation
Archive encoding for content addressing
- Host: GitHub
- URL: https://github.com/ralith/carchive
- Owner: Ralith
- Created: 2018-06-09T02:15:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-17T01:17:59.000Z (over 7 years ago)
- Last Synced: 2025-02-12T14:32:17.555Z (over 1 year ago)
- Language: Rust
- Size: 18.6 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# carchive
This library defines an encoding for immutable key-value data where keys are small, fixed-size, and approximately
uniformly distributed. It provides random key lookups in O(log log n) average time using interpolation search.
These properties make this encoding a good solution for content-addressed storage, where keys are the stored data's
hash.
## Storage Layout
The last 4 bytes of an archive are a little-endian encoding of the key length, preceded by an 8 byte little-endian
encoding of the number `n` of key-value pairs encoded. Preceding that is the index: a list of `n` unpadded `(key, start,
length)` tuples. Entries are ordered by `key`, `start` represents the offset from the beginning of the archive at which
the corresponding value begins, and `length` represents the length of the value in bytes. Unstructured extension data
can be stored prior to the index.