Skip to content

Commit

Permalink
avoid too many generic type for OrchestratorApi
Browse files Browse the repository at this point in the history
  • Loading branch information
dailinsubjam committed Oct 13, 2023
1 parent 319a336 commit 4a17875
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions crates/orchestrator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<KEY: SignatureKey + 'static, ELECTION: ElectionConfig + 'static>
}
}

pub trait OrchestratorApi<KEY: SignatureKey, ENTRY, PRIVATEKEY, ELECTION> {
pub trait OrchestratorApi<KEY: SignatureKey, ELECTION> {
fn post_identity(&mut self, identity: IpAddr) -> Result<u16, ServerError>;
fn post_getconfig(
&mut self,
Expand All @@ -82,7 +82,7 @@ pub trait OrchestratorApi<KEY: SignatureKey, ENTRY, PRIVATEKEY, ELECTION> {
fn post_run_results(&mut self) -> Result<(), ServerError>;
}

impl<KEY, ELECTION> OrchestratorApi<KEY, KEY::StakeTableEntry, KEY::PrivateKey, ELECTION>
impl<KEY, ELECTION> OrchestratorApi<KEY, ELECTION>
for OrchestratorState<KEY, ELECTION>
where
KEY: serde::Serialize + Clone + SignatureKey,
Expand Down Expand Up @@ -198,13 +198,11 @@ where
}

/// Sets up all API routes
fn define_api<KEY: SignatureKey, ELECTION, ENTRY, PRIVATEKEY, State>() -> Result<Api<State, ServerError>, ApiError>
fn define_api<KEY: SignatureKey, ELECTION, State>() -> Result<Api<State, ServerError>, ApiError>
where
State: 'static + Send + Sync + ReadState + WriteState,
<State as ReadState>::State: Send + Sync + OrchestratorApi<KEY, ENTRY, PRIVATEKEY, ELECTION>,
<State as ReadState>::State: Send + Sync + OrchestratorApi<KEY, ELECTION>,
KEY: serde::Serialize,
ENTRY: serde::Serialize,
PRIVATEKEY: serde::Serialize,
ELECTION: serde::Serialize,
{
let api_toml = toml::from_str::<toml::Value>(include_str!(concat!(
Expand Down

0 comments on commit 4a17875

Please sign in to comment.