mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-12-23 20:20:01 +00:00
db abstraction
This commit is contained in:
parent
86017f3291
commit
20f54e34d8
31 changed files with 70 additions and 24 deletions
|
@ -14,4 +14,4 @@ renderer = ["html"]
|
|||
default-theme = "ayu"
|
||||
preferred-dark-theme = "ayu"
|
||||
git-repository-url = "https://github.com/Cuprate/architecture-book"
|
||||
additional-css = ["last-changed.css"]
|
||||
additional-css = ["last-changed.css"]
|
|
@ -28,8 +28,8 @@
|
|||
---
|
||||
|
||||
- [🟢 Storage](storage/intro.md)
|
||||
- [🟢 Database abstraction](storage/db/intro.md)
|
||||
- [🟢 Backends](storage/db/backends/intro.md)
|
||||
- [🟢 Database abstraction](storage/db/database-abstraction.md)
|
||||
- [🟢 Backends](storage/db/backends.md)
|
||||
- [🟢 Layers](storage/db/layers/intro.md)
|
||||
- [🟢 Backend](storage/db/layers/backend.md)
|
||||
- [🟢 ConcreteEnv](storage/db/layers/concrete_env.md)
|
||||
|
@ -37,25 +37,26 @@
|
|||
- [🟢 Syncing](storage/db/syncing.md)
|
||||
- [🟢 Resizing](storage/db/resizing.md)
|
||||
- [🟢 (De)serialization](storage/db/serde.md)
|
||||
- [🟢 Schema](storage/db/schema/intro.md)
|
||||
- [🟢 Tables](storage/db/schema/tables.md)
|
||||
- [🟢 Multimap tables](storage/db/schema/multimap.md)
|
||||
- [🟢 Known issues and tradeoffs](storage/db/issues/intro.md)
|
||||
- [🟢 Traits abstracting backends](storage/db/issues/traits.md)
|
||||
- [🟢 Hot-swappable backends](storage/db/issues/hot-swap.md)
|
||||
- [🟢 Copying unaligned bytes](storage/db/issues/copy.md)
|
||||
- [🟢 Abstracting backends](storage/db/issues/traits.md)
|
||||
- [🟢 Hot-swap](storage/db/issues/hot-swap.md)
|
||||
- [🟢 Unaligned bytes](storage/db/issues/unaligned.md)
|
||||
- [🟢 Endianness](storage/db/issues/endian.md)
|
||||
- [🟢 Extra table data](storage/db/issues/extra-table-data.md)
|
||||
- [🟢 The layers](storage/db/layers/intro.md)
|
||||
- [🟢 `ops`](storage/db/layers/ops.md)
|
||||
- [🟢 `tower::Service`](storage/db/service/intro.md)
|
||||
- [🟢 Initialization](storage/db/service/initialization.md)
|
||||
- [🟢 Requests](storage/db/service/requests.md)
|
||||
- [🟢 Responses](storage/db/service/responses.md)
|
||||
- [🟢 Thread model](storage/db/service/thread-model.md)
|
||||
- [🟢 Shutdown](storage/db/service/shutdown.md)
|
||||
- [⚪️ Blockchain](storage/blockchain.md)
|
||||
- [⚪️ Transaction pool](storage/transaction-pool.md)
|
||||
- [🟢 Extra table data](storage/db/issues/extra.md)
|
||||
- [🟢 Common behavior](storage/common/intro.md)
|
||||
- [🟢 Types](storage/common/types.md)
|
||||
- [🟢 `ops`](storage/common/ops.md)
|
||||
- [🟢 `tower::Service`](storage/common/intro.md)
|
||||
- [🟢 Initialization](storage/common/initialization.md)
|
||||
- [🟢 Requests](storage/common/requests.md)
|
||||
- [🟢 Responses](storage/common/responses.md)
|
||||
- [🟢 Thread model](storage/common/thread-model.md)
|
||||
- [🟢 Shutdown](storage/common/shutdown.md)
|
||||
- [⚪️ Blockchain](storage/blockchain/intro.md)
|
||||
- [🟢 Schema](storage/blockchain/schema/intro.md)
|
||||
- [🟢 Tables](storage/blockchain/schema/tables.md)
|
||||
- [🟢 Multimap tables](storage/blockchain/schema/multimap.md)
|
||||
- [⚪️ Transaction pool](storage/txpool/intro.md)
|
||||
- [⚪️ Pruning](storage/pruning.md)
|
||||
|
||||
---
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# 🟢 Schema
|
|
@ -0,0 +1 @@
|
|||
# 🟢 Multimap tables
|
|
@ -0,0 +1 @@
|
|||
# 🟢 Tables
|
1
books/architecture/src/storage/blockchain/types.md
Normal file
1
books/architecture/src/storage/blockchain/types.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Types
|
1
books/architecture/src/storage/common/initialization.md
Normal file
1
books/architecture/src/storage/common/initialization.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Initialization
|
1
books/architecture/src/storage/common/intro.md
Normal file
1
books/architecture/src/storage/common/intro.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Common behavior
|
1
books/architecture/src/storage/common/ops.md
Normal file
1
books/architecture/src/storage/common/ops.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 ops
|
1
books/architecture/src/storage/common/requests.md
Normal file
1
books/architecture/src/storage/common/requests.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Requests
|
1
books/architecture/src/storage/common/responses.md
Normal file
1
books/architecture/src/storage/common/responses.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Responses
|
1
books/architecture/src/storage/common/shutdown.md
Normal file
1
books/architecture/src/storage/common/shutdown.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Shutdown
|
1
books/architecture/src/storage/common/thread-model.md
Normal file
1
books/architecture/src/storage/common/thread-model.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Thread model
|
1
books/architecture/src/storage/common/types.md
Normal file
1
books/architecture/src/storage/common/types.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Types
|
|
@ -1 +0,0 @@
|
|||
# ⚪️ Database abstraction
|
1
books/architecture/src/storage/db/backends.md
Normal file
1
books/architecture/src/storage/db/backends.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Backends
|
|
@ -0,0 +1 @@
|
|||
# 🟢 Initialization
|
1
books/architecture/src/storage/db/common/intro.md
Normal file
1
books/architecture/src/storage/db/common/intro.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Common behavior
|
1
books/architecture/src/storage/db/common/ops.md
Normal file
1
books/architecture/src/storage/db/common/ops.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 ops
|
1
books/architecture/src/storage/db/common/requests.md
Normal file
1
books/architecture/src/storage/db/common/requests.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Requests
|
1
books/architecture/src/storage/db/common/responses.md
Normal file
1
books/architecture/src/storage/db/common/responses.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Responses
|
1
books/architecture/src/storage/db/common/shutdown.md
Normal file
1
books/architecture/src/storage/db/common/shutdown.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Shutdown
|
1
books/architecture/src/storage/db/common/thread-model.md
Normal file
1
books/architecture/src/storage/db/common/thread-model.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Thread model
|
1
books/architecture/src/storage/db/common/types.md
Normal file
1
books/architecture/src/storage/db/common/types.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Types
|
21
books/architecture/src/storage/db/database-abstraction.md
Normal file
21
books/architecture/src/storage/db/database-abstraction.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Database abstraction
|
||||
[`cuprate_database`](https://doc.cuprate.org/cuprate_database) is Cuprate’s database abstraction.
|
||||
|
||||
This crate abstracts various database backends with `trait`s.
|
||||
|
||||
All backends have the following attributes:
|
||||
|
||||
- [Embedded](https://en.wikipedia.org/wiki/Embedded_database)
|
||||
- [Multiversion concurrency control](https://en.wikipedia.org/wiki/Multiversion_concurrency_control)
|
||||
- [ACID](https://en.wikipedia.org/wiki/ACID)
|
||||
- Are `(key, value)` oriented and have the expected API (`get()`, `insert()`, `delete()`)
|
||||
- Are table oriented (`"table_name" -> (key, value)`)
|
||||
- Allows concurrent readers
|
||||
|
||||
The currently implemented backends are:
|
||||
- [`heed`](https://github.com/meilisearch/heed) (LMDB)
|
||||
- [`redb`](https://github.com/cberner/redb)
|
||||
|
||||
Said precicely, `cuprate_database` is the embedded database other Cuprate
|
||||
crates interact with instead of using any particular backend implementation.
|
||||
This allows the backend to be swapped and/or future backends to be implemented.
|
1
books/architecture/src/storage/db/issues/extra.md
Normal file
1
books/architecture/src/storage/db/issues/extra.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Extra table data
|
1
books/architecture/src/storage/db/issues/unaligned.md
Normal file
1
books/architecture/src/storage/db/issues/unaligned.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Unaligned bytes
|
1
books/architecture/src/storage/db/layers/types.md
Normal file
1
books/architecture/src/storage/db/layers/types.md
Normal file
|
@ -0,0 +1 @@
|
|||
# 🟢 Types
|
|
@ -1,5 +1,5 @@
|
|||
# Storage
|
||||
This section covers all things related to the long-term on-disk storage of data within Cuprate.
|
||||
This section covers all things related to the on-disk storage of data within Cuprate.
|
||||
|
||||
## Overview
|
||||
The quick overview is that Cuprate has a [database abstraction crate](./database-abstraction.md)
|
||||
|
@ -12,9 +12,9 @@ This database abstraction crate is then used by all crates that need on-disk sto
|
|||
## Service
|
||||
The interface provided by all crates building on-top of the
|
||||
database abstraction is a [`tower::Service`](https://docs.rs/tower), i.e.
|
||||
database requests are sent, and database responses are received asynchronously.
|
||||
database requests/responses are sent/received asynchronously.
|
||||
|
||||
As the interface details are similar across databases (threadpool, read operations, write operations),
|
||||
As the interface details are similar across crates (threadpool, read operations, write operations),
|
||||
the interface itself is abstracted in the [`cuprate_database_service`](./db/layers/intro.md) crate,
|
||||
which is then used by the crates.
|
||||
|
||||
|
|
1
books/architecture/src/storage/txpool/intro.md
Normal file
1
books/architecture/src/storage/txpool/intro.md
Normal file
|
@ -0,0 +1 @@
|
|||
# ⚪️ Transaction pool
|
Loading…
Reference in a new issue