pub struct RelayClient {
http: Client,
base_url: String,
}Expand description
Calls requestCrawl or notifyOfUpdate against one relay.
A thin wrapper around [reqwest::Client] rather than a trait: the seam a
test needs is which URL this client talks to, not a second implementation
of what it does with the response, so RelayClient::new takes the base
URL directly and a test points it at a throwaway local server instead of
a real relay. See this module’s own tests.
Fields§
§http: Client§base_url: StringThe relay’s base URL, without a trailing slash — https://bsky.network,
or http://127.0.0.1:PORT in a test.
Implementations§
Source§impl RelayClient
impl RelayClient
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Builds a client pointed at base_url.
Falls back to a default-configured [reqwest::Client] if one cannot
be built with the timeout applied: a one-shot announcement degrading
is preferable to a startup path that refuses to construct.
Sourcepub async fn request_crawl(&self, hostname: &str) -> Result<(), RelayCrawlError>
pub async fn request_crawl(&self, hostname: &str) -> Result<(), RelayCrawlError>
Asks this client’s relay to crawl hostname, over requestCrawl.
Sourcepub async fn notify_of_update(
&self,
hostname: &str,
) -> Result<(), RelayCrawlError>
pub async fn notify_of_update( &self, hostname: &str, ) -> Result<(), RelayCrawlError>
Asks this client’s relay to resume crawling hostname, over the
deprecated notifyOfUpdate — the method upstream’s own schema names
for recovering from a gap after a dropped subscription; see this
module’s doc.
Sourceasync fn call(&self, nsid: &str, hostname: &str) -> Result<(), RelayCrawlError>
async fn call(&self, nsid: &str, hostname: &str) -> Result<(), RelayCrawlError>
Shared body of Self::request_crawl and Self::notify_of_update:
both lexicons take the identical {"hostname": ..} input and report
success or failure identically, so only the NSID in the URL differs.
Trait Implementations§
Source§impl Clone for RelayClient
impl Clone for RelayClient
Source§fn clone(&self) -> RelayClient
fn clone(&self) -> RelayClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RelayClient
impl !RefUnwindSafe for RelayClient
impl Send for RelayClient
impl Sync for RelayClient
impl Unpin for RelayClient
impl UnsafeUnpin for RelayClient
impl !UnwindSafe for RelayClient
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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