bigtable: allow custom instance names

This commit is contained in:
Trent Nelson
2022-03-19 01:04:17 -06:00
committed by Trent Nelson
parent f513195468
commit 9b32b72990
7 changed files with 93 additions and 8 deletions

View File

@ -165,12 +165,24 @@ impl JsonRpcConfig {
}
}
#[derive(Debug, Default, Clone)]
#[derive(Debug, Clone)]
pub struct RpcBigtableConfig {
pub enable_bigtable_ledger_upload: bool,
pub bigtable_instance_name: String,
pub timeout: Option<Duration>,
}
impl Default for RpcBigtableConfig {
fn default() -> Self {
let bigtable_instance_name = solana_storage_bigtable::DEFAULT_INSTANCE_NAME.to_string();
Self {
enable_bigtable_ledger_upload: false,
bigtable_instance_name,
timeout: None,
}
}
}
#[derive(Clone)]
pub struct JsonRpcRequestProcessor {
bank_forks: Arc<RwLock<BankForks>>,

View File

@ -378,13 +378,15 @@ impl JsonRpcService {
let (bigtable_ledger_storage, _bigtable_ledger_upload_service) =
if let Some(RpcBigtableConfig {
enable_bigtable_ledger_upload,
ref bigtable_instance_name,
timeout,
}) = config.rpc_bigtable_config
{
let bigtable_config = solana_storage_bigtable::LedgerStorageConfig {
read_only: !config.enable_bigtable_ledger_upload,
timeout: config.rpc_bigtable_timeout,
read_only: !enable_bigtable_ledger_upload,
timeout,
credential_path: None,
instance_name: bigtable_instance_name.clone(),
};
runtime
.block_on(solana_storage_bigtable::LedgerStorage::new_with_config(