Expand description
Profile sync — priority queue, background processor, and relay fetching.
The sync queue batches profile fetches by priority (Critical → High → Medium → Low),
with cache windows to avoid hammering relays. The background processor
drains the queue and calls load_profile for each entry.
Platform-specific work (DB persistence, image caching) is handled by the
ProfileSyncHandler trait — src-tauri provides TauriProfileSyncHandler,
CLI provides a no-op or logging implementation.
Structs§
- NoOp
Profile Sync Handler - No-op handler for CLI/tests.
- Profile
Sync Queue - Profile sync queue manager with four priority lanes.
Enums§
- Sync
Priority - Priority levels for profile syncing.
Traits§
- Profile
Sync Handler - Callback trait for platform-specific profile sync work.
Functions§
- block_
user - Block a user by npub. DM events from blocked users are dropped after decryption. Group messages are stored but filtered in the UI.
- clear_
profile_ sync_ queue - Drop every queued profile-sync entry. Called by
reset_session()so the long-livedstart_profile_sync_processorloop doesn’t service the prior account’s contacts after an inline session swap. - get_
blocked_ users - Get all blocked profiles.
- load_
profile - Fetch a profile’s metadata and status from relays, update STATE, and notify via EventEmitter + handler callback.
- queue_
chat_ profiles - Queue all profiles for a chat.
- queue_
profile_ sync - Queue a single profile for syncing.
- refresh_
profile_ now - Force immediate refresh of a profile (for user clicks).
- set_
nickname - Set a nickname for a profile.
- start_
profile_ sync_ processor - Background processor that continuously drains the profile sync queue.
- sync_
all_ profiles - Sync all profiles in the system.
- unblock_
user - Unblock a user by npub.
- update_
bot_ profile - Publish the current user’s profile and mark it as a bot (
bot: truein the metadata). The SDK uses this so every bot it builds is tagged; human clients useupdate_profile. - update_
profile - Update the current user’s profile metadata and broadcast to relays.
- update_
status - Update the current user’s status (kind 30315) and broadcast to relays.