Crates.io | paged |
lib.rs | paged |
version | 0.1.1 |
source | src |
created_at | 2023-10-03 14:43:53.390485 |
updated_at | 2023-11-03 16:01:24.644757 |
description | Read and create read-only paged database files |
homepage | |
repository | https://github.com/timothee-haudebourg/paged |
max_upload_size | |
id | 991070 |
size | 51,678 |
This library provides a simple binary data format to organize large lists of data for random read-only access.
Data is organized in sections, pages and entries. Each file can include multiple sections, each section include multiple pages, and each page multiple entries. The first section/page may start at any given offset to give room to a potential file header. The file may also include one or more heap sections storing dynamically sized data.
A typical paged file will look like this:
┏━━━━━━━━━━━┓
┃ Header ┃
┃ ┃
┗━━━━━━━━━━━┛
┏━━━━━━━━━━━┓
┃ Section 1 ┃
┃┌─────────┐┃
┃│ Page 1 │┃
┃├─────────┤┃
┃│ Entry 1 │┃
┃│ ... │┃
┃│ Entry N │┃
┃└─────────┘┃
┃ ... ┃
┃┌─────────┐┃
┃│ Page M │┃
┃├─────────┤┃
┃│ Entry 1 │┃
┃│ ... │┃
┃│ Entry N │┃
┃└─────────┘┃
┗━━━━━━━━━━━┛
...
┏━━━━━━━━━━━┓
┃ Section P ┃
┃┌─────────┐┃
┃│ Page 1 │┃
┃├─────────┤┃
┃│ Entry 1 │┃
┃│ ... │┃
┃│ Entry N │┃
┃└─────────┘┃
┃ ... ┃
┃┌─────────┐┃
┃│ Page M │┃
┃├─────────┤┃
┃│ Entry 1 │┃
┃│ ... │┃
┃│ Entry N │┃
┃└─────────┘┃
┗━━━━━━━━━━━┛
┏━━━━━━━━━━━┓
┃ Heap ┃
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┃ ┃
┗━━━━━━━━━━━┛
The "entry" is the smallest unit of information in a file managed by this library. An entry represents any data whose type implements the EncodeOnHeap
and DecodeFromHeap
traits.
A page is a list of entries of the same type. Every page of a file have the same byte length. All the entries in a page must have the same size. It is however possible for an entry to reference dynamically sized data living on a heap section.
A section is a list of pages of the same type. The size of a section is a multiple of the page length.
A file may contain one or more heap sections. A heap stores dynamically sized data without any structure.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.