Skip to main content

App

Trait App 

Source
pub trait App<S: Server>: Deref<Target = AppBase<S>> + 'static {
    // Required methods
    fn configure_actix_app(self: &Rc<Self>, sc: &mut ServiceConfig);
    fn check_constellation(&self, constellation: &Constellation) -> bool;

    // Provided methods
    async fn discover(
        self: &Rc<Self>,
        phc_inf: DiscoveryInfoResp,
    ) -> Result<DiscoverVerdict> { ... }
    fn master_enc_key_part(&self) -> Option<&PrivateKey> { ... }
    async fn local_task(_weak: Weak<Self>) { ... }
    async fn global_task(_app: Rc<Self>) -> Result<Infallible> { ... }
}
Expand description

What’s common between the actix_web::Apps used by the different PubHubs servers.

Each actix_web::App gets access to an instance of the appropriate implementation of App..

Required Methods§

Source

fn configure_actix_app(self: &Rc<Self>, sc: &mut ServiceConfig)

Allows App to add server-specific endpoints. Non-server specific endpoints are added by AppBase::configure_actix_app.

Source

fn check_constellation(&self, constellation: &Constellation) -> bool

Checks whether the given constellation properly reflects this server’s configuration.

Provided Methods§

Source

async fn discover( self: &Rc<Self>, phc_inf: DiscoveryInfoResp, ) -> Result<DiscoverVerdict>

Runs the discovery routine for this server given api::DiscoveryInfoResp already obtained from Pubhubs Central. If the server is not PHC itself, the Constellation in this api::DiscoveryInfoResp must be set.

If one of the other servers is not up-to-date according to this server, discovery of that server is invoked and api::ErrorCode::PleaseRetry is returned.

Source

fn master_enc_key_part(&self) -> Option<&PrivateKey>

Should return the master encryption key part for PHC and the transcryption.

Source

async fn local_task(_weak: Weak<Self>)

Will be invoked for each instance of App that is created.

Source

async fn global_task(_app: Rc<Self>) -> Result<Infallible>

Will be invoked once for each server, after discovery

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl App<ServerImpl<Details>> for pubhubs::servers::auths::server::App

Source§

impl App<ServerImpl<Details>> for pubhubs::servers::phc::server::App

Source§

impl App<ServerImpl<Details>> for pubhubs::servers::transcryptor::server::App