Skip to content

Commit

Permalink
[rename] DiemD[b,B] -> AptosD[b,B]
Browse files Browse the repository at this point in the history
  • Loading branch information
davidiw committed Mar 7, 2022
1 parent 5ab1e3d commit 1dc22e2
Show file tree
Hide file tree
Showing 60 changed files with 245 additions and 239 deletions.
4 changes: 2 additions & 2 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Each handler defines:

`index.rs` is the root of all routes, it handles `GET /`API and connects all resources' routes with error handling.

The service is launched with a `Context` instance, which holds all external components (e.g. DiemDB, mempool sender).
The service is launched with a `Context` instance, which holds all external components (e.g. AptosDB, mempool sender).
The `Context` object also serves as a facade of external components, and sharing some general functionalities across
all handlers.

Expand Down Expand Up @@ -83,7 +83,7 @@ Handler tests should cover all aspects of features and functions.
A `TestContext` is implemented to create components' stubs that API handlers are connected to.
These stubs are more close to real production components, instead of mocks, so that tests can ensure the API
handlers are working well with other components in the systems.
For example, we use real DiemDB implementation in tests for API layers to interact with the database.
For example, we use real AptosDB implementation in tests for API layers to interact with the database.

Most of the utility functions are provided by the `TestContext`.

Expand Down
8 changes: 4 additions & 4 deletions api/src/tests/test_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use aptos_types::{
transaction::{Transaction, TransactionStatus},
};
use aptos_vm::DiemVM;
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use bytes::Bytes;
use executor::db_bootstrapper;
use executor_types::BlockExecutorTrait;
Expand Down Expand Up @@ -61,7 +61,7 @@ pub fn new_test_context() -> TestContext {
let (root_keys, genesis, genesis_waypoint, validators) = builder.build(&mut rng).unwrap();
let validator_owner = validators[0].storage().get(OWNER_ACCOUNT).unwrap().value;

let (db, db_rw) = DbReaderWriter::wrap(DiemDB::new_for_test(&tmp_dir));
let (db, db_rw) = DbReaderWriter::wrap(AptosDB::new_for_test(&tmp_dir));
let ret =
db_bootstrapper::maybe_bootstrap::<DiemVM>(&db_rw, &genesis, genesis_waypoint).unwrap();
assert!(ret);
Expand Down Expand Up @@ -90,7 +90,7 @@ pub struct TestContext {
pub context: Context,
pub validator_owner: AccountAddress,
pub mempool: Arc<MockSharedMempool>,
pub db: Arc<DiemDB>,
pub db: Arc<AptosDB>,
rng: rand::rngs::StdRng,
root_keys: Arc<RootKeys>,
executor: Arc<dyn BlockExecutorTrait>,
Expand All @@ -105,7 +105,7 @@ impl TestContext {
validator_owner: AccountAddress,
executor: Box<dyn BlockExecutorTrait>,
mempool: MockSharedMempool,
db: Arc<DiemDB>,
db: Arc<AptosDB>,
) -> Self {
Self {
context,
Expand Down
4 changes: 2 additions & 2 deletions aptos-move/aptos-validator-interface/src/storage_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ use aptos_types::{
event::EventKey,
transaction::{Transaction, Version},
};
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use std::{convert::TryFrom, path::Path, sync::Arc};
use storage_interface::{DbReader, Order};

pub struct DBDebuggerInterface(Arc<dyn DbReader>);

impl DBDebuggerInterface {
pub fn open<P: AsRef<Path> + Clone>(db_root_path: P) -> Result<Self> {
Ok(Self(Arc::new(DiemDB::open(
Ok(Self(Arc::new(AptosDB::open(
db_root_path,
true,
None,
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/transaction-replay/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use structopt::StructOpt;

#[derive(Debug, StructOpt)]
struct Opt {
/// Path to the local DiemDB file
/// Path to the local AptosDB file
#[structopt(long, parse(from_os_str))]
db: Option<PathBuf>,
/// Full URL address to connect to - should include port number, if applicable
Expand Down
4 changes: 2 additions & 2 deletions aptos-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use aptos_types::{
waypoint::Waypoint,
};
use aptos_vm::DiemVM;
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use backup_service::start_backup_service;
use consensus::consensus_provider::start_consensus;
use consensus_notifications::ConsensusNotificationListener;
Expand Down Expand Up @@ -441,7 +441,7 @@ pub fn setup_environment(node_config: &NodeConfig, logger: Option<Arc<Logger>>)

let mut instant = Instant::now();
let (diem_db, db_rw) = DbReaderWriter::wrap(
DiemDB::open(
AptosDB::open(
&node_config.storage.dir(),
false, /* readonly */
node_config.storage.prune_window,
Expand Down
2 changes: 1 addition & 1 deletion config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ and other network configuration parameters
Rules
- StateSyncConfig - Specifies parameters around state sycnhronization and the
set of peers that provide the data
- StorageConfig - Where the DiemDB is stored and its gRPC service endpoints
- StorageConfig - Where the AptosDB is stored and its gRPC service endpoints

### External Component Configurations
Outside of each Diem Node, external components can also be configured:
Expand Down
4 changes: 2 additions & 2 deletions config/management/genesis/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use aptos_types::{
validator_config::ValidatorConfig, waypoint::Waypoint,
};
use aptos_vm::DiemVM;
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use executor::db_bootstrapper;
use std::{
convert::TryFrom,
Expand Down Expand Up @@ -209,7 +209,7 @@ fn compute_genesis(
genesis_path: &Path,
db_path: &Path,
) -> Result<(DbReaderWriter, Waypoint), Error> {
let aptosdb = DiemDB::open(
let aptosdb = AptosDB::open(
db_path,
false,
None,
Expand Down
4 changes: 2 additions & 2 deletions config/management/genesis/src/waypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use aptos_management::{config::ConfigPath, error::Error, secure_backend::SharedB
use aptos_temppath::TempPath;
use aptos_types::{chain_id::ChainId, transaction::Transaction, waypoint::Waypoint};
use aptos_vm::DiemVM;
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use executor::db_bootstrapper;
use storage_interface::DbReaderWriter;
use structopt::StructOpt;
Expand Down Expand Up @@ -40,7 +40,7 @@ impl CreateWaypoint {

pub fn create_genesis_waypoint(genesis: &Transaction) -> Result<Waypoint, Error> {
let path = TempPath::new();
let aptosdb = DiemDB::open(
let aptosdb = AptosDB::open(
&path,
false,
None,
Expand Down
2 changes: 1 addition & 1 deletion config/src/config/storage_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
path::PathBuf,
};

/// Port selected RocksDB options for tuning underlying rocksdb instance of DiemDB.
/// Port selected RocksDB options for tuning underlying rocksdb instance of AptosDB.
/// see https://github.com/facebook/rocksdb/blob/master/include/rocksdb/options.h
/// for detailed explanations.
#[derive(Copy, Clone, Debug, Deserialize, PartialEq, Serialize)]
Expand Down
5 changes: 3 additions & 2 deletions consensus/src/epoch_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
ordering_state_computer::OrderingStateComputer,
},
liveness::{
leader_reputation::{ActiveInactiveHeuristic, DiemDBBackend, LeaderReputation},
leader_reputation::{ActiveInactiveHeuristic, AptosDBBackend, LeaderReputation},
proposal_generator::ProposalGenerator,
proposer_election::ProposerElection,
rotating_proposer_election::{choose_leader, RotatingProposer},
Expand Down Expand Up @@ -184,7 +184,8 @@ impl EpochManager {
))
}
ConsensusProposerType::LeaderReputation(heuristic_config) => {
let backend = Box::new(DiemDBBackend::new(proposers.len(), self.storage.diem_db()));
let backend =
Box::new(AptosDBBackend::new(proposers.len(), self.storage.diem_db()));
let heuristic = Box::new(ActiveInactiveHeuristic::new(
self.author,
heuristic_config.active_weights,
Expand Down
6 changes: 3 additions & 3 deletions consensus/src/liveness/leader_reputation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ pub trait MetadataBackend: Send + Sync {
fn get_block_metadata(&self, target_round: Round) -> Vec<NewBlockEvent>;
}

pub struct DiemDBBackend {
pub struct AptosDBBackend {
window_size: usize,
diem_db: Arc<dyn DbReader>,
window: Mutex<Vec<(u64, NewBlockEvent)>>,
}

impl DiemDBBackend {
impl AptosDBBackend {
pub fn new(window_size: usize, diem_db: Arc<dyn DbReader>) -> Self {
Self {
window_size,
Expand Down Expand Up @@ -63,7 +63,7 @@ impl DiemDBBackend {
}
}

impl MetadataBackend for DiemDBBackend {
impl MetadataBackend for AptosDBBackend {
// assume the target_round only increases
fn get_block_metadata(&self, target_round: Round) -> Vec<NewBlockEvent> {
let (known_version, known_round) = self
Expand Down
6 changes: 3 additions & 3 deletions execution/db-bootstrapper/src/bin/db-bootstrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use aptos_config::config::RocksdbConfig;
use aptos_temppath::TempPath;
use aptos_types::{transaction::Transaction, waypoint::Waypoint};
use aptos_vm::DiemVM;
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use executor::db_bootstrapper::calculate_genesis;
use std::{
fs::File,
Expand Down Expand Up @@ -51,7 +51,7 @@ fn main() -> Result<()> {
let tmpdir;

let db = if opt.commit {
DiemDB::open(
AptosDB::open(
&opt.db_dir,
false,
None, /* pruner */
Expand All @@ -62,7 +62,7 @@ fn main() -> Result<()> {
// When not committing, we open the DB as secondary so the tool is usable along side a
// running node on the same DB. Using a TempPath since it won't run for long.
tmpdir = TempPath::new();
DiemDB::open_as_secondary(
AptosDB::open_as_secondary(
opt.db_dir.as_path(),
tmpdir.path(),
RocksdbConfig::default(),
Expand Down
6 changes: 3 additions & 3 deletions execution/executor-benchmark/src/db_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use aptos_jellyfish_merkle::metrics::{
};
use aptos_vm::DiemVM;
use aptosdb::{
metrics::DIEM_STORAGE_ROCKSDB_PROPERTIES, schema::JELLYFISH_MERKLE_NODE_CF_NAME, DiemDB,
metrics::DIEM_STORAGE_ROCKSDB_PROPERTIES, schema::JELLYFISH_MERKLE_NODE_CF_NAME, AptosDB,
};
use executor::{
block_executor::BlockExecutor,
Expand Down Expand Up @@ -44,7 +44,7 @@ pub fn run(
let (config, genesis_key) = aptos_genesis_tool::test_config();
// Create executor.
let (db, db_rw) = DbReaderWriter::wrap(
DiemDB::open(
AptosDB::open(
&db_dir,
false, /* readonly */
prune_window, /* pruner */
Expand Down Expand Up @@ -125,7 +125,7 @@ pub fn run(
let internal_bytes = DIEM_JELLYFISH_INTERNAL_ENCODED_BYTES.get();
println!("=============FINISHED DB CREATION =============");
println!(
"created a DiemDB til version {} with {} accounts.",
"created a AptosDB til version {} with {} accounts.",
final_version, num_accounts,
);
println!("DB dir: {}", db_dir.as_ref().display());
Expand Down
6 changes: 3 additions & 3 deletions execution/executor-benchmark/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use aptos_config::config::{NodeConfig, RocksdbConfig};
use aptos_logger::prelude::*;

use aptos_vm::DiemVM;
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use executor::block_executor::BlockExecutor;
use executor_types::BlockExecutorTrait;
use std::{
Expand All @@ -26,7 +26,7 @@ use storage_interface::{DbReader, DbReaderWriter};

pub fn init_db_and_executor(config: &NodeConfig) -> (Arc<dyn DbReader>, BlockExecutor<DiemVM>) {
let (db, dbrw) = DbReaderWriter::wrap(
DiemDB::open(
AptosDB::open(
&config.storage.dir(),
false, /* readonly */
None, /* pruner */
Expand Down Expand Up @@ -55,7 +55,7 @@ pub fn run_benchmark(
}
std::fs::create_dir_all(checkpoint_dir.as_ref()).unwrap();

DiemDB::open(
AptosDB::open(
&source_dir,
true, /* readonly */
None, /* pruner */
Expand Down
13 changes: 9 additions & 4 deletions execution/executor-test-helpers/src/integration_test_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ use aptos_types::{
waypoint::Waypoint,
};
use aptos_vm::DiemVM;
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use executor::block_executor::BlockExecutor;
use executor_types::BlockExecutorTrait;
use rand::SeedableRng;
use std::{convert::TryFrom, sync::Arc};
use storage_interface::{DbReaderWriter, Order};

pub fn test_execution_with_storage_impl() -> Arc<DiemDB> {
pub fn test_execution_with_storage_impl() -> Arc<AptosDB> {
let (genesis, validators) = vm_genesis::test_genesis_change_set_and_validators(Some(1));
let genesis_txn = Transaction::GenesisTransaction(WriteSetPayload::Direct(genesis));
let genesis_key = &vm_genesis::GENESIS_KEYPAIR.0;
Expand Down Expand Up @@ -512,8 +512,13 @@ pub fn test_execution_with_storage_impl() -> Arc<DiemDB> {
pub fn create_db_and_executor<P: AsRef<std::path::Path>>(
path: P,
genesis: &Transaction,
) -> (Arc<DiemDB>, DbReaderWriter, BlockExecutor<DiemVM>, Waypoint) {
let (db, dbrw) = DbReaderWriter::wrap(DiemDB::new_for_test(&path));
) -> (
Arc<AptosDB>,
DbReaderWriter,
BlockExecutor<DiemVM>,
Waypoint,
) {
let (db, dbrw) = DbReaderWriter::wrap(AptosDB::new_for_test(&path));
let waypoint = bootstrap_genesis::<DiemVM>(&dbrw, genesis).unwrap();
let executor = BlockExecutor::new(dbrw.clone());

Expand Down
4 changes: 2 additions & 2 deletions execution/executor-test-helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use aptos_types::{
waypoint::Waypoint,
};
use aptos_vm::{DiemVM, VMExecutor};
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use executor::db_bootstrapper::{generate_waypoint, maybe_bootstrap};
use executor_types::StateComputeResult;
use std::{
Expand All @@ -43,7 +43,7 @@ pub fn start_storage_service() -> (NodeConfig, JoinHandle<()>, DbReaderWriter) {
let (mut config, _genesis_key) = aptos_genesis_tool::test_config();
let server_port = utils::get_available_port();
config.storage.address = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), server_port);
let (db, db_rw) = DbReaderWriter::wrap(DiemDB::new_for_test(&config.storage.dir()));
let (db, db_rw) = DbReaderWriter::wrap(AptosDB::new_for_test(&config.storage.dir()));
bootstrap_genesis::<DiemVM>(&db_rw, utils::get_genesis_txn(&config).unwrap()).unwrap();
let handle = start_storage_service_with_db(&config, db);
(config, handle, db_rw)
Expand Down
4 changes: 2 additions & 2 deletions execution/executor/src/tests/chunk_executor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use aptos_types::{
ledger_info::LedgerInfoWithSignatures,
transaction::{TransactionListWithProof, TransactionOutputListWithProof},
};
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use executor_types::{BlockExecutorTrait, ChunkExecutorTrait};
use proptest::prelude::Rng;
use storage_interface::DbReaderWriter;
Expand All @@ -30,7 +30,7 @@ impl TestExecutor {
pub fn new() -> TestExecutor {
let path = aptos_temppath::TempPath::new();
path.create_as_dir().unwrap();
let db = DbReaderWriter::new(DiemDB::new_for_test(path.path()));
let db = DbReaderWriter::new(AptosDB::new_for_test(path.path()));
let genesis = vm_genesis::test_genesis_transaction();
let waypoint = generate_waypoint::<MockVM>(&db, &genesis).unwrap();
maybe_bootstrap::<MockVM>(&db, &genesis, waypoint).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions execution/executor/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use aptos_types::{
proof::definition::LeafCount,
transaction::{Transaction, TransactionListWithProof, TransactionStatus, Version},
};
use aptosdb::DiemDB;
use aptosdb::AptosDB;
use executor_types::{BlockExecutorTrait, ChunkExecutorTrait, ExecutedTrees, TransactionReplayer};
use proptest::prelude::*;
use std::collections::BTreeMap;
Expand Down Expand Up @@ -56,7 +56,7 @@ impl TestExecutor {
fn new() -> TestExecutor {
let path = aptos_temppath::TempPath::new();
path.create_as_dir().unwrap();
let db = DbReaderWriter::new(DiemDB::new_for_test(path.path()));
let db = DbReaderWriter::new(AptosDB::new_for_test(path.path()));
let genesis = vm_genesis::test_genesis_transaction();
let waypoint = generate_waypoint::<MockVM>(&db, &genesis).unwrap();
maybe_bootstrap::<MockVM>(&db, &genesis, waypoint).unwrap();
Expand Down
Loading

0 comments on commit 1dc22e2

Please sign in to comment.