pub struct Federation<D> { /* private fields */ }Expand description
Everything Ojak serves, and the URIs it builds. Cheap to clone.
Implementations§
Source§impl<D: Clone + Send + Sync + 'static> Federation<D>
impl<D: Clone + Send + Sync + 'static> Federation<D>
pub fn builder() -> Builder<D>
Sourcepub fn uris(&self, origin: Url) -> Uris
pub fn uris(&self, origin: Url) -> Uris
The URIs of what is registered, in origin, with no request and no
data: for what has to be named before the application’s data
exists, such as the ID of the key an actor signs with.
Sourcepub fn context(&self, origin: Url, data: D) -> Context<D>
pub fn context(&self, origin: Url, data: D) -> Context<D>
A context outside any request, for building URIs in a background job:
origin is the canonical origin they are built in.
Sourcepub fn is_inbox(&self, path: &str) -> bool
pub fn is_inbox(&self, path: &str) -> bool
Whether path is an inbox, whose POSTs Federation::handle_with_body
answers: what an adapter asks before reading a request’s body. Every
gateway path is one when the application accepts portable
deliveries, since which of them are inboxes is the application’s to
say.
Sourcepub async fn handle_with_body(
&self,
request: &Parts,
body: &[u8],
data: D,
) -> Handled
pub async fn handle_with_body( &self, request: &Parts, body: &[u8], data: D, ) -> Handled
Answer request with its body: an activity POSTed to an inbox is
received; anything else is answered as Federation::handle does.
Sourcepub async fn handle(&self, request: &Parts, data: D) -> Handled
pub async fn handle(&self, request: &Parts, data: D) -> Handled
Answer request, or say why it is not Ojak’s to answer. An inbox’s
POST needs its body: Federation::handle_with_body.