pub struct ServerImpl<D: Details> {
config: Config,
app_creator: D::AppCreatorT,
}Expand description
Basic implementation of Server.
Fields§
§config: Config§app_creator: D::AppCreatorTImplementations§
Source§impl<D: Details> ServerImpl<D>
impl<D: Details> ServerImpl<D>
async fn run_discovery_and_then_wait_forever( &self, app: Rc<D::AppT>, ) -> Result<Infallible>
async fn run_discovery(&self, app: Rc<D::AppT>) -> Result<()>
Trait Implementations§
Source§impl App<ServerImpl<Details>> for App
impl App<ServerImpl<Details>> for App
Source§fn 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.Source§fn check_constellation(&self, constellation: &Constellation) -> bool
fn check_constellation(&self, constellation: &Constellation) -> bool
Checks whether the given constellation properly reflects this server’s configuration.
Source§async fn discover(
self: &Rc<Self>,
phc_inf: DiscoveryInfoResp,
) -> Result<DiscoverVerdict>
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. Read moreSource§fn 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.
Source§async fn local_task(_weak: Weak<Self>)
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>
async fn global_task(_app: Rc<Self>) -> Result<Infallible>
Will be invoked once for each server, after discovery
Source§impl App<ServerImpl<Details>> for App
impl App<ServerImpl<Details>> for App
Source§fn 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.Source§fn check_constellation(&self, _constellation: &Constellation) -> bool
fn check_constellation(&self, _constellation: &Constellation) -> bool
Checks whether the given constellation properly reflects this server’s configuration.
Source§async fn discover(
self: &Rc<Self>,
_phc_di: DiscoveryInfoResp,
) -> Result<DiscoverVerdict>
async fn discover( self: &Rc<Self>, _phc_di: 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. Read moreSource§fn 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.
Source§async fn local_task(weak: Weak<Self>)
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>
async fn global_task(app: Rc<Self>) -> Result<Infallible>
Will be invoked once for each server, after discovery
Source§impl App<ServerImpl<Details>> for App
impl App<ServerImpl<Details>> for App
Source§fn 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.Source§fn check_constellation(&self, constellation: &Constellation) -> bool
fn check_constellation(&self, constellation: &Constellation) -> bool
Checks whether the given constellation properly reflects this server’s configuration.
Source§fn 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.
Source§async fn discover(
self: &Rc<Self>,
phc_inf: DiscoveryInfoResp,
) -> Result<DiscoverVerdict>
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. Read moreSource§async fn local_task(_weak: Weak<Self>)
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>
async fn global_task(_app: Rc<Self>) -> Result<Infallible>
Will be invoked once for each server, after discovery
Source§impl AppCreator<ServerImpl<Details>> for AppCreator
impl AppCreator<ServerImpl<Details>> for AppCreator
Source§type ContextT = ()
type ContextT = ()
When
Apps are created a new AppCreator::ContextT is created,
and a reference to it is passed to AppCreator::into_app.Source§impl AppCreator<ServerImpl<Details>> for AppCreator
impl AppCreator<ServerImpl<Details>> for AppCreator
Source§type ContextT = AppCreatorContext
type ContextT = AppCreatorContext
When
Apps are created a new AppCreator::ContextT is created,
and a reference to it is passed to AppCreator::into_app.Source§impl AppCreator<ServerImpl<Details>> for AppCreator
impl AppCreator<ServerImpl<Details>> for AppCreator
Source§type ContextT = ()
type ContextT = ()
When
Apps are created a new AppCreator::ContextT is created,
and a reference to it is passed to AppCreator::into_app.Source§impl<D: Details> Deref for ServerImpl<D>
impl<D: Details> Deref for ServerImpl<D>
Source§impl<D: Details> DerefMut for ServerImpl<D>
impl<D: Details> DerefMut for ServerImpl<D>
Source§impl<D: Details> Server for ServerImpl<D>
impl<D: Details> Server for ServerImpl<D>
const NAME: Name = D::NAME
Source§type AppCreatorT = <D as Details>::AppCreatorT
type AppCreatorT = <D as Details>::AppCreatorT
Is moved accross threads to create the
Apps.type AppT = <D as Details>::AppT
type ExtraConfig = <D as GetServerConfig>::Extra
Source§type ExtraRunningState = <D as Details>::ExtraRunningState
type ExtraRunningState = <D as Details>::ExtraRunningState
Additional state when the server is running
Additional shared state
Source§type ObjectStoreT = <D as Details>::ObjectStoreT
type ObjectStoreT = <D as Details>::ObjectStoreT
Type of this server’s object store, usually an
object_store::ObjectStore, or ().fn new(config: &Config) -> Result<Self>
fn config(&self) -> &Config
fn server_config_from(config: &Config) -> &ServerConfig<Self::ExtraConfig>
fn create_running_state( &self, constellation: &Constellation, ) -> Result<Self::ExtraRunningState>
Source§async fn run_until_modifier(
self: Rc<Self>,
shutdown_receiver: Receiver<Infallible>,
app: Rc<Self::AppT>,
) -> Result<Option<Box<dyn Modifier<Self>>>>
async fn run_until_modifier( self: Rc<Self>, shutdown_receiver: Receiver<Infallible>, app: Rc<Self::AppT>, ) -> Result<Option<Box<dyn Modifier<Self>>>>
This function is called when the server is started to run discovery. Read more
Source§fn default_port() -> u16
fn default_port() -> u16
Returns the default TCP port this server binds to.
fn server_config(&self) -> &ServerConfig<Self::ExtraConfig>
Auto Trait Implementations§
impl<D> Freeze for ServerImpl<D>
impl<D> RefUnwindSafe for ServerImpl<D>
impl<D> Send for ServerImpl<D>
impl<D> Sync for ServerImpl<D>
impl<D> Unpin for ServerImpl<D>
impl<D> UnsafeUnpin for ServerImpl<D>
impl<D> UnwindSafe for ServerImpl<D>
Blanket Implementations§
Source§impl<R> TryRngCore for Rwhere
R: TryRng,
impl<R> TryRngCore for Rwhere
R: TryRng,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
👎Deprecated since 0.9.0: Renamed to
random to avoid conflict with the new gen keyword in Rust 2024.Alias for
Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
👎Deprecated since 0.9.0: Renamed to
random_rangeAlias for
Rng::random_range.Source§impl<R> RngExt for R
impl<R> RngExt for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§impl<R> TryRng for R
impl<R> TryRng for R
Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
Convert an
RngCore to a RngReadAdapter.