Trait hotshot_orchestrator::OrchestratorApi

source ·
pub trait OrchestratorApi<KEY: SignatureKey> {
    // Required methods
    fn post_identity(
        &mut self,
        libp2p_address: Option<Multiaddr>,
        libp2p_public_key: Option<PeerId>,
    ) -> Result<u16, ServerError>;
    fn post_getconfig(
        &mut self,
        _node_index: u16,
    ) -> Result<NetworkConfig<KEY>, ServerError>;
    fn get_tmp_node_index(&mut self) -> Result<u16, ServerError>;
    fn register_public_key(
        &mut self,
        pubkey: &mut Vec<u8>,
        is_da: bool,
        libp2p_address: Option<Multiaddr>,
        libp2p_public_key: Option<PeerId>,
    ) -> Result<(u64, bool), ServerError>;
    fn peer_pub_ready(&self) -> Result<bool, ServerError>;
    fn post_config_after_peer_collected(
        &mut self,
    ) -> Result<NetworkConfig<KEY>, ServerError>;
    fn get_start(&self) -> Result<bool, ServerError>;
    fn post_run_results(
        &mut self,
        metrics: BenchResults,
    ) -> Result<(), ServerError>;
    fn post_ready(
        &mut self,
        peer_config: &PeerConfig<KEY>,
    ) -> Result<(), ServerError>;
    fn post_manual_start(
        &mut self,
        password_bytes: Vec<u8>,
    ) -> Result<(), ServerError>;
    fn post_builder(&mut self, builder: Url) -> Result<(), ServerError>;
    fn get_builders(&self) -> Result<Vec<Url>, ServerError>;
}
Expand description

An api exposed by the orchestrator

Required Methods§

source

fn post_identity( &mut self, libp2p_address: Option<Multiaddr>, libp2p_public_key: Option<PeerId>, ) -> Result<u16, ServerError>

Post an identity to the orchestrator. Takes in optional arguments so others can identify us on the Libp2p network.

§Errors

If we were unable to serve the request

source

fn post_getconfig( &mut self, _node_index: u16, ) -> Result<NetworkConfig<KEY>, ServerError>

post endpoint for each node’s config

§Errors

if unable to serve

source

fn get_tmp_node_index(&mut self) -> Result<u16, ServerError>

get endpoint for the next available temporary node index

§Errors

if unable to serve

source

fn register_public_key( &mut self, pubkey: &mut Vec<u8>, is_da: bool, libp2p_address: Option<Multiaddr>, libp2p_public_key: Option<PeerId>, ) -> Result<(u64, bool), ServerError>

post endpoint for each node’s public key

§Errors

if unable to serve

source

fn peer_pub_ready(&self) -> Result<bool, ServerError>

post endpoint for whether or not all peers public keys are ready

§Errors

if unable to serve

source

fn post_config_after_peer_collected( &mut self, ) -> Result<NetworkConfig<KEY>, ServerError>

get endpoint for the network config after all peers public keys are collected

§Errors

if unable to serve

source

fn get_start(&self) -> Result<bool, ServerError>

get endpoint for whether or not the run has started

§Errors

if unable to serve

source

fn post_run_results(&mut self, metrics: BenchResults) -> Result<(), ServerError>

post endpoint for the results of the run

§Errors

if unable to serve

source

fn post_ready( &mut self, peer_config: &PeerConfig<KEY>, ) -> Result<(), ServerError>

A node POSTs its public key to let the orchestrator know that it is ready

§Errors

if unable to serve

source

fn post_manual_start( &mut self, password_bytes: Vec<u8>, ) -> Result<(), ServerError>

post endpoint for manually starting the orchestrator

§Errors

if unable to serve

source

fn post_builder(&mut self, builder: Url) -> Result<(), ServerError>

post endpoint for registering a builder with the orchestrator

§Errors

if unable to serve

source

fn get_builders(&self) -> Result<Vec<Url>, ServerError>

get endpoints for builders

§Errors

if not all builders are registered yet

Implementors§

source§

impl<KEY> OrchestratorApi<KEY> for OrchestratorState<KEY>
where KEY: Serialize + Clone + SignatureKey + 'static,