Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions configuration/src/configs/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct GeneralRpcServerConfig {
pub block_cache_size: f64,
pub shadow_data_consistency_rate: f64,
pub prefetch_state_size_limit: u64,
pub tx_details_storage_provider: StorageProvider,
}

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -68,7 +69,7 @@ pub struct CommonGeneralConfig {
pub tx_indexer: CommonGeneralTxIndexerConfig,
#[serde(default)]
pub state_indexer: CommonGeneralStateIndexerConfig,
#[serde(default)]
#[serde(deserialize_with = "deserialize_data_or_env")]
pub tx_details_storage_provider: StorageProvider,
}

Expand Down Expand Up @@ -194,8 +195,6 @@ pub struct CommonGeneralTxIndexerConfig {
pub indexer_id: Option<String>,
#[serde(deserialize_with = "deserialize_optional_data_or_env", default)]
pub metrics_server_port: Option<u16>,
#[serde(deserialize_with = "deserialize_optional_data_or_env", default)]
pub tx_details_storage_provider: Option<StorageProvider>,
}

impl CommonGeneralTxIndexerConfig {
Expand All @@ -213,7 +212,6 @@ impl Default for CommonGeneralTxIndexerConfig {
Self {
indexer_id: Some(Self::default_indexer_id()),
metrics_server_port: Some(Self::default_metrics_server_port()),
tx_details_storage_provider: Some(StorageProvider::Postgres),
}
}
}
Expand Down Expand Up @@ -292,6 +290,7 @@ impl From<CommonGeneralConfig> for GeneralRpcServerConfig {
.rpc_server
.prefetch_state_size_limit
.unwrap_or_else(CommonGeneralRpcServerConfig::default_prefetch_state_size_limit),
tx_details_storage_provider: common_config.tx_details_storage_provider,
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions configuration/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,11 @@ pub struct RpcServerConfig {
pub lake_config: lake::LakeConfig,
pub database: database::DatabaseConfig,
pub tx_details_storage: tx_details_storage::TxDetailsStorageConfig,
pub tx_details_storage_provider: general::StorageProvider,
}

impl Config for RpcServerConfig {
fn from_common_config(common_config: CommonConfig) -> Self {
Self {
tx_details_storage_provider: common_config.general.tx_details_storage_provider.clone(),
general: common_config.general.into(),
lake_config: common_config.lake_config.into(),
database: database::DatabaseConfig::from(common_config.database).to_read_only(),
Expand All @@ -144,7 +142,6 @@ pub struct TxIndexerConfig {
pub lake_config: lake::LakeConfig,
pub database: database::DatabaseConfig,
pub tx_details_storage: tx_details_storage::TxDetailsStorageConfig,
pub tx_details_storage_provider: general::StorageProvider,
}

impl TxIndexerConfig {
Expand All @@ -159,7 +156,6 @@ impl TxIndexerConfig {
impl Config for TxIndexerConfig {
fn from_common_config(common_config: CommonConfig) -> Self {
Self {
tx_details_storage_provider: common_config.general.tx_details_storage_provider.clone(),
general: common_config.general.into(),
rightsizing: common_config.rightsizing.into(),
lake_config: common_config.lake_config.into(),
Expand Down
10 changes: 5 additions & 5 deletions configuration/src/default_env_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ rpc_auth_token = "${RPC_AUTH_TOKEN}"
## Default value is redis://127.0.0.1/
redis_url = "${REDIS_URL}"

## Transaction details storage provider
## Options: "scylladb", "postgres"
## Default value is "postgres"
tx_details_storage_provider = "${TX_DETAILS_STORAGE_PROVIDER}"

### Rpc server general configuration
[general.rpc_server]

Expand Down Expand Up @@ -78,11 +83,6 @@ indexer_id = "${TX_INDEXER_ID}"
## By default it 8080 for tx-indexer and 8081 for state-indexer
metrics_server_port = "${TX_SERVER_PORT}"

## Transaction details storage provider
## Options: "scylla", "postgres"
## Default value is "postgres"
#tx_details_storage_provider = "${TX_DETAILS_STORAGE_PROVIDER}"

### State indexer general configuration
[general.state_indexer]

Expand Down
2 changes: 1 addition & 1 deletion rpc-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl ServerContext {
.await?;

let tx_details_storage: std::sync::Arc<dyn tx_details_storage::Storage + Send + Sync> =
match rpc_server_config.tx_details_storage_provider {
match rpc_server_config.general.tx_details_storage_provider {
configuration::StorageProvider::ScyllaDb => {
let scylla_session = rpc_server_config
.tx_details_storage
Expand Down
4 changes: 2 additions & 2 deletions tx-indexer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ async fn main() -> anyhow::Result<()> {
.lake_client(indexer_config.general.chain_id.clone())
.await?;

tracing::info!(target: INDEXER, "Instantiating the tx_details storage client with {:?} provider...", &indexer_config.tx_details_storage_provider);
tracing::info!(target: INDEXER, "Instantiating the tx_details storage client with {:?} provider...", &indexer_config.general.tx_details_storage_provider);
let tx_details_storage: std::sync::Arc<dyn tx_details_storage::Storage + Send + Sync> =
match indexer_config.tx_details_storage_provider {
match indexer_config.general.tx_details_storage_provider {
configuration::StorageProvider::ScyllaDb => {
let scylla_session = indexer_config
.tx_details_storage
Expand Down
Loading