pub struct ChatMeshService { /* private fields */ }Expand description
A handle to the running chat-over-mesh service.
Implementations§
Source§impl ChatMeshService
impl ChatMeshService
Sourcepub fn spawn(mesh: MeshService) -> ChatMeshService
pub fn spawn(mesh: MeshService) -> ChatMeshService
Spawn the chat loop over mesh, forwarding received envelopes to try_recv /
recv_timeout. Used by tests and callers that want to handle delivery themselves.
Sourcepub fn spawn_applying(
mesh: MeshService,
storage_root: PathBuf,
) -> ChatMeshService
pub fn spawn_applying( mesh: MeshService, storage_root: PathBuf, ) -> ChatMeshService
Spawn the chat loop over mesh, applying received envelopes directly to the session store
under storage_root via crate::chat_relay::apply_incoming_envelope (dedup + agent-message
validation + UI notify). This is the desktop path: publish with publish, and inbound chat
lands in the local sessions automatically.
Sourcepub fn add_peer(
&self,
peer_id: &str,
peer_pubkey_hex: &str,
endpoint: Option<SocketAddr>,
) -> Result<SocketAddr, String>
pub fn add_peer( &self, peer_id: &str, peer_pubkey_hex: &str, endpoint: Option<SocketAddr>, ) -> Result<SocketAddr, String>
Add a peer to the underlying mesh; returns the local bound address.
Sourcepub fn set_peer_endpoint(
&self,
peer_id: &str,
addr: SocketAddr,
) -> Result<(), String>
pub fn set_peer_endpoint( &self, peer_id: &str, addr: SocketAddr, ) -> Result<(), String>
Point a peer’s tunnel at addr.
Sourcepub fn initiate_handshake(&self, peer_id: &str) -> Result<(), String>
pub fn initiate_handshake(&self, peer_id: &str) -> Result<(), String>
Initiate the handshake with a peer.
Sourcepub fn has_session(&self, peer_id: &str) -> Result<bool, String>
pub fn has_session(&self, peer_id: &str) -> Result<bool, String>
Whether a live session exists with a peer.
Sourcepub fn wait_for_session(&self, peer_id: &str, timeout: Duration) -> bool
pub fn wait_for_session(&self, peer_id: &str, timeout: Duration) -> bool
Poll until a session with peer_id is established or timeout elapses.
Sourcepub fn publish(
&self,
peers: Vec<String>,
env: RelayEnvelope,
) -> Result<(), String>
pub fn publish( &self, peers: Vec<String>, env: RelayEnvelope, ) -> Result<(), String>
Reliably send env to each peer in peers over the mesh.
Sourcepub fn try_recv(&self) -> Option<IncomingChat>
pub fn try_recv(&self) -> Option<IncomingChat>
Non-blocking receive of the next inbound chat message (channel mode only; None in apply mode).
Sourcepub fn recv_timeout(&self, timeout: Duration) -> Option<IncomingChat>
pub fn recv_timeout(&self, timeout: Duration) -> Option<IncomingChat>
Block up to timeout for the next inbound chat message (channel mode only).
Trait Implementations§
Source§impl Drop for ChatMeshService
impl Drop for ChatMeshService
Auto Trait Implementations§
impl Freeze for ChatMeshService
impl !RefUnwindSafe for ChatMeshService
impl Send for ChatMeshService
impl !Sync for ChatMeshService
impl Unpin for ChatMeshService
impl UnsafeUnpin for ChatMeshService
impl !UnwindSafe for ChatMeshService
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
§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
§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