pub struct AppBase<S: Server> {
pub running_state: Option<RunningState<S::ExtraRunningState>>,
pub handle: Handle<S>,
pub self_check_code: String,
pub phc_url: Url,
pub jwt_key: SigningKey,
pub enc_key: PrivateKey,
pub admin_key: VerifyingKey,
pub shared: SharedState<S>,
pub client: Client,
pub version: Option<String>,
pub thread_id: ThreadId,
pub generation: usize,
}Expand description
What’s internally common between PubHubs Apps.
Should NOT be cloned.
Fields§
§running_state: Option<RunningState<S::ExtraRunningState>>§handle: Handle<S>§self_check_code: String§phc_url: Url§jwt_key: SigningKey§enc_key: PrivateKey§admin_key: VerifyingKey§client: Client§version: Option<String>§thread_id: ThreadId§generation: usizeImplementations§
Source§impl<S> AppBase<S>
impl<S> AppBase<S>
Sourcepub async fn get_object<T>(
&self,
id: &T::Identifier,
) -> Result<Option<(T, UpdateVersion)>>where
T: ObjectDetails,
pub async fn get_object<T>(
&self,
id: &T::Identifier,
) -> Result<Option<(T, UpdateVersion)>>where
T: ObjectDetails,
Tries to retrieve an object of type T from this server’s object store with the given
id, returning Ok(None) if no such object exists.
Sourcepub async fn put_object<T>(
&self,
obj: &T,
update: Option<UpdateVersion>,
) -> Result<Option<UpdateVersion>>where
T: ObjectDetails,
pub async fn put_object<T>(
&self,
obj: &T,
update: Option<UpdateVersion>,
) -> Result<Option<UpdateVersion>>where
T: ObjectDetails,
Attempts to put an object of type T into the object store, only overwriting the object that
is already present when the version of the to-be-overwritten object is passed via update.
Returs Ok(None) when there is already an object present in the store with that id and
type, but its version was not specified in update.
Sourcepub async fn delete_object<T>(&self, id: T::Identifier) -> Result<bool>where
T: ObjectDetails,
pub async fn delete_object<T>(&self, id: T::Identifier) -> Result<bool>where
T: ObjectDetails,
Attempts to delete an object with the given Id; returns true when an object was
deleted, and false when no object with the given id was found.
Source§impl<S: Server> AppBase<S>
impl<S: Server> AppBase<S>
pub fn new( creator_base: AppCreatorBase<S>, handle: &Handle<S>, generation: usize, ) -> Self
Sourcepub fn running_state_or_please_retry(
&self,
) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
pub fn running_state_or_please_retry( &self, ) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
Returns the current RunningState of this server when available.
Otherwise returns api::ErrorCode::PleaseRetry.
Sourcepub fn running_state_or_internal_error(
&self,
) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
pub fn running_state_or_internal_error( &self, ) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
Returns the current RunningState of this server when available.
Otherwise returns api::ErrorCode::InternalError.
Sourcepub fn configure_actix_app(app: &Rc<S::AppT>, sc: &mut ServiceConfig)
pub fn configure_actix_app(app: &Rc<S::AppT>, sc: &mut ServiceConfig)
Configures common endpoints
Sourcepub async fn handle_hub_ping(
app: Rc<S::AppT>,
signed_req: Json<TicketSigned<PingReq>>,
) -> Result<PingResp>
pub async fn handle_hub_ping( app: Rc<S::AppT>, signed_req: Json<TicketSigned<PingReq>>, ) -> Result<PingResp>
Shared body of api::server::HubPingEP. Each server has its own handle_hub_ping
method that delegates here.
Sourceasync fn handle_admin_post_config(
app: Rc<S::AppT>,
signed_req: Json<Signed<UpdateConfigReq>>,
) -> Result<UpdateConfigResp>
async fn handle_admin_post_config( app: Rc<S::AppT>, signed_req: Json<Signed<UpdateConfigReq>>, ) -> Result<UpdateConfigResp>
Changes server config, and restarts server
Sourceasync fn handle_admin_info(
app: Rc<S::AppT>,
signed_req: Json<Signed<InfoReq>>,
) -> Result<InfoResp>
async fn handle_admin_info( app: Rc<S::AppT>, signed_req: Json<Signed<InfoReq>>, ) -> Result<InfoResp>
Retrieve non-public information about the server
Sourceasync fn handle_discovery_run(app: Rc<S::AppT>) -> Result<DiscoveryRunResp>
async fn handle_discovery_run(app: Rc<S::AppT>) -> Result<DiscoveryRunResp>
Run the discovery process, and restarts server if necessary. Returns when the discovery process is completed, but before a possible restart.
pub(super) async fn discover_phc(app: Rc<S::AppT>) -> Result<DiscoveryInfoResp>
fn cached_handle_discovery_info(app: &S::AppT) -> Result<DiscoveryInfoResp>
Trait Implementations§
Auto Trait Implementations§
impl<S> !Freeze for AppBase<S>
impl<S> !RefUnwindSafe for AppBase<S>
impl<S> !Send for AppBase<S>
impl<S> !Sync for AppBase<S>
impl<S> Unpin for AppBase<S>
impl<S> UnsafeUnpin for AppBase<S>
impl<S> !UnwindSafe for AppBase<S>
Blanket Implementations§
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
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>
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>
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