pub struct Node {
pub identity: Arc<Identity>,
pub friends: Arc<dyn FriendsStore + Send + Sync>,
pub history: Arc<dyn MessageStore + Send + Sync>,
pub outbox: Arc<dyn OutboxStore + Send + Sync>,
pub network: NetworkHandle,
pub ui_notify_tx: UnboundedSender<UiNotification>,
pub sync_engine: Arc<Mutex<SyncEngine>>,
}Expand description
Represents the central state and functionality of the application node.
This struct holds all the necessary components for the application to run, such as the user’s identity, storage, network handle, and synchronization engine.
Fields§
§identity: Arc<Identity>The user’s identity.
friends: Arc<dyn FriendsStore + Send + Sync>The store for managing friends.
history: Arc<dyn MessageStore + Send + Sync>The store for managing message history.
outbox: Arc<dyn OutboxStore + Send + Sync>The store for managing outgoing messages.
network: NetworkHandleThe handle for interacting with the network layer.
ui_notify_tx: UnboundedSender<UiNotification>The sender for sending notifications to the TUI.
sync_engine: Arc<Mutex<SyncEngine>>The synchronization engine.
Implementations§
Source§impl Node
impl Node
Sourcepub async fn forward_to_mailboxes(
&self,
message: &Message,
friend: &Friend,
providers: &HashSet<PeerId>,
) -> Result<MailboxDeliveryResult>
pub async fn forward_to_mailboxes( &self, message: &Message, friend: &Friend, providers: &HashSet<PeerId>, ) -> Result<MailboxDeliveryResult>
Forwards a message to a set of mailboxes.
This function attempts to deliver a message to a set of mailboxes for a given friend. It will try to deliver the message to at least two mailboxes for redundancy.
§Arguments
message- The message to forward.friend- The friend to whom the message is being sent.providers- The set of mailboxes to try.
§Returns
A MailboxDeliveryResult indicating whether the delivery was successful.
Auto Trait Implementations§
impl Freeze for Node
impl !RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl !UnwindSafe for Node
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> 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