Rename open_with_access_type() to open_with_options() (#22123)

This commit is contained in:
Yueh-Hsuan Chiang 2022-01-07 12:11:43 -08:00 committed by GitHub
parent b11d3b5abf
commit 5771c36d3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 11 deletions

View File

@ -8,6 +8,7 @@ mod tests {
solana_core::ledger_cleanup_service::LedgerCleanupService, solana_core::ledger_cleanup_service::LedgerCleanupService,
solana_ledger::{ solana_ledger::{
blockstore::{make_many_slot_shreds, Blockstore}, blockstore::{make_many_slot_shreds, Blockstore},
blockstore_db::BlockstoreOptions,
get_tmp_ledger_path, get_tmp_ledger_path,
}, },
solana_measure::measure::Measure, solana_measure::measure::Measure,
@ -283,7 +284,8 @@ mod tests {
solana_logger::setup_with("error,ledger_cleanup::tests=info"); solana_logger::setup_with("error,ledger_cleanup::tests=info");
let ledger_path = get_tmp_ledger_path!(); let ledger_path = get_tmp_ledger_path!();
let mut blockstore = Blockstore::open(&ledger_path).unwrap(); let mut blockstore =
Blockstore::open_with_options(&ledger_path, BlockstoreOptions::default()).unwrap();
let config = get_benchmark_config(); let config = get_benchmark_config();
if config.no_compaction { if config.no_compaction {
blockstore.set_no_compaction(true); blockstore.set_no_compaction(true);

View File

@ -670,7 +670,7 @@ fn open_blockstore(
access_type: AccessType, access_type: AccessType,
wal_recovery_mode: Option<BlockstoreRecoveryMode>, wal_recovery_mode: Option<BlockstoreRecoveryMode>,
) -> Blockstore { ) -> Blockstore {
match Blockstore::open_with_access_type( match Blockstore::open_with_options(
ledger_path, ledger_path,
BlockstoreOptions { BlockstoreOptions {
access_type, access_type,

View File

@ -344,10 +344,7 @@ impl Blockstore {
Self::do_open(ledger_path, BlockstoreOptions::default()) Self::do_open(ledger_path, BlockstoreOptions::default())
} }
pub fn open_with_access_type( pub fn open_with_options(ledger_path: &Path, options: BlockstoreOptions) -> Result<Blockstore> {
ledger_path: &Path,
options: BlockstoreOptions,
) -> Result<Blockstore> {
Self::do_open(ledger_path, options) Self::do_open(ledger_path, options)
} }
@ -457,7 +454,7 @@ impl Blockstore {
ledger_path: &Path, ledger_path: &Path,
options: BlockstoreOptions, options: BlockstoreOptions,
) -> Result<BlockstoreSignals> { ) -> Result<BlockstoreSignals> {
let mut blockstore = Self::open_with_access_type(ledger_path, options)?; let mut blockstore = Self::open_with_options(ledger_path, options)?;
let (ledger_signal_sender, ledger_signal_receiver) = sync_channel(1); let (ledger_signal_sender, ledger_signal_receiver) = sync_channel(1);
let (completed_slots_sender, completed_slots_receiver) = let (completed_slots_sender, completed_slots_receiver) =
sync_channel(MAX_COMPLETED_SLOTS_IN_CHANNEL); sync_channel(MAX_COMPLETED_SLOTS_IN_CHANNEL);
@ -3755,7 +3752,7 @@ pub fn create_new_ledger(
genesis_config.write(ledger_path)?; genesis_config.write(ledger_path)?;
// Fill slot 0 with ticks that link back to the genesis_config to bootstrap the ledger. // Fill slot 0 with ticks that link back to the genesis_config to bootstrap the ledger.
let blockstore = Blockstore::open_with_access_type( let blockstore = Blockstore::open_with_options(
ledger_path, ledger_path,
BlockstoreOptions { BlockstoreOptions {
access_type, access_type,

View File

@ -70,7 +70,7 @@ pub fn remove_tower(tower_path: &Path, node_pubkey: &Pubkey) {
} }
pub fn open_blockstore(ledger_path: &Path) -> Blockstore { pub fn open_blockstore(ledger_path: &Path) -> Blockstore {
Blockstore::open_with_access_type( Blockstore::open_with_options(
ledger_path, ledger_path,
BlockstoreOptions { BlockstoreOptions {
access_type: AccessType::TryPrimaryThenSecondary, access_type: AccessType::TryPrimaryThenSecondary,

View File

@ -325,7 +325,7 @@ fn do_test_optimistic_confirmation_violation_with_or_without_tower(with_tower: b
if let Some((last_vote, _)) = last_vote_in_tower(&val_a_ledger_path, &validator_a_pubkey) { if let Some((last_vote, _)) = last_vote_in_tower(&val_a_ledger_path, &validator_a_pubkey) {
a_votes.push(last_vote); a_votes.push(last_vote);
let blockstore = Blockstore::open_with_access_type( let blockstore = Blockstore::open_with_options(
&val_a_ledger_path, &val_a_ledger_path,
BlockstoreOptions { BlockstoreOptions {
access_type: AccessType::TryPrimaryThenSecondary, access_type: AccessType::TryPrimaryThenSecondary,

View File

@ -175,7 +175,7 @@ fn start_client_rpc_services(
block_commitment_cache, block_commitment_cache,
} = bank_info; } = bank_info;
let blockstore = Arc::new( let blockstore = Arc::new(
Blockstore::open_with_access_type( Blockstore::open_with_options(
&replica_config.ledger_path, &replica_config.ledger_path,
BlockstoreOptions { BlockstoreOptions {
enforce_ulimit_nofile: false, enforce_ulimit_nofile: false,