Skip to main content

MessagingService

Struct MessagingService 

Source
pub struct MessagingService { /* private fields */ }
Expand description

Plugin-internal service handle.

Implementations§

Source§

impl MessagingService

Source

pub fn open( db_path: PathBuf, peers: Arc<dyn PeerDirectory>, control: Arc<dyn ControlSender>, identity: Arc<dyn IdentitySecrets>, ) -> Result<Self>

Open the messaging database and bind the daemon-supplied ports.

Source

pub fn subscribe(&self) -> Receiver<MessageEvent>

Subscribe to the broadcast event stream. Each subscriber gets every future event until they drop the receiver.

Source

pub fn storage(&self) -> &Arc<MessagingStorage>

Borrow the underlying storage handle (read-mostly use cases like messages.history).

Source

pub async fn list_conversations(&self) -> Result<Vec<ConversationSummary>>

Snapshot of all conversations, sorted by most-recent activity. Each summary’s name and x25519_pubkey are filled in from the peer directory.

Source

pub async fn record_local_send( &self, peer: NodeId, message_id: [u8; 16], body: String, timestamp_ms: i64, ) -> Result<MessageRecord>

Persist a freshly-sent local message in pending status.

Source

pub async fn mark_sent( &self, peer: NodeId, message_id: [u8; 16], at_ms: i64, ) -> Result<()>

Move an outbound message from pending to sent.

Source

pub async fn mark_delivered( &self, peer: NodeId, message_id: [u8; 16], at_ms: i64, ) -> Result<()>

Apply a delivered ack from the peer.

Source

pub async fn mark_read( &self, peer: NodeId, message_id: [u8; 16], at_ms: i64, ) -> Result<()>

Apply a read ack from the peer (if/when supported by the UI).

Source

pub async fn mark_failed( &self, peer: NodeId, message_id: [u8; 16], reason: String, at_ms: i64, ) -> Result<()>

Mark a previously-pending outbound message as failed.

Source

pub async fn delete_conversation(&self, peer: NodeId) -> Result<(usize, bool)>

Atomic per-peer wipe — see MessagingStorage::delete_conversation.

Source

pub async fn delete_all_messages(&self) -> Result<(usize, usize)>

Atomic global wipe — see MessagingStorage::delete_all_messages.

Source

pub async fn send(&self, peer: NodeId, body: String) -> Result<MessageRecord>

Encrypt + send a user message to peer. Returns the persisted record (with status pending initially, transitioning to sent once the transport accepts it). Bumps to failed if no route or no x25519 is known yet.

Source

pub async fn handle_incoming_message(&self, src: NodeId, body: Bytes)

Decrypt + persist an incoming messaging.msg and ack it.

Source

pub async fn handle_incoming_message_ack(&self, src: NodeId, body: Bytes)

Apply an inbound messaging.ack to the local outbound row.

Source

pub async fn on_peer_forgotten(&self, peer: NodeId)

Plugin lifecycle: daemon dropped this peer’s identity. Wipe any per-peer state owned by messaging and emit HistoryCleared so live UIs flush their per-peer buffers.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more