pub struct ProtocolEngine {
pub batch_depth: Cell<u32>,
pub batch_persist_dirty: Cell<bool>,
/* private fields */
}Fields§
§batch_depth: Cell<u32>While > 0, persist() only flips batch_persist_dirty instead of
serializing+writing. AppCore wraps catch-up bursts and other
multi-event entry points so an N-event burst issues one persist
instead of N. The exclusive SQLite write under iOS DELETE-mode
journaling can keep UI reads blocked on the connection mutex for
hundreds of ms each — N of them stacked produced the multi-second
foreground freeze.
batch_persist_dirty: Cell<bool>Implementations§
§impl ProtocolEngine
impl ProtocolEngine
pub fn load_or_create_for_local_device( storage: Arc<dyn StorageAdapter>, owner_pubkey: PublicKey, device_keys: &Keys, ) -> Result<Self>
pub fn debug_snapshot(&self) -> ProtocolEngineDebugSnapshot
pub fn session_manager_snapshot_for_test(&self) -> SessionManagerSnapshot
pub fn group_manager_snapshot_for_test(&self) -> GroupManagerSnapshot
pub fn is_known_local_owner_device(&self, device_pubkey: PublicKey) -> bool
pub fn owner_hint_for_device( &self, device_pubkey: PublicKey, ) -> Option<ProtocolDeviceOwnerHint>
pub fn has_pending_inbound_direct_events(&self) -> bool
pub fn has_pending_retry_work(&self) -> bool
pub fn has_pending_inbound_direct_event_id(&self, event_id: &str) -> bool
pub fn queued_owner_claim_targets(&self) -> Vec<String>
pub fn queued_protocol_backfill_effects( &self, now: NdrUnixSeconds, reason: &'static str, ) -> (Vec<String>, Vec<ProtocolEffect>)
pub fn queued_group_target_hexes(&self) -> Vec<String>
pub fn local_invite(&self) -> Option<Invite>
pub fn local_invite_response_pubkey(&self) -> Option<PublicKey>
pub fn pending_inbound_for_test(&self) -> Vec<ProtocolPendingInboundTestDebug>
Walks every session and returns its expected event-author
pubkeys, but only for sessions whose peer owner passes the
accept_owner predicate. The owner-aware variant lets the
caller drop blocked / non-accepted peers from the subscription
filter without losing the device-ephemeral keys that nostr
actually filters on.
pub fn pending_decrypted_deliveries_len_for_test(&self) -> usize
pub fn known_group_sender_event_pubkeys(&self) -> Vec<PublicKey>
pub fn known_device_identity_pubkeys_for_owner( &self, owner_pubkey: PublicKey, ) -> Vec<PublicKey>
pub fn session_manager_snapshot(&self) -> SessionManagerSnapshot
pub fn session_manager_snapshot(&self) -> SessionManagerSnapshot
SessionManager::snapshot clones every user record + every
device state — the runtime debug builder fans out per known
user, so callers that hit multiple owners in one pass must
share a single snapshot via the _with_snapshot helpers
below instead of paying that clone cost per owner.