Skip to main content

Module constants

Module constants 

Source
Expand description

Constants used throughout the offline-protocol crate.

Constants§

ACK_FOR_KEY
Metadata key for ACK messages indicating which message ID the ACK is for.
ACK_HOP_COUNT_KEY
Metadata key for ACK messages indicating the hop count.
ACK_TRANSPORT_KEY
Metadata key for ACK messages indicating the transport used.
CHUNK_SIZE_BLE
Chunk size for BLE file transfers (4 KB). Reduces BLE double-fragmentation: ~22 BLE fragments per chunk instead of ~240.
CHUNK_SIZE_INTERNET
Chunk size for Internet file transfers (256 KB). Fewer round-trips over WebSocket where bandwidth is plentiful.
DEFAULT_CHUNK_SIZE
Default chunk size for file transfers (32 KB).
DEFAULT_INITIAL_TTL
Default time-to-live for messages.
DEFAULT_MEDIA_WINDOW_SIZE
Default maximum chunks in flight for media transfers.
FLUSH_BATCH_LIMIT
Maximum messages to send in a single flush operation. Prevents blocking the process loop when many messages are pending.
HISTORY_CLEANUP_BATCH_SIZE
Number of messages to remove when history exceeds the maximum. This provides a buffer to avoid frequent cleanup operations.
HOP_COUNT_EMA_ALPHA
EMA alpha for hop count tracking.
LATENCY_EMA_ALPHA
EMA (Exponential Moving Average) alpha for latency tracking.
MAX_CONCURRENT_INTERNAL_MEDIA_TRANSFERS_PER_PEER
How many of a peer’s transfer slots the SDK’s own document-layer traffic may occupy at once.
MAX_CONCURRENT_MEDIA_TRANSFERS_PER_PEER
Maximum concurrent outbound media transfers per recipient when chunks are MLS-encrypted.
MAX_FORWARD_COUNT
Maximum number of times a message may be forwarded. Prevents unbounded forwarding chains from malicious or buggy clients.
MAX_MEDIA_DESCRIPTORS
Maximum persisted outbound media transfer descriptors restored after a restart (newest-first). Small on purpose: each maps to a MediaResendRequired the app is expected to act on, and concurrent transfers are already capped per peer.
MAX_MEDIA_OUTBOX_ENTRIES
Maximum entries in the dedicated media outbox. Smaller than the main outbox since the sliding window limits in-flight chunks.
MAX_MESSAGE_HISTORY
Maximum number of messages to keep in history for topology visualization. This prevents unbounded memory growth while maintaining enough history for accurate network statistics.
MAX_OUTBOX_ENTRIES
Maximum number of entries in the outbox before evicting oldest entries. This prevents unbounded memory growth when messages cannot be delivered.
MEDIA_WINDOW_SIZE_BLE
Maximum chunks in flight for BLE media transfers. BLE’s low bandwidth means fewer concurrent chunks to avoid congestion.
MEDIA_WINDOW_SIZE_INTERNET
Maximum chunks in flight for Internet media transfers.
OBSERVED_STATS_COMPACT_THRESHOLD
Threshold for compacting observed stats to prevent unbounded growth.
ORIGINAL_CONTENT_TYPE_KEY
Metadata key carrying the original content type on file-chunk messages.
OUTBOX_ABSOLUTE_LIFETIME_FACTOR
Absolute cap on a restored outbox entry’s total lifetime, as a multiple of outbox_max_lifetime_ms, measured from first_sent_at.
TRANSPORT_PREFERENCE_INTERNET
Transport preference value: prefer internet transport.
TRANSPORT_PREFERENCE_KEY
Metadata key indicating preferred transport for a message.