hinto-janai
4876e159e7
repo: add skeleton directories, fix labels ( #139 )
...
* `database/` -> `storage/`, create skeleton `storage/` crates
* add skeleton root directories
* books: add skeleton
* ci: fix labeler.yml
* fix CONTRIBUTING.md
* fix workspace Cargo.toml
* fix `storage/`
* rename helper fs fn, `cuprate_database` -> `cuprate_blockchain`
* fix Cargo.toml
* cuprate-blockchain: revert find-and-replace
Since it has to be ported to the book anyway, there's not much
reason to update this and create review diffs.
* labeler.yml: remove `A-docs` from `books/` changes
Although books are documentation,
the `A-books` label already exists for this
2024-05-29 02:18:30 +01:00
hinto-janai
fb3d41ccbb
database: final docs + cleanup ( #117 )
...
* re-apply 'main' merge + doc patches
* fix redb lints
* update readme
* add `lib.rs, ops, service` doc-test examples
* docs for `config`, `ops`, add doc-tests
* remove merge error
incorrect leftover code from previous merge
* doc top-level types
* docs: error, tables, types
* misc docs, TODO, FIXME, SOMEDAY fixes
* change clippy lints
* tests: add `tables_are_sorted()`
* move `tables_are_sorted()` test to `backend/tests.rs`
* readme formatting
* small fixes
* readme fixes
* docs: `helper/`
* docs: `types/`
* database/README.md fixes
* doc fixes
* types: doc fixes
* fixes
* all review changes
2024-05-05 15:21:28 +01:00
hinto-janai
3656a1ada7
database: return owned T
in Storable
( #92 )
...
* add `storable_slice.rs`
* storable: `from_bytes(&[u8]) -> Self`
* heed: return `T` in `Storable`, use `StorableSlice` in tests
* remove `value_guard.rs`
* redb: update `Storable` to return owned `T`
* database: return `T` directly, remove `'a` lifetime
* replace `[]` with `StorableSlice`
* tables: add lifetime to `tables!()` and generated structs
* backend: fix tests
* heed: update fn signatures
* storable: add `StorableVec`, remove `Storable::ALIGN`
* tables/types: remove slice lifetimes, use `StorableVec`
* backend: use `StorableVec`, fix tests
* types: fix tests to use owned returned value
* heed: fix `Storable` impl and tests
* storable: `StorableVec` docs + tests
* backend: assert values are detached from `get_range()` iterator
* database: add docs
* udpate docs, remove unneeded clippy `allow`
* replace `ToOwnedDebug` with `std::fmt::Debug`
* impl `StorableBytes`
* backend: add `StorableBytes` to tests
* readme: remove `to_owned_debug.rs` reference
2024-03-22 21:11:48 +00:00
hinto-janai
8f22d8ab79
database: impl trait function bodies for heed
& redb
( #85 )
...
* env: remove `T: Table` for `Env::create_tables()`
It creates _all_ tables, not a specific `T: Table`
* heed: half impl `Env::open()`, some TODOs
* heed: add `HeedTxR{o,w}<'env>`
* workspace/cargo: add `parking_lot`
* remove `parking_lot`
`MappedRwLockGuard` doesn't solve the `returning reference to
object owned by function` error when returning heed's lock guard
+ the tx so we'll be going with `std`
* env: add `{EnvInner,TxRoInput,TxRwInput}` and getter `fn()`s
* env: fix tx <-> table lifetimes, fix `Env::create_tables()`
* heed: impl `DatabaseRo`
* heed: impl `DatabaseRw`
* database: add `src/backend/${BACKEND}/tests.rs`
* heed: impl more of `Env::open()`
* redb: fix trait signatures, add `trait ValueGuard`
* accommodate `DatabaseRo` bounds for both `{heed,redb}`
* fold `get_range()` generic + bounds
* add `TxCreator`, add `heed` tests
* env: `TxCreator` -> `EnvInner` which doubles as DB/Table opener
* database: `DatabaseRw<'tx>` -> `DatabaseRw<'db, 'tx>`
* heed: `db_read_write()` test
* database: fix `get()` lifetimes, heed: add `db_read_write()` test
* database: remove `'env` lifetime from `DatabaseRo<'env, 'tx>`
not needed for immutable references
* redb: fix new `{Env, EnvInner, DatabaseR{o,w}}` bounds
* redb: impl `Database` traits
* redb: impl `TxR{o,w}` traits
* redb: impl `Env`
* redb: open/create tables in `Env::open`
* redb: enable tests, add tmp `Storable` printlns
* redb: fix alignment issue with `Cow` and `from_bytes_unaligned()`
* redb: only allocate bytes when alignment != 1
* heed: remove custom iterator from `range()`
* storable: conditionally allocat on misaligned bytes in `from_bytes`
* add database guard
* database: AccessGuard -> ValueGuard
* storable: add `ALIGN` and `from_bytes_unaligned()`
* redb: 1 serde type `StorableRedb`, fix impl
* cow serde, trait bounds, fix backend's where bounds
- Uses Cow for `redb`'s deserialization
- Conforms `heed` to use Cow (but not as the actual key/value)
- Conforms the `cuprate_database` trait API to use Cow
- Adds `ToOwned + Debug` (and permutation) trait bounds
- Solves 23098573148968945687345349657398 compiler errors due
to aforementioned trait bounds, causing `where` to be everywhere
* fix docs, use fully qualified Tx functions for tests
* backend: check value guard contains value in test
* add `Storable::ALIGN` tests, doc TODOs
* add `trait ToOwnedDebug`
* traits: `ToOwned + Debug` -> `ToOwnedDebug`
* heed: remove `ToOwned` + `Debug` bounds
* redb: remove `ToOwned` + `Debug` bounds
* add `ValueGuard`, replace signatures, fix `redb`
* heed: fix for `ValueGuard`
* docs, tests
* redb: add `CowRange` for `T::Key` -> `Cow<'_, T::Key>` conversion
* separate `config.rs` -> `config/`
* ci: combine tests, run both `heed` and `redb` tests
* ci: fix workflow
* backend: add `resize()` test
* ci: remove windows-specific update
* ci: remove update + windows default set
* backend: add `unreachable` tests, fix docs
* trait docs
* ci: fix
* Update database/src/backend/heed/env.rs
Co-authored-by: Boog900 <boog900@tutanota.com>
* Update database/src/backend/heed/env.rs
Co-authored-by: Boog900 <boog900@tutanota.com>
* Update database/src/backend/heed/transaction.rs
Co-authored-by: Boog900 <boog900@tutanota.com>
* Update database/src/backend/heed/transaction.rs
Co-authored-by: Boog900 <boog900@tutanota.com>
* Update database/src/backend/heed/transaction.rs
Co-authored-by: Boog900 <boog900@tutanota.com>
* Update database/src/backend/redb/database.rs
Co-authored-by: Boog900 <boog900@tutanota.com>
* Update database/src/backend/redb/database.rs
Co-authored-by: Boog900 <boog900@tutanota.com>
* Update database/src/backend/heed/database.rs
Co-authored-by: Boog900 <boog900@tutanota.com>
* readme: fix `value_guard.rs`
* heed: remove unneeded clippy + fix formatting
* heed: create and use `create_table()` in `Env::open()`
* redb: create and use `create_table()` in `Env::open()`
* redb: remove unneeded clippy
* fix clippy, remove `<[u8], [u8]>` docs
---------
Co-authored-by: Boog900 <54e72d8a-345f-4599-bd90-c6b9bc7d0ec5@aleeas.com>
Co-authored-by: Boog900 <boog900@tutanota.com>
2024-03-13 22:05:24 +00:00
hinto-janai
272ef18eb6
database: replace Pod
with bytemuck
( #81 )
...
* database: add `bytemuck`
* database: add `types` module, replace `Pod` with `bytemuck` traits
* types: docs
* types: more docs
* types: align safety msg
* types: docs
* misc docs
* add `storable.rs`
* add `slice.rs`
* storable: impl `impl_storable_checked_bit_pattern!()`
* database: TODO: fix `DatabaseRo::get_range` lifetimes
* key/table: trait bound fixes
* misc fixes
* remove `borsh`
- Doesn't work on must types
- Probably won't use it anyway
- Most things impl `serde`
* key: add `new_with_max_secondary()`
* key: add `new_with_max_secondary()`
* heed: add `StorableHeed` for `Storable` compat
* redb: add `StorableRedb{Key,Value}` for `Storable` compat
* storable: add `Debug` bound and `fixed_width()`
* redb: fix `'static` bound
* storable: docs
* `pod.rs` tests -> `storable.rs`
* redb: add `Storable` tests
* storable: add doc tests
* redb: simplify `Storable` tests
* heed: add `Storable` tests
* misc docs/fixes
* cargo: switch from forked `heed` -> `heed 0.20.0-alpha.9`
* update readme
* docs
* fix README
* table: remove `CONSTANT_SIZE`
* database: `get()/delete() -> Err(KeyNotFound)` instead of `Option`
2024-03-03 22:26:39 +00:00