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;
async fn discover(
self: &Rc<Self>,
phc_inf: DiscoveryInfoResp,
) -> Result<DiscoverVerdict<S::RunningStateSeed>>;
// Provided methods
async fn discover_as_non_phc(
self: &Rc<Self>,
phc_inf: DiscoveryInfoResp,
) -> Result<DiscoverVerdict<()>> { ... }
fn master_enc_key_part(&self) -> Option<&PrivateKey> { ... }
fn encap_key(&self) -> Option<&EncapKeyBytes> { ... }
fn master_enc_key_part_sealing_key(&self) -> Option<&SealingKey> { ... }
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§
Sourcefn configure_actix_app(self: &Rc<Self>, sc: &mut ServiceConfig)
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.
Sourcefn check_constellation(&self, constellation: &Constellation) -> bool
fn check_constellation(&self, constellation: &Constellation) -> bool
Checks whether the given constellation properly reflects this server’s configuration.
Sourceasync fn discover(
self: &Rc<Self>,
phc_inf: DiscoveryInfoResp,
) -> Result<DiscoverVerdict<S::RunningStateSeed>>
async fn discover( self: &Rc<Self>, phc_inf: DiscoveryInfoResp, ) -> Result<DiscoverVerdict<S::RunningStateSeed>>
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.
PHC implements this directly; the transcryptor and authentication server delegate to
discover_as_non_phc.
Provided Methods§
Sourceasync fn discover_as_non_phc(
self: &Rc<Self>,
phc_inf: DiscoveryInfoResp,
) -> Result<DiscoverVerdict<()>>
async fn discover_as_non_phc( self: &Rc<Self>, phc_inf: DiscoveryInfoResp, ) -> Result<DiscoverVerdict<()>>
Shared discovery routine for the non-PHC servers (transcryptor, authentication server),
whose running state needs no seed (RunningStateSeed = ()).
Sourcefn master_enc_key_part(&self) -> Option<&PrivateKey>
fn master_enc_key_part(&self) -> Option<&PrivateKey>
Should return the master encryption key part for PHC and the transcryption.
Sourcefn encap_key(&self) -> Option<&EncapKeyBytes>
fn encap_key(&self) -> Option<&EncapKeyBytes>
This server’s published kem::EncapKeyBytes, if any. Overridden by T/AS.
Sourcefn master_enc_key_part_sealing_key(&self) -> Option<&SealingKey>
fn master_enc_key_part_sealing_key(&self) -> Option<&SealingKey>
The sealing key (shared with PHC) under which this server seals its master encryption key
part in its discovery info, when available (it requires a running state, so it is None
before discovery completes). Only invoked on, and overridden by, the transcryptor.
Sourceasync fn local_task(_weak: Weak<Self>)
async fn local_task(_weak: Weak<Self>)
Will be invoked for each instance of App that is created.
Sourceasync fn global_task(_app: Rc<Self>) -> Result<Infallible>
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.