pub struct LiveOnly<'a> { /* private fields */ }Expand description
For catch-up syncs: forwards to inner only what is live rather than
history. Mini App peer signals always: a signal is live state, and a sync
that opens one ledgers its wrapper, so the live subscription will never
deliver it again. With from, also DMs and files sent since
that moment: sent while the sync ran, they can reach us through it alone.
Implementations§
Source§impl<'a> LiveOnly<'a>
impl<'a> LiveOnly<'a>
Sourcepub fn signals(inner: &'a dyn InboundEventHandler) -> Self
pub fn signals(inner: &'a dyn InboundEventHandler) -> Self
Signals only.
Sourcepub fn from(inner: &'a dyn InboundEventHandler, ms: u64) -> Self
pub fn from(inner: &'a dyn InboundEventHandler, ms: u64) -> Self
Signals, and messages sent at or after ms (unix milliseconds).
Trait Implementations§
Source§impl InboundEventHandler for LiveOnly<'_>
impl InboundEventHandler for LiveOnly<'_>
Source§fn on_community_webxdc(
&self,
chat_id: &str,
npub: &str,
topic_id: &str,
node_addr: Option<&str>,
event_id: &str,
created_at: u64,
)
fn on_community_webxdc( &self, chat_id: &str, npub: &str, topic_id: &str, node_addr: Option<&str>, event_id: &str, created_at: u64, )
A WebXDC realtime peer signal.
node_addr = Some advertises an Iroh node, None = peer-left.Source§fn on_webxdc_signal(
&self,
contact: &str,
npub: &str,
topic_id: &str,
node_addr: Option<&str>,
event_id: &str,
created_at: u64,
)
fn on_webxdc_signal( &self, contact: &str, npub: &str, topic_id: &str, node_addr: Option<&str>, event_id: &str, created_at: u64, )
A WebXDC realtime peer signal in a DM.
contact is the DM’s npub; node_addr =
Some advertises an Iroh node, None = peer-left. Clients without Iroh ignore it.Source§fn on_dm_received(&self, chat_id: &str, msg: &Message, is_new: bool)
fn on_dm_received(&self, chat_id: &str, msg: &Message, is_new: bool)
A DM text message was received and committed to STATE + DB.
Source§fn on_file_received(&self, chat_id: &str, msg: &Message, is_new: bool)
fn on_file_received(&self, chat_id: &str, msg: &Message, is_new: bool)
A DM file attachment was received and committed to STATE + DB.
Source§fn on_reaction_received(&self, _chat_id: &str, _msg: &Message)
fn on_reaction_received(&self, _chat_id: &str, _msg: &Message)
A reaction was received and applied to a message.
Source§fn on_message_deleted(&self, _chat_id: &str, _message_id: &str)
fn on_message_deleted(&self, _chat_id: &str, _message_id: &str)
A previously-stored message was deleted by its sender (Layer 2
cooperative hide via NIP-09 over NIP-17). Frontend drops the row.
Source§fn on_community_invite(&self, _community_id: &str)
fn on_community_invite(&self, _community_id: &str)
A Community invite was received over a gift wrap and the local user was
joined (member-view Community persisted). Platform refreshes the Community
subscription so messages start flowing, and surfaces the new Community in the UI.
Source§fn on_community_message(&self, _chat_id: &str, _msg: &Message, _is_new: bool)
fn on_community_message(&self, _chat_id: &str, _msg: &Message, _is_new: bool)
A new Community channel message was received, ingested into STATE, and persisted.
Source§fn on_community_update(&self, _chat_id: &str, _target_id: &str, _msg: &Message)
fn on_community_update(&self, _chat_id: &str, _target_id: &str, _msg: &Message)
A reaction or edit was applied to an existing Community message.
target_id is the
affected message; msg is the live-updated view.Source§fn on_community_removed(&self, _chat_id: &str, _target_id: &str)
fn on_community_removed(&self, _chat_id: &str, _target_id: &str)
A Community message was removed (cooperative delete / moderation tombstone).
Source§fn on_community_presence(
&self,
_chat_id: &str,
_npub: &str,
_joined: bool,
_event_id: &str,
_created_at: u64,
_invited_by: Option<&str>,
_invited_label: Option<&str>,
)
fn on_community_presence( &self, _chat_id: &str, _npub: &str, _joined: bool, _event_id: &str, _created_at: u64, _invited_by: Option<&str>, _invited_label: Option<&str>, )
A join/leave presence announcement.
created_at is the authenticated inner timestamp;
invited_by/invited_label carry invite attribution when present.Source§fn on_community_typing(&self, _chat_id: &str, _npub: &str, _until: u64)
fn on_community_typing(&self, _chat_id: &str, _npub: &str, _until: u64)
A Community typing indicator (ephemeral).
until is the unix-secs the typer stops being active.Source§fn on_community_self_removed(&self, _community_id: &str)
fn on_community_self_removed(&self, _community_id: &str)
The local user was removed from a Community (kick / ban / a leave authored on another device).
Local data is torn down (epoch keys retained); the platform surfaces it + refreshes subs.
Source§fn on_channel_keyed(
&self,
_community_id: &str,
_channel_id: &str,
_backfilled: usize,
)
fn on_channel_keyed( &self, _community_id: &str, _channel_id: &str, _backfilled: usize, )
A Private channel is now readable — its key arrived, by rekey delivery or
by a grant’s key vend.
channel_id is the 32-byte hex id. Read moreSource§fn on_subscription_ready(&self, _communities: usize)
fn on_subscription_ready(&self, _communities: usize)
The realtime Community subscription REGISTERED: healthy relays deliver
live channel events from this moment (AUTH-gating relays join as their
stream auth completes in the background). Fires once per
listen, after the startup refresh commits —
even when communities is 0, so “subscribed to nothing” and “still
connecting” are distinguishable. Community messages sent before this are
only recoverable by a later sync; DMs sent since listen began still
reach the handler.Source§fn on_community_refreshed(&self, _community_id: &str)
fn on_community_refreshed(&self, _community_id: &str)
A Community’s control plane was refreshed in realtime (banlist/roles/metadata/mode change,
or a re-founding followed). The platform re-reads display state.
Source§fn on_community_dissolved(&self, _community_id: &str)
fn on_community_dissolved(&self, _community_id: &str)
A Community was DISSOLVED by its owner (CORD-02 §9): sealed read-only, held keys still open
history but nothing new is honored. The platform surfaces the grave.
Source§fn buffer_persist(
&self,
_chat_id: &str,
_msg: &Message,
_wrapper: Option<([u8; 32], u64)>,
) -> bool
fn buffer_persist( &self, _chat_id: &str, _msg: &Message, _wrapper: Option<([u8; 32], u64)>, ) -> bool
Bulk-sync persist intercept: return
true to take ownership of persisting a committed
DM/file message — the commit then SKIPS its per-message save AND its wrapper-ledger
write (wrapper = the gift-wrap’s (id_bytes, created_at); the owner MUST commit it
in the same transaction as the message row, or the message loses crash/drop
recoverability). Streaming sync loops (see BatchingPersist) buffer here and drain
many messages into one transaction. Default false keeps the per-message save.Auto Trait Implementations§
impl<'a> !RefUnwindSafe for LiveOnly<'a>
impl<'a> !UnwindSafe for LiveOnly<'a>
impl<'a> Freeze for LiveOnly<'a>
impl<'a> Send for LiveOnly<'a>
impl<'a> Sync for LiveOnly<'a>
impl<'a> Unpin for LiveOnly<'a>
impl<'a> UnsafeUnpin for LiveOnly<'a>
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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