Refactor validator bigtable config
This commit is contained in:
committed by
Trent Nelson
parent
99f1a43262
commit
63ee00e647
@ -146,13 +146,11 @@ pub struct JsonRpcConfig {
|
||||
pub enable_cpi_and_log_storage: bool,
|
||||
pub faucet_addr: Option<SocketAddr>,
|
||||
pub health_check_slot_distance: u64,
|
||||
pub enable_bigtable_ledger_storage: bool,
|
||||
pub enable_bigtable_ledger_upload: bool,
|
||||
pub rpc_bigtable_config: Option<RpcBigtableConfig>,
|
||||
pub max_multiple_accounts: Option<usize>,
|
||||
pub account_indexes: AccountSecondaryIndexes,
|
||||
pub rpc_threads: usize,
|
||||
pub rpc_niceness_adj: i8,
|
||||
pub rpc_bigtable_timeout: Option<Duration>,
|
||||
pub full_api: bool,
|
||||
pub obsolete_v1_7_api: bool,
|
||||
pub rpc_scan_and_fix_roots: bool,
|
||||
@ -167,6 +165,12 @@ impl JsonRpcConfig {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct RpcBigtableConfig {
|
||||
pub enable_bigtable_ledger_upload: bool,
|
||||
pub timeout: Option<Duration>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct JsonRpcRequestProcessor {
|
||||
bank_forks: Arc<RwLock<BankForks>>,
|
||||
|
@ -376,18 +376,21 @@ impl JsonRpcService {
|
||||
let exit_bigtable_ledger_upload_service = Arc::new(AtomicBool::new(false));
|
||||
|
||||
let (bigtable_ledger_storage, _bigtable_ledger_upload_service) =
|
||||
if config.enable_bigtable_ledger_storage || config.enable_bigtable_ledger_upload {
|
||||
if let Some(RpcBigtableConfig {
|
||||
enable_bigtable_ledger_upload,
|
||||
timeout,
|
||||
}) = config.rpc_bigtable_config
|
||||
{
|
||||
runtime
|
||||
.block_on(solana_storage_bigtable::LedgerStorage::new(
|
||||
!config.enable_bigtable_ledger_upload,
|
||||
config.rpc_bigtable_timeout,
|
||||
!enable_bigtable_ledger_upload,
|
||||
timeout,
|
||||
None,
|
||||
))
|
||||
.map(|bigtable_ledger_storage| {
|
||||
info!("BigTable ledger storage initialized");
|
||||
|
||||
let bigtable_ledger_upload_service = if config.enable_bigtable_ledger_upload
|
||||
{
|
||||
let bigtable_ledger_upload_service = if enable_bigtable_ledger_upload {
|
||||
Some(Arc::new(BigTableUploadService::new(
|
||||
runtime.clone(),
|
||||
bigtable_ledger_storage.clone(),
|
||||
|
Reference in New Issue
Block a user