bigtable: allow custom instance names
This commit is contained in:
committed by
Trent Nelson
parent
f513195468
commit
9b32b72990
@ -360,11 +360,14 @@ impl From<LegacyTransactionByAddrInfo> for TransactionByAddrInfo {
|
||||
}
|
||||
}
|
||||
|
||||
pub const DEFAULT_INSTANCE_NAME: &str = "solana-ledger";
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct LedgerStorageConfig {
|
||||
pub read_only: bool,
|
||||
pub timeout: Option<std::time::Duration>,
|
||||
pub credential_path: Option<String>,
|
||||
pub instance_name: String,
|
||||
}
|
||||
|
||||
impl Default for LedgerStorageConfig {
|
||||
@ -373,6 +376,7 @@ impl Default for LedgerStorageConfig {
|
||||
read_only: true,
|
||||
timeout: None,
|
||||
credential_path: None,
|
||||
instance_name: DEFAULT_INSTANCE_NAME.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -392,6 +396,7 @@ impl LedgerStorage {
|
||||
read_only,
|
||||
timeout,
|
||||
credential_path,
|
||||
..LedgerStorageConfig::default()
|
||||
})
|
||||
.await
|
||||
}
|
||||
@ -401,10 +406,15 @@ impl LedgerStorage {
|
||||
read_only,
|
||||
timeout,
|
||||
credential_path,
|
||||
instance_name,
|
||||
} = config;
|
||||
let connection =
|
||||
bigtable::BigTableConnection::new("solana-ledger", read_only, timeout, credential_path)
|
||||
.await?;
|
||||
let connection = bigtable::BigTableConnection::new(
|
||||
instance_name.as_str(),
|
||||
read_only,
|
||||
timeout,
|
||||
credential_path,
|
||||
)
|
||||
.await?;
|
||||
Ok(Self { connection })
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user