pub struct ClientRef<'r> { /* private fields */ }Expand description
A strong reference to Client
It contains a phantom reference, to avoid attempts of storing it anywhere.
Implementations§
Source§impl ClientRef<'_>
impl ClientRef<'_>
Sourcepub async fn connect_cached(&self, id: RostraId) -> ConnectResult<Connection>
pub async fn connect_cached(&self, id: RostraId) -> ConnectResult<Connection>
Connect to a peer using the shared connection cache
Returns a cached connection if available, otherwise creates a new one.
This is more efficient than connect_uncached when making repeated
connections to the same peer.
Methods from Deref<Target = Client>§
Sourcepub async fn unlock_active(
&self,
id_secret: RostraIdSecretKey,
) -> ActivateResult<()>
pub async fn unlock_active( &self, id_secret: RostraIdSecretKey, ) -> ActivateResult<()>
Unlock signing operations and start signing-dependent background tasks.
The secret must belong to Client::rostra_id. Calling this method
more than once is harmless after the first successful activation.
pub async fn publish_node_announcement( &self, id_secret: RostraIdSecretKey, ) -> PostResult<()>
Sourcepub fn self_head_subscribe(&self) -> CurrentState<Option<ShortEventId>>
pub fn self_head_subscribe(&self) -> CurrentState<Option<ShortEventId>>
Subscribe to owned snapshots of the minimum current self-head representative.
The retained value is a deterministic default and does not imply that the complete current head set is a singleton.
Sourcepub fn new_content_subscribe(&self) -> Receiver<VerifiedEventContent>
pub fn new_content_subscribe(&self) -> Receiver<VerifiedEventContent>
Subscribe to newly accepted verified event content.
Sourcepub fn new_posts_subscribe(
&self,
) -> Receiver<(VerifiedEventContent, SocialPost)>
pub fn new_posts_subscribe( &self, ) -> Receiver<(VerifiedEventContent, SocialPost)>
Subscribe to newly accepted social posts.
Sourcepub fn new_shoutbox_subscribe(
&self,
) -> Receiver<(VerifiedEventContent, Shoutbox)>
pub fn new_shoutbox_subscribe( &self, ) -> Receiver<(VerifiedEventContent, Shoutbox)>
Subscribe to newly accepted shoutbox messages.
Sourcepub fn new_heads_subscribe(&self) -> Receiver<(RostraId, ShortEventId)>
pub fn new_heads_subscribe(&self) -> Receiver<(RostraId, ShortEventId)>
Subscribe to lossy incremental exact new-head signals.
Each signal names the accepted event that became a head. Consumers that lag must recover from the database’s complete durable head set.
Sourcepub fn ids_with_missing_events_subscribe(
&self,
capacity: usize,
) -> Receiver<RostraId>
pub fn ids_with_missing_events_subscribe( &self, capacity: usize, ) -> Receiver<RostraId>
Subscribe to deduplicated identities whose event history is incomplete.
Sourcepub async fn events_head(&self) -> Option<ShortEventId>
pub async fn events_head(&self) -> Option<ShortEventId>
Return the deterministic representative of the current self-head set.
Sourcepub fn handle(&self) -> ClientHandle
pub fn handle(&self) -> ClientHandle
Create a weak handle that does not keep this client running.
Sourcepub fn local_iroh_id(&self) -> IrohNodeId
pub fn local_iroh_id(&self) -> IrohNodeId
Returns our local Iroh node ID.
Sourcepub async fn resolve_id_data(
&self,
id: RostraId,
) -> Result<IdResolvedData, IdResolveError>
pub async fn resolve_id_data( &self, id: RostraId, ) -> Result<IdResolvedData, IdResolveError>
Resolve an identity’s published transport and graph-head information.
Sourcepub async fn resolve_id_ticket(
&self,
id: RostraId,
) -> Result<CompactTicket, IdResolveError>
pub async fn resolve_id_ticket( &self, id: RostraId, ) -> Result<CompactTicket, IdResolveError>
Resolve an identity’s compact transport ticket.
Sourcepub async fn connect_uncached(&self, id: RostraId) -> ConnectResult<Connection>
pub async fn connect_uncached(&self, id: RostraId) -> ConnectResult<Connection>
Open a fresh typed RPC connection to an identity.
Sourcepub async fn connect_by_pkarr_resolution(
&self,
id: RostraId,
) -> ConnectResult<Connection>
pub async fn connect_by_pkarr_resolution( &self, id: RostraId, ) -> ConnectResult<Connection>
Resolve an identity through Pkarr and open a fresh typed RPC connection.
Sourcepub async fn connect_ticket(
&self,
ticket: CompactTicket,
) -> ConnectResult<Connection>
pub async fn connect_ticket( &self, ticket: CompactTicket, ) -> ConnectResult<Connection>
Open a typed RPC connection using a previously resolved compact ticket.
Sourcepub async fn fetch_event_content(
&self,
author_id: RostraId,
event_id: ShortEventId,
followers_cache: &mut BTreeMap<RostraId, Vec<RostraId>>,
) -> Result<bool, DbError>
pub async fn fetch_event_content( &self, author_id: RostraId, event_id: ShortEventId, followers_cache: &mut BTreeMap<RostraId, Vec<RostraId>>, ) -> Result<bool, DbError>
Fetch an event and its content from its author or known followers.
The caller-owned cache avoids repeating follower lookups while fetching
a batch of related events. The method returns true when content
was found and stored.
Sourcepub async fn sync_event_from_peers(
&self,
author_id: RostraId,
head: ShortEventId,
peers: &[RostraId],
) -> Result<bool, DbError>
pub async fn sync_event_from_peers( &self, author_id: RostraId, head: ShortEventId, peers: &[RostraId], ) -> Result<bool, DbError>
Synchronize an event and its ancestors from a set of candidate peers.
This explicit synchronization boundary is useful when an integration
learns a remote head outside the client’s normal background discovery.
It returns true when any new envelope or content was stored.
Sourcepub async fn store_event_with_content(
&self,
event_id: impl Into<ShortEventId>,
content: &VerifiedEventContent,
) -> StoreEventResult<()>
pub async fn store_event_with_content( &self, event_id: impl Into<ShortEventId>, content: &VerifiedEventContent, ) -> StoreEventResult<()>
Store verified event content, retaining author and event context on error.
pub async fn check_published_id_state( &self, ) -> Result<IdResolvedData, IdResolveError>
pub async fn post_shoutbox( &self, id_secret: RostraIdSecretKey, body: String, ) -> PostResult<VerifiedEvent>
pub async fn follow( &self, id_secret: RostraIdSecretKey, followee_id: RostraId, tags_selector: PersonasTagsSelector, ) -> PostResult<VerifiedEvent>
pub async fn unfollow( &self, id_secret: RostraIdSecretKey, followee: RostraId, ) -> PostResult<VerifiedEvent>
pub async fn publish_omni_tbd( &self, id_secret: RostraIdSecretKey, body: String, ) -> PostResult<()>
Sourcepub fn self_followees_subscribe(
&self,
) -> CurrentState<Arc<HashMap<RostraId, IdsFolloweesRecord>>>
pub fn self_followees_subscribe( &self, ) -> CurrentState<Arc<HashMap<RostraId, IdsFolloweesRecord>>>
Subscribe to owned snapshots of the retained self-followee projection.
Sourcepub fn self_followers_subscribe(
&self,
) -> CurrentState<Arc<HashMap<RostraId, IdsFollowersRecord>>>
pub fn self_followers_subscribe( &self, ) -> CurrentState<Arc<HashMap<RostraId, IdsFollowersRecord>>>
Subscribe to owned snapshots of the retained self-follower projection.
Sourcepub fn self_wot_subscribe(&self) -> CurrentState<Arc<WotData>>
pub fn self_wot_subscribe(&self) -> CurrentState<Arc<WotData>>
Subscribe to owned snapshots of the retained Web-of-Trust projection.
pub fn publish_event<'f1, C>(
&'f1 self,
id_secret: RostraIdSecretKey,
content: C,
) -> ClientPublishEventBuilder<'f1, C>where
C: EventContentKind,
Trait Implementations§
Auto Trait Implementations§
impl<'r> !RefUnwindSafe for ClientRef<'r>
impl<'r> !UnwindSafe for ClientRef<'r>
impl<'r> Freeze for ClientRef<'r>
impl<'r> Send for ClientRef<'r>
impl<'r> Sync for ClientRef<'r>
impl<'r> Unpin for ClientRef<'r>
impl<'r> UnsafeUnpin for ClientRef<'r>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, T> ExpectFrom<F> for T
impl<F, T> ExpectFrom<F> for T
fn expect_from(other: F) -> T
Source§impl<F, I> ExpectInto<I> for Fwhere
I: ExpectFrom<F>,
impl<F, I> ExpectInto<I> for Fwhere
I: ExpectFrom<F>,
fn expect_into(self) -> I
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