Skip to content

Commit

Permalink
Renaming Rocksdb (#920)
Browse files Browse the repository at this point in the history
Renaming of Rocksdb into RocksDb and other related changes.
  • Loading branch information
MathieuDutSik authored Aug 3, 2023
1 parent 95ccd2e commit b8618e1
Show file tree
Hide file tree
Showing 18 changed files with 214 additions and 214 deletions.
20 changes: 10 additions & 10 deletions linera-core/src/unit_tests/client_test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use std::{
use tokio::sync::oneshot;

#[cfg(feature = "rocksdb")]
use {linera_storage::RocksdbStoreClient, tokio::sync::Semaphore};
use {linera_storage::RocksDbStoreClient, tokio::sync::Semaphore};

#[cfg(feature = "aws")]
use {
Expand Down Expand Up @@ -521,7 +521,7 @@ where

#[cfg(feature = "rocksdb")]
/// Limit concurrency for rocksdb tests to avoid "too many open files" errors.
pub static ROCKSDB_SEMAPHORE: Semaphore = Semaphore::const_new(5);
pub static ROCKS_DB_SEMAPHORE: Semaphore = Semaphore::const_new(5);

#[derive(Default)]
pub struct MakeMemoryStoreClient {
Expand Down Expand Up @@ -550,35 +550,35 @@ impl MakeMemoryStoreClient {

#[cfg(feature = "rocksdb")]
#[derive(Default)]
pub struct MakeRocksdbStoreClient {
pub struct MakeRocksDbStoreClient {
temp_dirs: Vec<tempfile::TempDir>,
wasm_runtime: Option<WasmRuntime>,
}

#[cfg(feature = "rocksdb")]
impl MakeRocksdbStoreClient {
/// Creates a [`MakeRocksdbStoreClient`] that uses the specified [`WasmRuntime`] to run WASM
impl MakeRocksDbStoreClient {
/// Creates a [`MakeRocksDbStoreClient`] that uses the specified [`WasmRuntime`] to run WASM
/// applications.
#[allow(dead_code)]
pub fn with_wasm_runtime(wasm_runtime: impl Into<Option<WasmRuntime>>) -> Self {
MakeRocksdbStoreClient {
MakeRocksDbStoreClient {
wasm_runtime: wasm_runtime.into(),
..MakeRocksdbStoreClient::default()
..MakeRocksDbStoreClient::default()
}
}
}

#[cfg(feature = "rocksdb")]
#[async_trait]
impl StoreBuilder for MakeRocksdbStoreClient {
type Store = RocksdbStoreClient;
impl StoreBuilder for MakeRocksDbStoreClient {
type Store = RocksDbStoreClient;

async fn build(&mut self) -> Result<Self::Store, anyhow::Error> {
let dir = tempfile::TempDir::new()?;
let path = dir.path().to_path_buf();
self.temp_dirs.push(dir);
let standard_max_cache_size = 1000;
Ok(RocksdbStoreClient::new(
Ok(RocksDbStoreClient::new(
path,
self.wasm_runtime,
standard_max_cache_size,
Expand Down
86 changes: 43 additions & 43 deletions linera-core/src/unit_tests/client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use linera_views::views::ViewError;
use test_log::test;

#[cfg(feature = "rocksdb")]
use crate::client::client_test_utils::{MakeRocksdbStoreClient, ROCKSDB_SEMAPHORE};
use crate::client::client_test_utils::{MakeRocksDbStoreClient, ROCKS_DB_SEMAPHORE};

#[cfg(feature = "aws")]
use crate::client::client_test_utils::MakeDynamoDbStoreClient;
Expand All @@ -38,9 +38,9 @@ pub async fn test_memory_initiating_valid_transfer() -> Result<(), anyhow::Error

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_initiating_valid_transfer() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_initiating_valid_transfer(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_initiating_valid_transfer() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_initiating_valid_transfer(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -94,9 +94,9 @@ async fn test_memory_claim_amount() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_claim_amount() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_claim_amount(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_claim_amount() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_claim_amount(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -178,9 +178,9 @@ async fn test_memory_rotate_key_pair() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_rotate_key_pair() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_rotate_key_pair(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_rotate_key_pair() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_rotate_key_pair(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -242,9 +242,9 @@ async fn test_memory_transfer_ownership() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_transfer_ownership() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_transfer_ownership(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_transfer_ownership() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_transfer_ownership(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -309,9 +309,9 @@ async fn test_memory_share_ownership() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_share_ownership() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_share_ownership(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_share_ownership() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_share_ownership(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -455,9 +455,9 @@ async fn test_memory_open_chain_then_close_it() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_open_chain_then_close_it() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_open_chain_then_close_it(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_open_chain_then_close_it() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_open_chain_then_close_it(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -507,9 +507,9 @@ async fn test_memory_transfer_then_open_chain() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_transfer_then_open_chain() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_transfer_then_open_chain(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_transfer_then_open_chain() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_transfer_then_open_chain(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -598,9 +598,9 @@ async fn test_memory_open_chain_then_transfer() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_open_chain_then_transfer() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_open_chain_then_transfer(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_open_chain_then_transfer() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_open_chain_then_transfer(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -678,9 +678,9 @@ async fn test_memory_close_chain() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_close_chain() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_close_chain(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_close_chain() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_close_chain(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -738,9 +738,9 @@ async fn test_memory_initiating_valid_transfer_too_many_faults() -> Result<(), a

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_initiating_valid_transfer_too_many_faults() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_initiating_valid_transfer_too_many_faults(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_initiating_valid_transfer_too_many_faults() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_initiating_valid_transfer_too_many_faults(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -785,9 +785,9 @@ async fn test_memory_bidirectional_transfer() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_bidirectional_transfer() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_bidirectional_transfer(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_bidirectional_transfer() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_bidirectional_transfer(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -909,9 +909,9 @@ async fn test_memory_receiving_unconfirmed_transfer() -> Result<(), anyhow::Erro

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_receiving_unconfirmed_transfer() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_receiving_unconfirmed_transfer(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_receiving_unconfirmed_transfer() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_receiving_unconfirmed_transfer(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -970,11 +970,11 @@ async fn test_memory_receiving_unconfirmed_transfer_with_lagging_sender_balances

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_receiving_unconfirmed_transfer_with_lagging_sender_balances(
async fn test_rocks_db_receiving_unconfirmed_transfer_with_lagging_sender_balances(
) -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_receiving_unconfirmed_transfer_with_lagging_sender_balances(
MakeRocksdbStoreClient::default(),
MakeRocksDbStoreClient::default(),
)
.await
}
Expand Down Expand Up @@ -1088,9 +1088,9 @@ async fn test_memory_change_voting_rights() -> Result<(), anyhow::Error> {

#[cfg(feature = "rocksdb")]
#[test(tokio::test)]
async fn test_rocksdb_change_voting_rights() -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_change_voting_rights(MakeRocksdbStoreClient::default()).await
async fn test_rocks_db_change_voting_rights() -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_change_voting_rights(MakeRocksDbStoreClient::default()).await
}

#[cfg(feature = "aws")]
Expand Down
32 changes: 16 additions & 16 deletions linera-core/src/unit_tests/wasm_client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::collections::BTreeMap;
use test_case::test_case;

#[cfg(feature = "rocksdb")]
use crate::client::client_tests::{MakeRocksdbStoreClient, ROCKSDB_SEMAPHORE};
use crate::client::client_tests::{MakeRocksDbStoreClient, ROCKS_DB_SEMAPHORE};

#[cfg(feature = "aws")]
use crate::client::client_tests::MakeDynamoDbStoreClient;
Expand All @@ -42,9 +42,9 @@ async fn test_memory_create_application(wasm_runtime: WasmRuntime) -> Result<(),
#[cfg_attr(feature = "wasmer", test_case(WasmRuntime::Wasmer ; "wasmer"))]
#[cfg_attr(feature = "wasmtime", test_case(WasmRuntime::Wasmtime ; "wasmtime"))]
#[test_log::test(tokio::test)]
async fn test_rocksdb_create_application(wasm_runtime: WasmRuntime) -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_create_application(MakeRocksdbStoreClient::with_wasm_runtime(wasm_runtime)).await
async fn test_rocks_db_create_application(wasm_runtime: WasmRuntime) -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_create_application(MakeRocksDbStoreClient::with_wasm_runtime(wasm_runtime)).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -142,11 +142,11 @@ async fn test_memory_run_application_with_dependency(
#[cfg_attr(feature = "wasmer", test_case(WasmRuntime::Wasmer ; "wasmer"))]
#[cfg_attr(feature = "wasmtime", test_case(WasmRuntime::Wasmtime ; "wasmtime"))]
#[test_log::test(tokio::test)]
async fn test_rocksdb_run_application_with_dependency(
async fn test_rocks_db_run_application_with_dependency(
wasm_runtime: WasmRuntime,
) -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_run_application_with_dependency(MakeRocksdbStoreClient::with_wasm_runtime(
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_run_application_with_dependency(MakeRocksDbStoreClient::with_wasm_runtime(
wasm_runtime,
))
.await
Expand Down Expand Up @@ -276,11 +276,11 @@ async fn test_memory_run_reentrant_application(
#[cfg_attr(feature = "wasmer", test_case(WasmRuntime::Wasmer ; "wasmer"))]
#[cfg_attr(feature = "wasmtime", test_case(WasmRuntime::Wasmtime ; "wasmtime"))]
#[test_log::test(tokio::test)]
async fn test_rocksdb_run_reentrant_application(
async fn test_rocks_db_run_reentrant_application(
wasm_runtime: WasmRuntime,
) -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_run_reentrant_application(MakeRocksdbStoreClient::with_wasm_runtime(wasm_runtime))
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_run_reentrant_application(MakeRocksDbStoreClient::with_wasm_runtime(wasm_runtime))
.await
}

Expand Down Expand Up @@ -373,9 +373,9 @@ async fn test_memory_cross_chain_message(wasm_runtime: WasmRuntime) -> Result<()
#[cfg_attr(feature = "wasmer", test_case(WasmRuntime::Wasmer ; "wasmer"))]
#[cfg_attr(feature = "wasmtime", test_case(WasmRuntime::Wasmtime ; "wasmtime"))]
#[test_log::test(tokio::test)]
async fn test_rocksdb_cross_chain_message(wasm_runtime: WasmRuntime) -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_cross_chain_message(MakeRocksdbStoreClient::with_wasm_runtime(wasm_runtime)).await
async fn test_rocks_db_cross_chain_message(wasm_runtime: WasmRuntime) -> Result<(), anyhow::Error> {
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_cross_chain_message(MakeRocksDbStoreClient::with_wasm_runtime(wasm_runtime)).await
}

#[cfg(feature = "aws")]
Expand Down Expand Up @@ -553,11 +553,11 @@ async fn test_memory_user_pub_sub_channels(wasm_runtime: WasmRuntime) -> Result<
#[cfg_attr(feature = "wasmer", test_case(WasmRuntime::Wasmer; "wasmer"))]
#[cfg_attr(feature = "wasmtime", test_case(WasmRuntime::Wasmtime; "wasmtime"))]
#[test_log::test(tokio::test)]
async fn test_rocksdb_user_pub_sub_channels(
async fn test_rocks_db_user_pub_sub_channels(
wasm_runtime: WasmRuntime,
) -> Result<(), anyhow::Error> {
let _lock = ROCKSDB_SEMAPHORE.acquire().await;
run_test_user_pub_sub_channels(MakeRocksdbStoreClient::with_wasm_runtime(wasm_runtime)).await
let _lock = ROCKS_DB_SEMAPHORE.acquire().await;
run_test_user_pub_sub_channels(MakeRocksDbStoreClient::with_wasm_runtime(wasm_runtime)).await
}

#[cfg(feature = "aws")]
Expand Down
6 changes: 3 additions & 3 deletions linera-core/src/unit_tests/wasm_worker_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use std::{
use test_case::test_case;

#[cfg(feature = "rocksdb")]
use linera_storage::RocksdbStoreClient;
use linera_storage::RocksDbStoreClient;

#[cfg(feature = "aws")]
use {linera_storage::DynamoDbStoreClient, linera_views::test_utils::LocalStackTestContext};
Expand All @@ -57,11 +57,11 @@ async fn test_memory_handle_certificates_to_create_application(
#[cfg_attr(feature = "wasmer", test_case(WasmRuntime::Wasmer ; "wasmer"))]
#[cfg_attr(feature = "wasmtime", test_case(WasmRuntime::Wasmtime ; "wasmtime"))]
#[test_log::test(tokio::test)]
async fn test_rocksdb_handle_certificates_to_create_application(
async fn test_rocks_db_handle_certificates_to_create_application(
wasm_runtime: WasmRuntime,
) -> Result<(), anyhow::Error> {
let dir = tempfile::TempDir::new().unwrap();
let client = RocksdbStoreClient::new(
let client = RocksDbStoreClient::new(
dir.path().to_path_buf(),
Some(wasm_runtime),
TEST_CACHE_SIZE,
Expand Down
Loading

0 comments on commit b8618e1

Please sign in to comment.