Skip to main content

ServerImpl

Struct ServerImpl 

Source
pub struct ServerImpl<D: Details> {
    config: Config,
    app_creator: D::AppCreatorT,
}
Expand description

Basic implementation of Server.

Fields§

§config: Config§app_creator: D::AppCreatorT

Implementations§

Source§

impl<D: Details> ServerImpl<D>
where D::AppT: App<Self>, D::AppCreatorT: AppCreator<Self>, D::ObjectStoreT: Sync,

Source

async fn run_discovery_and_then_wait_forever( &self, app: Rc<D::AppT>, ) -> Result<Infallible>

Source

async fn run_discovery(&self, app: Rc<D::AppT>) -> Result<()>

Trait Implementations§

Source§

impl App<ServerImpl<Details>> for App

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.
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. Read more
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
Source§

impl App<ServerImpl<Details>> for App

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.
Source§

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 more
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
Source§

impl App<ServerImpl<Details>> for App

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.
Source§

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>

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 more
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
Source§

impl AppCreator<ServerImpl<Details>> for AppCreator

Source§

type ContextT = ()

When Apps are created a new AppCreator::ContextT is created, and a reference to it is passed to AppCreator::into_app.
Source§

fn new(config: &Config) -> Result<Self>

Creates a new instance of this AppCreator based on the given configuration.
Source§

fn into_app( self, handle: &Handle<ServerImpl<Details>>, _context: &Self::ContextT, generation: usize, ) -> App

Create an App instance. Read more
Source§

impl AppCreator<ServerImpl<Details>> for AppCreator

Source§

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§

fn into_app( self, handle: &Handle<ServerImpl<Details>>, context: &Self::ContextT, generation: usize, ) -> App

Create an App instance. Read more
Source§

fn new(config: &Config) -> Result<Self>

Creates a new instance of this AppCreator based on the given configuration.
Source§

impl AppCreator<ServerImpl<Details>> for AppCreator

Source§

type ContextT = ()

When Apps are created a new AppCreator::ContextT is created, and a reference to it is passed to AppCreator::into_app.
Source§

fn new(config: &Config) -> Result<Self>

Creates a new instance of this AppCreator based on the given configuration.
Source§

fn into_app( self, handle: &Handle<ServerImpl<Details>>, _context: &Self::ContextT, generation: usize, ) -> App

Create an App instance. Read more
Source§

impl<D: Details> Deref for ServerImpl<D>

Source§

type Target = <D as Details>::AppCreatorT

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<D: Details> DerefMut for ServerImpl<D>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<D: Details> Server for ServerImpl<D>
where D::AppT: App<Self>, D::AppCreatorT: AppCreator<Self>, D::ObjectStoreT: Sync,

Source§

const NAME: Name = D::NAME

Source§

type AppCreatorT = <D as Details>::AppCreatorT

Is moved accross threads to create the Apps.
Source§

type AppT = <D as Details>::AppT

Source§

type ExtraConfig = <D as GetServerConfig>::Extra

Source§

type ExtraRunningState = <D as Details>::ExtraRunningState

Additional state when the server is running
Source§

type ExtraSharedState = <D as Details>::ExtraSharedState

Additional shared state
Source§

type ObjectStoreT = <D as Details>::ObjectStoreT

Type of this server’s object store, usually an object_store::ObjectStore, or ().
Source§

fn new(config: &Config) -> Result<Self>

Source§

fn config(&self) -> &Config

Source§

fn server_config_from(config: &Config) -> &ServerConfig<Self::ExtraConfig>

Source§

fn create_running_state( &self, constellation: &Constellation, ) -> Result<Self::ExtraRunningState>

Source§

fn create_extra_shared_state(config: &Config) -> Result<Self::ExtraSharedState>

Source§

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

Returns the default TCP port this server binds to.
Source§

fn server_config(&self) -> &ServerConfig<Self::ExtraConfig>

Source§

fn cors() -> Cors

Creates cross-origin resource sharing middleware for this server.

Auto Trait Implementations§

§

impl<D> Freeze for ServerImpl<D>
where <D as Details>::AppCreatorT: Freeze,

§

impl<D> RefUnwindSafe for ServerImpl<D>

§

impl<D> Send for ServerImpl<D>
where <D as Details>::AppCreatorT: Send,

§

impl<D> Sync for ServerImpl<D>
where <D as Details>::AppCreatorT: Sync,

§

impl<D> Unpin for ServerImpl<D>
where <D as Details>::AppCreatorT: Unpin,

§

impl<D> UnsafeUnpin for ServerImpl<D>

§

impl<D> UnwindSafe for ServerImpl<D>

Blanket Implementations§

Source§

impl<R> TryRngCore for R
where R: TryRng,

Source§

type Error = <R as TryRng>::Error

👎Deprecated since 0.10.0: use TryRng instead
Error type.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, P> Resource for T
where T: DerefMut<Target = Path<P>>, P: ResourcePath,

Source§

type Path = P

Type of resource’s path returned in resource_path.
Source§

fn resource_path(&mut self) -> &mut Path<<T as Resource>::Path>

Returns a mutable reference to the path wrapper used by the router.
Source§

impl<R> Rng for R
where R: RngCore + ?Sized,

Source§

fn random<T>(&mut self) -> T

Return a random value via the StandardUniform distribution. Read more
Source§

fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>

Return an iterator over random variates Read more
Source§

fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Generate a random value in the given range. Read more
Source§

fn random_bool(&mut self, p: f64) -> bool

Return a bool with a probability p of being true. Read more
Source§

fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Return a bool with a probability of numerator/denominator of being true. Read more
Source§

fn sample<T, D>(&mut self, distr: D) -> T
where 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,

Create an iterator that generates values using the given distribution. Read more
Source§

fn fill<T>(&mut self, dest: &mut T)
where T: Fill + ?Sized,

Fill any type implementing Fill with random data Read more
Source§

fn gen<T>(&mut self) -> 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) -> T
where T: SampleUniform, R: SampleRange<T>,

👎Deprecated since 0.9.0: Renamed to random_range
Source§

fn gen_bool(&mut self, p: f64) -> bool

👎Deprecated since 0.9.0: Renamed to random_bool
Alias for Rng::random_bool.
Source§

fn gen_ratio(&mut self, numerator: u32, denominator: u32) -> bool

👎Deprecated since 0.9.0: Renamed to random_ratio
Source§

impl<R> Rng for R
where R: TryRng<Error = Infallible> + ?Sized,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32.
Source§

fn next_u64(&mut self) -> u64

Return the next random u64.
Source§

fn fill_bytes(&mut self, dst: &mut [u8])

Fill dest with random data. Read more
Source§

impl<T> RngCore for T
where T: DerefMut, <T as Deref>::Target: RngCore,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dst: &mut [u8])

Fill dest with random data. Read more
Source§

impl<R> RngExt for R
where R: Rng + ?Sized,

Source§

fn random<T>(&mut self) -> T

Return a random value via the StandardUniform distribution. Read more
Source§

fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>

Return an iterator over random variates Read more
Source§

fn random_range<T, R>(&mut self, range: R) -> T
where T: SampleUniform, R: SampleRange<T>,

Generate a random value in the given range. Read more
Source§

fn random_bool(&mut self, p: f64) -> bool

Return a bool with a probability p of being true. Read more
Source§

fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool

Return a bool with a probability of numerator/denominator of being true. Read more
Source§

fn sample<T, D>(&mut self, distr: D) -> T
where 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,

Create an iterator that generates values using the given distribution. Read more
Source§

fn fill<T>(&mut self, dest: &mut [T])
where T: Fill,

Fill any type implementing Fill with random data Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<R> TryRng for R
where R: DerefMut, <R as Deref>::Target: TryRng,

Source§

type Error = <<R as Deref>::Target as TryRng>::Error

The type returned in the event of a RNG error. Read more
Source§

fn try_next_u32(&mut self) -> Result<u32, <R as TryRng>::Error>

Return the next random u32.
Source§

fn try_next_u64(&mut self) -> Result<u64, <R as TryRng>::Error>

Return the next random u64.
Source§

fn try_fill_bytes(&mut self, dst: &mut [u8]) -> Result<(), <R as TryRng>::Error>

Fill dst entirely with random data.
Source§

impl<R> TryRngCore for R
where R: RngCore + ?Sized,

Source§

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>

Return the next random u32.
Source§

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>

Fill dest entirely with random data.
Source§

fn unwrap_err(self) -> UnwrapErr<Self>
where Self: Sized,

Wrap RNG with the UnwrapErr wrapper.
Source§

fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>

Wrap RNG with the UnwrapMut wrapper.
Source§

fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>
where Self: Sized,

Convert an RngCore to a RngReadAdapter.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<R> CryptoRng for R
where R: TryCryptoRng<Error = Infallible> + ?Sized,

Source§

impl<T> CryptoRng for T
where T: DerefMut, <T as Deref>::Target: CryptoRng,

Source§

impl<T> Formattable for T
where T: Deref, <T as Deref>::Target: Formattable,

Source§

impl<R> RngCore for R
where R: Rng,

Source§

impl<R> TryCryptoRng for R
where R: CryptoRng + ?Sized,

Source§

impl<R> TryCryptoRng for R
where R: DerefMut, <R as Deref>::Target: TryCryptoRng,