-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It still has much better compile times yet doesn't block when creating multiple transactions. It also is actively maintained and doesn't grow our tree. The MPT aspects are irrelevant.
- Loading branch information
1 parent
3b7bc5a
commit ca17342
Showing
19 changed files
with
75 additions
and
86 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use std::sync::Arc; | ||
|
||
pub use ::parity_db::Db as ParityDb; | ||
use ::redb::*; | ||
|
||
use crate::*; | ||
|
||
pub struct Transaction<'a>(&'a Arc<ParityDb>, Vec<(u8, Vec<u8>, Option<Vec<u8>>)>); | ||
|
||
impl Get for Transaction<'_> { | ||
fn get(&self, key: impl AsRef<[u8]>) -> Option<Vec<u8>> { | ||
self.0.get(key) | ||
} | ||
} | ||
impl DbTxn for Transaction<'_> { | ||
fn put(&mut self, key: impl AsRef<[u8]>, value: impl AsRef<[u8]>) { | ||
self.1.push((0, key.as_ref().to_vec(), Some(value.as_ref().to_vec()))) | ||
} | ||
fn del(&mut self, key: impl AsRef<[u8]>) { | ||
self.1.push((0, key.as_ref().to_vec(), None)) | ||
} | ||
fn commit(self) { | ||
self.0.commit(self.1).unwrap() | ||
} | ||
} | ||
|
||
impl Get for Arc<ParityDb> { | ||
fn get(&self, key: impl AsRef<[u8]>) -> Option<Vec<u8>> { | ||
ParityDb::get(&*self, 0, key.as_ref()).unwrap() | ||
} | ||
} | ||
impl Db for Arc<ParityDb> { | ||
type Transaction<'a> = Transaction<'a>; | ||
fn txn(&mut self) -> Self::Transaction<'_> { | ||
Transaction(self, vec![]) | ||
} | ||
} | ||
|
||
pub fn new_parity_db(path: &str) -> Arc<ParityDb> { | ||
Arc::new(ParityDb::open_or_crate(Options::with_columns(path, 1)).unwrap()) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
cargo build -p serai-coordinator --features redb && \ | ||
cargo build -p serai-coordinator --features parity-db && \ | ||
mv /serai/target/debug/serai-coordinator /serai/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
cargo build --features redb -p serai-message-queue && \ | ||
cargo build --features parity-db -p serai-message-queue && \ | ||
mv /serai/target/debug/serai-message-queue /serai/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
cargo build --features "binaries redb bitcoin" -p serai-processor && \ | ||
cargo build --features "binaries parity-db bitcoin" -p serai-processor && \ | ||
mv /serai/target/debug/serai-processor /serai/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
cargo build --features "binaries redb monero" -p serai-processor && \ | ||
cargo build --features "binaries parity-db monero" -p serai-processor && \ | ||
mv /serai/target/debug/serai-processor /serai/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters