xmtp_configuration/common/notifications.rs
1use std::time::Duration;
2
3/// Bound the complete notification operation, including auth and transport retries.
4pub const NOTIFICATION_REQUEST_TIMEOUT: Duration = Duration::from_secs(30);
5
6/// Maximum total adds and removes in one notification request.
7pub const NOTIFICATION_BATCH_TOPICS: usize = 1000;
8/// Most HMAC keys one subscription may carry: the previous, current, and next epoch.
9pub const MAX_SUBSCRIPTION_HMAC_KEYS: usize = 3;
10/// Most HMAC keys one notification request may carry across its adds.
11pub const NOTIFICATION_BATCH_HMAC_KEYS: usize =
12 NOTIFICATION_BATCH_TOPICS * MAX_SUBSCRIPTION_HMAC_KEYS;
13
14/// Largest complete UpdateSubscriptions protobuf, excluding the gRPC header.
15/// Two 32-byte credentials, full adds with 33-byte topics, maximum nonnegative
16/// epoch bases, include_commits, and 42-byte keys; includes all field wrappers.
17pub const NOTIFICATION_BATCH_MAX_BYTES: usize = 2 * (1 + 1 + 32)
18 + NOTIFICATION_BATCH_TOPICS * (3 + 35 + 10 + 2)
19 + NOTIFICATION_BATCH_HMAC_KEYS * (1 + 1 + 42);