xmtp_configuration/common/backend.rs
1/// Length of a keyed group id and of a commit-log id, in bytes: the topic
2/// identifier of kinds 0 and 4.
3pub const GROUP_ID_BYTES: usize = 32;
4/// Length of a legacy group id, in bytes. Legacy ids come only from imported
5/// archives, and no topic carries one.
6pub const LEGACY_GROUP_ID_BYTES: usize = 16;
7/// Most envelopes one publish request may carry, duplicates included (API
8/// section 7). Clients chunk to it, and the backend refuses more.
9pub const MAX_PUBLISH_ENVELOPES: usize = 1_000;
10/// Most identity updates one publish request may carry, duplicates included
11/// (API section 7). Admission replays one stored log for each, one at a time.
12pub const MAX_PUBLISH_IDENTITY_UPDATES: usize = 5;
13/// Most identity actions one publish request may carry across all its
14/// identity updates: every identity update at the action limit.
15pub const MAX_PUBLISH_IDENTITY_ACTIONS: usize =
16 MAX_PUBLISH_IDENTITY_UPDATES * super::MAX_IDENTITY_UPDATE_ACTIONS;
17/// Welcome, key-package, and identity topic identifier length, in bytes.
18pub const BACKEND_INSTALLATION_ID_BYTES: usize = 32;
19
20/// Default age for ordinary group messages, in seconds.
21pub const BACKEND_DEFAULT_GROUP_MESSAGE_SECONDS: u64 = 7_776_000;
22/// Default age for welcome messages, in seconds.
23pub const BACKEND_DEFAULT_WELCOME_SECONDS: u64 = 7_776_000;
24/// Default age for key packages, in seconds.
25pub const BACKEND_DEFAULT_KEY_PACKAGE_SECONDS: u64 = 7_776_000;
26
27/// Default per-topic query limit.
28pub const BACKEND_DEFAULT_QUERY_LIMIT: usize = 100;
29/// Default maximum query limit.
30pub const BACKEND_DEFAULT_MAX_QUERY_LIMIT: usize = 1_000;
31/// Default maximum number of query topics.
32pub const BACKEND_DEFAULT_MAX_QUERY_TOPICS: usize = 1_000;
33/// Default maximum number of metadata-only newest topics.
34pub const BACKEND_DEFAULT_MAX_NEWEST_METADATA_TOPICS: usize = 1_000;
35/// Default maximum number of full newest topics.
36pub const BACKEND_DEFAULT_MAX_NEWEST_FULL_TOPICS: usize = 100;
37/// Default maximum number of topics in one publish.
38pub const BACKEND_DEFAULT_MAX_PUBLISH_TOPICS: usize = 1_000;
39/// Default maximum encoded envelope size, in bytes.
40pub const BACKEND_DEFAULT_MAX_ENVELOPE_BYTES: usize = 1_048_576;
41/// Default maximum encoded request size, in bytes.
42pub const BACKEND_DEFAULT_MAX_REQUEST_BYTES: usize = 26_214_400;
43/// Default maximum encoded response size, in bytes.
44pub const BACKEND_DEFAULT_MAX_RESPONSE_BYTES: usize = 26_214_400;
45/// Default maximum topics added by one stream update.
46pub const BACKEND_DEFAULT_MAX_UPDATE_ADDS: usize = 100_000;
47/// Default maximum topics removed by one stream update.
48pub const BACKEND_DEFAULT_MAX_UPDATE_REMOVES: usize = 100_000;
49/// Default maximum registered topics per stream.
50pub const BACKEND_DEFAULT_MAX_STREAM_TOPICS: usize = 100_000;
51/// Default maximum topics in a static subscription.
52pub const BACKEND_DEFAULT_MAX_STATIC_TOPICS: usize = 10_000;
53/// Default maximum identifiers in one inbox lookup.
54pub const BACKEND_DEFAULT_MAX_LOOKUP_IDENTIFIERS: usize = 250;
55/// Default maximum smart-contract-wallet signatures per request.
56pub const BACKEND_DEFAULT_MAX_SCW_SIGNATURES: usize = 100;
57/// Default maximum identity entries per inbox.
58pub const BACKEND_DEFAULT_MAX_IDENTITY_ENTRIES: usize = 256;
59/// Default maximum HTTP/2 streams per connection.
60pub const BACKEND_DEFAULT_MAX_HTTP2_STREAMS: usize = 100;
61/// Default stream update rate, in frames per second.
62pub const BACKEND_DEFAULT_MAX_UPDATE_FRAMES_PER_SECOND: u32 = 10;
63/// Default stream update token-bucket burst.
64pub const BACKEND_DEFAULT_MAX_UPDATE_BURST: u32 = 100;
65/// Default client ping rate, in frames per second.
66pub const BACKEND_DEFAULT_MAX_PING_FRAMES_PER_SECOND: u32 = 10;
67/// Default client ping token-bucket burst.
68pub const BACKEND_DEFAULT_MAX_PING_BURST: u32 = 100;
69
70/// Default interval between stream keepalive frames, in milliseconds.
71pub const BACKEND_DEFAULT_KEEPALIVE_INTERVAL_MS: u64 = 30_000;
72
73/// Default database statement timeout. Client identity waits exceed this value.
74pub const BACKEND_DEFAULT_STATEMENT_TIMEOUT_MS: u64 = 5_000;