Skip to content

Commit 1ff29f4

Browse files
apollo_deployments: cleanups
1 parent 7dbfe7c commit 1ff29f4

File tree

4 files changed

+5
-102
lines changed

4 files changed

+5
-102
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_deployments/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ workspace = true
1111

1212
[dependencies]
1313
apollo_config.workspace = true
14-
apollo_http_server_config.workspace = true
1514
apollo_infra.workspace = true
1615
apollo_infra_utils.workspace = true
17-
apollo_monitoring_endpoint_config.workspace = true
1816
apollo_node_config.workspace = true
1917
phf = { workspace = true, features = ["macros"] }
2018
serde.workspace = true

crates/apollo_deployments/src/deployment_definitions.rs

Lines changed: 4 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,22 @@
1-
use apollo_http_server_config::config::HTTP_SERVER_PORT;
2-
use apollo_monitoring_endpoint_config::config::MONITORING_ENDPOINT_DEFAULT_PORT;
31
use apollo_node_config::component_execution_config::DEFAULT_INVALID_PORT;
4-
use serde::{Deserialize, Serialize};
2+
use serde::Serialize;
53
use static_assertions::const_assert_ne;
6-
use strum::{EnumDiscriminants, EnumIter, IntoEnumIterator};
4+
use strum::EnumIter;
75
use strum_macros::{AsRefStr, Display};
86

97
#[cfg(test)]
108
#[path = "deployment_definitions_test.rs"]
119
mod deployment_definitions_test;
1210

13-
// TODO(Tsabary): check if these ports are required.
14-
pub(crate) const CONSENSUS_P2P_PORT: u16 = 53080;
15-
pub(crate) const MEMPOOL_P2P_PORT: u16 = 53200;
16-
1711
pub(crate) const CONFIG_BASE_DIR: &str = "crates/apollo_deployments/resources/";
18-
19-
const BASE_APP_CONFIGS_DIR_PATH: &str = "crates/apollo_deployments/resources/app_configs";
20-
2112
pub(crate) const INFRA_PORT_PLACEHOLDER: u16 = 1;
2213
const_assert_ne!(INFRA_PORT_PLACEHOLDER, DEFAULT_INVALID_PORT);
2314

24-
#[derive(Clone, Debug, Serialize, PartialEq)]
25-
pub struct StateSyncConfig {
26-
#[serde(rename = "state_sync_config.central_sync_client_config.#is_none")]
27-
state_sync_config_central_sync_client_config_is_none: bool,
28-
#[serde(rename = "state_sync_config.p2p_sync_client_config.#is_none")]
29-
state_sync_config_p2p_sync_client_config_is_none: bool,
30-
#[serde(rename = "state_sync_config.network_config.#is_none")]
31-
state_sync_config_network_config_is_none: bool,
32-
}
33-
34-
#[derive(Clone, Debug, Serialize, Deserialize)]
35-
pub enum StateSyncType {
36-
Central,
37-
P2P,
38-
}
39-
40-
impl StateSyncType {
41-
pub fn get_state_sync_config(&self) -> StateSyncConfig {
42-
match self {
43-
StateSyncType::Central => StateSyncConfig {
44-
state_sync_config_central_sync_client_config_is_none: false,
45-
state_sync_config_p2p_sync_client_config_is_none: true,
46-
state_sync_config_network_config_is_none: true,
47-
},
48-
StateSyncType::P2P => StateSyncConfig {
49-
state_sync_config_central_sync_client_config_is_none: true,
50-
state_sync_config_p2p_sync_client_config_is_none: false,
51-
state_sync_config_network_config_is_none: false,
52-
},
53-
}
54-
}
55-
}
56-
57-
#[derive(Clone, Copy, Debug, EnumIter, Display, Serialize, Ord, PartialEq, Eq, PartialOrd)]
58-
pub enum BusinessLogicServicePort {
59-
ConsensusP2p,
60-
HttpServer,
61-
MempoolP2p,
62-
MonitoringEndpoint,
63-
}
64-
65-
impl BusinessLogicServicePort {
66-
pub fn get_port(&self) -> u16 {
67-
match self {
68-
BusinessLogicServicePort::ConsensusP2p => CONSENSUS_P2P_PORT,
69-
BusinessLogicServicePort::HttpServer => HTTP_SERVER_PORT,
70-
BusinessLogicServicePort::MempoolP2p => MEMPOOL_P2P_PORT,
71-
BusinessLogicServicePort::MonitoringEndpoint => MONITORING_ENDPOINT_DEFAULT_PORT,
72-
}
73-
}
74-
}
75-
76-
// TODO(Tsabary): check if the InfraServicePort and BusinessLogicServicePort enums are needed.
15+
const BASE_APP_CONFIGS_DIR_PATH: &str = "crates/apollo_deployments/resources/app_configs";
7716

7817
// TODO(Nadin): Integrate this logic with `ComponentConfigInService` once the merge from main-14.0
7918
// is complete.
19+
8020
#[derive(Clone, Copy, Debug, EnumIter, Display, Serialize, Ord, PartialEq, Eq, PartialOrd)]
8121
pub enum InfraServicePort {
8222
Batcher,
@@ -97,39 +37,6 @@ impl InfraServicePort {
9737
}
9838
}
9939

100-
#[derive(Clone, Copy, Debug, Display, Ord, PartialEq, Eq, PartialOrd, EnumDiscriminants)]
101-
pub enum ServicePort {
102-
Infra(InfraServicePort),
103-
BusinessLogic(BusinessLogicServicePort),
104-
}
105-
106-
impl serde::Serialize for ServicePort {
107-
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
108-
where
109-
S: serde::Serializer,
110-
{
111-
match self {
112-
ServicePort::Infra(port) => serde::Serialize::serialize(port, serializer),
113-
ServicePort::BusinessLogic(port) => serde::Serialize::serialize(port, serializer),
114-
}
115-
}
116-
}
117-
118-
impl ServicePort {
119-
pub fn get_port(&self) -> u16 {
120-
match self {
121-
ServicePort::Infra(inner) => inner.get_port(),
122-
ServicePort::BusinessLogic(inner) => inner.get_port(),
123-
}
124-
}
125-
126-
pub fn iter() -> impl Iterator<Item = ServicePort> {
127-
InfraServicePort::iter()
128-
.map(ServicePort::Infra)
129-
.chain(BusinessLogicServicePort::iter().map(ServicePort::BusinessLogic))
130-
}
131-
}
132-
13340
#[derive(
13441
Hash, Clone, Debug, Display, Serialize, PartialEq, Eq, PartialOrd, Ord, EnumIter, AsRefStr,
13542
)]

crates/apollo_http_server_config/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use apollo_config::{ParamPath, ParamPrivacyInput, SerializedParam};
88
use serde::{Deserialize, Serialize};
99
use validator::Validate;
1010

11-
pub const HTTP_SERVER_PORT: u16 = 8080;
11+
const HTTP_SERVER_PORT: u16 = 8080;
1212
pub const DEFAULT_MAX_SIERRA_PROGRAM_SIZE: usize = 4 * 1024 * 1024; // 4MB
1313
const DEFAULT_DYNAMIC_CONFIG_POLL_INTERVAL_MS: u64 = 1_000; // 1 second.
1414

0 commit comments

Comments
 (0)