pub struct MainlineLocator { /* private fields */ }Expand description
The at9p mainline locator: full-width CID in, candidate peers out.
Provider scoring, parallel fetch, and size caps are C3 (#891).
Implementations§
Source§impl MainlineLocator
impl MainlineLocator
Sourcepub async fn announce(&self, cid: &Cid512, port: Option<u16>) -> Result<()>
pub async fn announce(&self, cid: &Cid512, port: Option<u16>) -> Result<()>
Announce this node as a provider for cid.
Sourcepub async fn announce_at(
&self,
cid: &Cid512,
key: RendezvousKey,
port: Option<u16>,
) -> Result<()>
pub async fn announce_at( &self, cid: &Cid512, key: RendezvousKey, port: Option<u16>, ) -> Result<()>
Announce this node as a provider for a specific k-derived rendezvous.
Sourcepub async fn providers(&self, cid: &Cid512) -> Result<Vec<PeerContact>>
pub async fn providers(&self, cid: &Cid512) -> Result<Vec<PeerContact>>
Look up candidate providers for cid.
Returned contacts are untrusted hints: anyone can announce on any
infohash. Callers must verify fetched content against the full
cid via the GATE pipeline before deriving anything from it.
Sourcepub async fn providers_at(
&self,
cid: &Cid512,
key: RendezvousKey,
) -> Result<Vec<PeerContact>>
pub async fn providers_at( &self, cid: &Cid512, key: RendezvousKey, ) -> Result<Vec<PeerContact>>
Look up candidate providers for a specific k-derived rendezvous.
Results remain untrusted hints; the key only selects the rendezvous
bucket and does not add authority.
Sourcepub async fn providers_with_hints(
&self,
cid: &Cid512,
key: RendezvousKey,
hints: &LookupHints,
) -> Result<Vec<PeerContact>>
pub async fn providers_with_hints( &self, cid: &Cid512, key: RendezvousKey, hints: &LookupHints, ) -> Result<Vec<PeerContact>>
Look up candidate providers, unioning in add-only LookupHints (R7).
The watermark-anchored BEP5 scan at key is always performed; each
rendezvous bucket in hints is scanned as well (capped by
MAX_HINTED_RENDEZVOUS), and the hint peers are appended (capped by
MAX_HINTED_PEERS). hints may only enlarge the candidate set —
there is no parameter and no code path that prunes, replaces, or skips
the scan (A14). Results are deduped and capped at
MAX_LOCATOR_RESULTS, so untrusted hint input cannot amplify into
unbounded DHT/network work. Results remain untrusted: verification
against the full Cid512 is the caller’s job via the GATE pipeline.
Auto Trait Implementations§
impl Freeze for MainlineLocator
impl !RefUnwindSafe for MainlineLocator
impl Send for MainlineLocator
impl Sync for MainlineLocator
impl Unpin for MainlineLocator
impl UnsafeUnpin for MainlineLocator
impl !UnwindSafe for MainlineLocator
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
§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