vaticle / typedb

TypeDB: the polymorphic database powered by types
https://typedb.com
Mozilla Public License 2.0
3.72k stars 337 forks source link

Replace shared references with reference counted pointers #7039

Closed dmitrii-ubskii closed 2 months ago

dmitrii-ubskii commented 2 months ago

Usage and motivation

We replace shared references (&) and Rcs with Arcs to simplify multithreaded behaviour.

This decision comes from the fundamental idea that Databases are not going to have any lexical lifetime - they are purely controlled by runtime/user intent. As a result, we cannot use storage or databases with basic Rust lifetimes.

Additionally, this decision sets us up transactions management on shutdown or database delete: transactions that are operating will be guaranteed the database is open. We will wait for current operations to finish + prevent new work from entering when trying to close the database. This will prevent a class of errors from from TypeDB 2.0 which were caused by 'resource's closing during transaction operation.

Implementation

WIP: the server builds and storage integration tests pass, but nothing else. Propagated to all tests so the whole codebase builds.