pub struct PackageCatalog { /* private fields */ }Expand description
Gossip-backed discovery for publicly published package manifests.
Implementations§
Source§impl PackageCatalog
impl PackageCatalog
pub fn new(gossip: &GossipService, endpoint: &Endpoint) -> Self
Sourcepub async fn subscribe(&self, bootstrap: Vec<PublicKey>) -> Result<GossipTopic>
pub async fn subscribe(&self, bootstrap: Vec<PublicKey>) -> Result<GossipTopic>
Subscribe to the public package catalog.
The caller must retain the returned topic while receiving announcements.
§Errors
Returns an error if the gossip subscription cannot be created.
Sourcepub async fn subscribe_and_join(
&self,
bootstrap: Vec<PublicKey>,
) -> Result<GossipTopic>
pub async fn subscribe_and_join( &self, bootstrap: Vec<PublicKey>, ) -> Result<GossipTopic>
Subscribe to the public package catalog and wait for a bootstrap connection.
§Errors
Returns an error if the gossip subscription cannot join its bootstrap peers.
Sourcepub async fn announce(
&self,
sender: &GossipSender,
announcement: &PackageAnnouncement,
) -> Result<()>
pub async fn announce( &self, sender: &GossipSender, announcement: &PackageAnnouncement, ) -> Result<()>
Broadcast an announcement to the public catalog.
The announcement is Ed25519-signed so receivers can cryptographically verify its origin.
§Errors
Returns an error if the announcement is invalid or cannot be sent.
Sourcepub async fn subscribe_channel(
&self,
channel: &Channel,
bootstrap: Vec<PublicKey>,
) -> Result<GossipTopic>
pub async fn subscribe_channel( &self, channel: &Channel, bootstrap: Vec<PublicKey>, ) -> Result<GossipTopic>
Subscribe to a specific editorial channel.
§Errors
Returns an error if the gossip subscription cannot be created.
Sourcepub async fn subscribe_channel_and_join(
&self,
channel: &Channel,
bootstrap: Vec<PublicKey>,
) -> Result<GossipTopic>
pub async fn subscribe_channel_and_join( &self, channel: &Channel, bootstrap: Vec<PublicKey>, ) -> Result<GossipTopic>
Subscribe to a channel and block until at least one bootstrap peer is connected.
§Errors
Returns an error if the gossip subscription cannot join its bootstrap peers.
Sourcepub async fn search(
&self,
topic: &mut GossipTopic,
query: Option<&str>,
timeout: Duration,
) -> Result<Vec<PackageAnnouncement>>
pub async fn search( &self, topic: &mut GossipTopic, query: Option<&str>, timeout: Duration, ) -> Result<Vec<PackageAnnouncement>>
Collect matching announcements until the timeout expires.
Each announcement is verified: the Ed25519 signature is checked and the
claimed publisher field must match the signing key.
A timeout is a normal end condition because gossip has no finite
response boundary.
§Errors
Returns an error if a received announcement fails signature verification.
Sourcepub fn register_ticket_endpoint(
lookup: &MemoryLookup,
announcement: &PackageAnnouncement,
) -> Result<()>
pub fn register_ticket_endpoint( lookup: &MemoryLookup, announcement: &PackageAnnouncement, ) -> Result<()>
Add the endpoint address for a discovered ticket to a memory lookup.
This helper is useful to callers that construct a node with a shared
MemoryLookup and want to fetch an announcement immediately.
§Errors
Returns an error if the announcement’s manifest ticket is invalid.
Trait Implementations§
Source§impl Clone for PackageCatalog
impl Clone for PackageCatalog
Source§fn clone(&self) -> PackageCatalog
fn clone(&self) -> PackageCatalog
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 !RefUnwindSafe for PackageCatalog
impl !UnwindSafe for PackageCatalog
impl Freeze for PackageCatalog
impl Send for PackageCatalog
impl Sync for PackageCatalog
impl Unpin for PackageCatalog
impl UnsafeUnpin for PackageCatalog
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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