Skip to content

Commit b5b8941

Browse files
frisitanogreged93
andauthored
feat: refactor database locking model (#321)
* refactor database locking model * fix prepare on strat up * put DatabaseConnectionProvider behind test-utils feature flag * Revert "put DatabaseConnectionProvider behind test-utils feature flag" This reverts commit 9b0ed39. --------- Co-authored-by: greg <[email protected]>
1 parent 7594970 commit b5b8941

File tree

20 files changed

+688
-409
lines changed

20 files changed

+688
-409
lines changed

Cargo.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/chain-orchestrator/src/lib.rs

Lines changed: 87 additions & 48 deletions
Large diffs are not rendered by default.

crates/database/db/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ rollup-node-primitives.workspace = true
2626
async-trait.workspace = true
2727
auto_impl.workspace = true
2828
futures.workspace = true
29+
metrics.workspace = true
30+
metrics-derive.workspace = true
2931
sea-orm = { workspace = true, features = ["sqlx-sqlite", "runtime-tokio-native-tls", "macros"] }
32+
tempfile = { version = "3.20.0", optional = true }
3033
thiserror.workspace = true
3134
tokio = { workspace = true, features = ["macros", "sync"] }
3235
tracing.workspace = true
@@ -41,4 +44,4 @@ arbitrary.workspace = true
4144
rand.workspace = true
4245

4346
[features]
44-
test-utils = ["dep:scroll-migration"]
47+
test-utils = ["dep:scroll-migration", "dep:tempfile"]

crates/database/db/src/connection.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// The [`DatabaseConnectionProvider`] trait provides a way to get a connection to the database.
2-
/// This is implemented by the [`crate::Database`] and [`crate::DatabaseTransaction`] types.
32
#[auto_impl::auto_impl(Arc)]
43
pub trait DatabaseConnectionProvider {
54
/// The type of the database connection.
@@ -9,3 +8,9 @@ pub trait DatabaseConnectionProvider {
98
/// `StreamTrait` traits.
109
fn get_connection(&self) -> &Self::Connection;
1110
}
11+
12+
/// A trait for providing read-only access to the database.
13+
pub trait ReadConnectionProvider: DatabaseConnectionProvider {}
14+
15+
/// A trait for providing read and write access to the database.
16+
pub trait WriteConnectionProvider: ReadConnectionProvider {}

0 commit comments

Comments
 (0)