status-go/protocol
Pascal Precht 0ccdec2985 feat(CommunitiesManager): introduce `CreateHistoryArchiveTorrentFromMessages` API
Prior to this commit we had a `CreateHistoryArchiveTorrent()` API which
takes a `startDate`, an `endDate` and a `partition` to create a bunch of
message archives, given a certain time range.

The function expects the messages to live in the database, which means,
all messages that need to be archived have to be saved there at some
point.

This turns out to be an issue when importing communities from third
party services, where, sometimes, there are several thousands of messages
including attachment payloads, that have to be save to the database
first.

There are only two options to get the messages into the database:

1. Make one write operation with all messages - this slow, takes a long
   time and blocks the database until done
2. Create message chunks and perform multiple write operations - this is
   also slow, takes long but makes the database a bit more responsive as
   it's many smaller operations instead of one big one

Option 2) turned out to not be super feasible either as sometimes,
inserting even a single such message can take up to 10 seconds
(depending on payload)

Which brings me to the third option.

**A third option** is to not store those imported messages as waku
message into the database, just to later query them again to create the
archives, but instead create the archives right away from all the
messages that have been loaded into memory.

This is significantly faster and doesn't block the database.

To make this possible, this commit introduces
a `CreateHistoryArchiveTorrentFromMessages()` API, and
a `CreateHistoryArchiveTorrentFromDB()` API which can be used for
different use cases.
2022-10-24 13:28:55 +02:00
..
anonmetrics Send all encryption keys 2022-10-20 12:19:44 +01:00
audio Add audio messages 2020-07-27 17:14:50 +02:00
common Send all encryption keys 2022-10-20 12:19:44 +01:00
communities feat(CommunitiesManager): introduce `CreateHistoryArchiveTorrentFromMessages` API 2022-10-24 13:28:55 +02:00
datasync Rename MessageProcessor to MessageSender (#2264) 2021-06-23 17:13:48 +03:00
discord feat: add `discord_messages` table and persistence APIs 2022-08-11 10:49:23 +02:00
encryption Send all encryption keys 2022-10-20 12:19:44 +01:00
ens feat: make kdf iterations configurable when creating a multiaccount (#2796) 2022-09-27 16:27:20 -04:00
identity Use image server for all kind of images and integrate identity rings 2022-09-16 09:52:08 +01:00
images load audio from http server 2022-03-01 15:58:32 +01:00
internal/sqlite Sync Settings (#2478) 2022-03-23 18:47:00 +00:00
migrations Send all encryption keys 2022-10-20 12:19:44 +01:00
protobuf Send all encryption keys 2022-10-20 12:19:44 +01:00
pushnotificationclient Send all encryption keys 2022-10-20 12:19:44 +01:00
pushnotificationserver Send all encryption keys 2022-10-20 12:19:44 +01:00
requests feat: edit/delete/reply for emoji/sticker/audio (#2771) 2022-10-05 21:54:47 +04:00
sqlite feat: make kdf iterations configurable when creating a multiaccount (#2796) 2022-09-27 16:27:20 -04:00
subscription Move to monorepo structure (#1684) 2019-11-21 17:19:22 +01:00
transport Send all encryption keys 2022-10-20 12:19:44 +01:00
tt Tests and linting 2021-09-30 13:02:41 +01:00
urls fix: remove tenor.com from preview whitelist 2022-09-15 12:27:49 +02:00
v1 Send all encryption keys 2022-10-20 12:19:44 +01:00
verification feat: make kdf iterations configurable when creating a multiaccount (#2796) 2022-09-27 16:27:20 -04:00
zaputil Move to monorepo structure (#1684) 2019-11-21 17:19:22 +01:00
LICENSE Move to monorepo structure (#1684) 2019-11-21 17:19:22 +01:00
README.md Added basic history of the protocol package (#1984) 2020-06-04 11:23:09 +01:00
activity_center.go Initial support for mutual contact requests 2022-05-31 09:12:36 +01:00
activity_center_persistence.go Fix activity notification delition on message delition 2022-09-16 14:10:25 +02:00
anon_metrics_test.go rename status-react to status-mobile 2022-07-17 15:37:14 +02:00
chat.go feat: add and distribute `chatIdentity.FirstMessageTimestamp` 2022-09-09 08:59:39 +02:00
chat_group_proxy.go Clean up protocol package (#1890) 2020-03-09 07:19:23 +01:00
chat_test.go feat: add and distribute `chatIdentity.FirstMessageTimestamp` 2022-09-09 08:59:39 +02:00
communities_messenger_test.go feat: add `SpectateCommunity` api 2022-10-06 21:21:37 +02:00
contact.go feat: make any member able to add new users to group chat 2022-09-13 12:16:14 +02:00
delete_for_me_message.go feat: delete for me (#2866) 2022-09-28 19:42:17 +08:00
delete_message.go Delete messages (#2279) 2021-07-26 17:06:32 -04:00
edit_message.go address feedback 2021-06-29 13:15:15 +02:00
emoji_reaction.go Skip wrapping emojis in private group chats 2021-01-26 09:39:47 +01:00
errors.go Add ClearHistory & DeactivateChat methods 2021-01-11 13:36:05 +01:00
group_chat_invitation.go group chat invitation 2020-09-07 12:15:58 +02:00
group_chat_system_messages.go feat: Handle image in group chat 2022-09-01 12:19:01 +02:00
identity_images.go Add HasAddedUs field 2021-10-04 12:19:15 +02:00
local_notifications.go Sync Settings (#2478) 2022-03-23 18:47:00 +00:00
message_builder.go add PinMessage and PinnedMessage (#2180) 2021-05-14 23:22:50 +02:00
message_persistence.go fix(message_persistence): ensure query cursor value is supplied where (#2898) 2022-10-07 13:38:28 -04:00
message_validator.go feat: delete for me (#2866) 2022-09-28 19:42:17 +08:00
message_validator_test.go Fix protobuf ImageType change 2020-12-17 14:10:00 +01:00
messenger.go feat(communities): add encryption suppord to archive protocol 2022-10-24 12:35:38 +02:00
messenger_activity_center.go Join group on accepting activity center notification 2022-06-08 11:48:45 +01:00
messenger_activity_center_test.go Turning the tests back on (#2519) 2022-02-03 20:37:41 +00:00
messenger_auto_message.go feat: auto message (#2441) 2021-11-29 14:11:55 +01:00
messenger_backup.go feat: contact verification request (#2586) 2022-07-05 15:49:44 -04:00
messenger_backup_test.go feat(messenger): add `createDefaultChannel` flag to `CreateCommunity` API 2022-07-26 10:23:49 +02:00
messenger_bookmarks.go feat: add garbage collection for soft deleted bookmarks 2022-06-17 14:21:21 +02:00
messenger_browsers.go Issue 13813 -- Use messenger ns for browser CRUD (#2801) 2022-08-24 16:05:35 +02:00
messenger_browsers_test.go Issue 13813 -- Use messenger ns for browser CRUD (#2801) 2022-08-24 16:05:35 +02:00
messenger_chats.go return muted chats in ChatsPreview call (#2617) 2022-04-01 14:20:38 +05:30
messenger_communities.go feat(communities): add encryption suppord to archive protocol 2022-10-24 12:35:38 +02:00
messenger_config.go feat: make kdf iterations configurable when creating a multiaccount (#2796) 2022-09-27 16:27:20 -04:00
messenger_contact_requests_test.go fix: lint (#2845) 2022-09-27 18:59:02 -04:00
messenger_contact_update_test.go Sync Settings (#2478) 2022-03-23 18:47:00 +00:00
messenger_contact_verification.go feat: contact verification request (#2586) 2022-07-05 15:49:44 -04:00
messenger_contacts.go [#13672] Sync contact request decision 2022-08-24 16:08:41 +02:00
messenger_delete_message_for_me_test.go feat: delete for me (#2866) 2022-09-28 19:42:17 +08:00
messenger_delete_message_test.go Turning the tests back on (#2519) 2022-02-03 20:37:41 +00:00
messenger_discv5.go feat: Add DiscV5 to Waku2 (#2434) 2021-11-22 09:40:14 -04:00
messenger_edit_message_test.go feat: make any member able to add new users to group chat 2022-09-13 12:16:14 +02:00
messenger_emoji_test.go feat: make any member able to add new users to group chat 2022-09-13 12:16:14 +02:00
messenger_ens.go Request/Decline access to communities 2021-02-26 15:35:43 +01:00
messenger_group_chat.go feat: make any member able to add new users to group chat 2022-09-13 12:16:14 +02:00
messenger_group_chat_test.go feat: make any member able to edit group chat properties 2022-09-13 12:16:14 +02:00
messenger_handler.go feat(communities): retry downloading archive data 2022-10-17 11:33:02 +02:00
messenger_handler_test.go feat: Handle image in group chat 2022-09-01 12:19:01 +02:00
messenger_identity.go chore: add bio and social links validation 2022-08-16 14:29:00 +02:00
messenger_identity_image_test.go Added multiaccounts.Database tests for new funcs 2022-08-22 13:27:59 +01:00
messenger_images.go Get preferred network IP and refactor server package to increase reusability (#2626) 2022-06-15 15:49:31 +01:00
messenger_installations_test.go fix(messenger): don't remove inactive chats when syncing 2022-08-25 11:51:01 +02:00
messenger_mailserver.go Introduce community history archive routine 2022-04-06 13:00:33 +02:00
messenger_mailserver_cycle.go Initial support for mutual contact requests 2022-05-31 09:12:36 +01:00
messenger_maps.go Tests and linting 2021-09-30 13:02:41 +01:00
messenger_messages.go feat: edit/delete/reply for emoji/sticker/audio (#2771) 2022-10-05 21:54:47 +04:00
messenger_mute_test.go Fix some tests and restore private/public RPC client 2021-07-20 10:57:38 +02:00
messenger_peers.go feat: functions to add peers and dial (#2345) 2021-09-27 09:04:28 -04:00
messenger_pin_message_test.go Turning the tests back on (#2519) 2022-02-03 20:37:41 +00:00
messenger_pin_messages.go feat: introduce `CommunityAdminSettings` in `CommunityDescription` 2022-05-18 09:58:11 +02:00
messenger_response.go fix(MessengerResponse): ensure `savedAddresses` response as `omitempty` 2022-10-13 14:53:09 +02:00
messenger_response_test.go feat: desktop mailserver cycle (#2481) 2022-01-12 12:02:01 -04:00
messenger_saved_address.go feat: sync saved addresses 2022-10-10 11:26:35 +02:00
messenger_share_image_test.go fix: TestImageMessageSharing (#2874) 2022-09-21 09:48:04 -04:00
messenger_status_updates.go fix: prevent tests segfault 2022-08-26 11:25:33 +02:00
messenger_status_updates_test.go Timeout automatic status updates (#2757) 2022-08-03 04:38:01 +05:30
messenger_sync_bookmark_test.go feat: add garbage collection for soft deleted bookmarks 2022-06-17 14:21:21 +02:00
messenger_sync_chat_test.go Set joined=message.clock on syncing pubchat creation 2021-12-24 16:47:28 +02:00
messenger_sync_clear_history_test.go Sync clear history 2022-02-17 11:15:01 +00:00
messenger_sync_profile_picture_test.go Added multiaccounts.Database tests for new funcs 2022-08-22 13:27:59 +01:00
messenger_sync_saved_addresses_test.go feat: sync saved addresses 2022-10-10 11:26:35 +02:00
messenger_sync_settings.go Enable currency settings and sticker pack synchronization 2022-05-11 16:59:12 +03:00
messenger_sync_settings_test.go chore: use provided pictures visibility options when creating settings db entry (#2867) 2022-10-05 12:53:42 +02:00
messenger_sync_verification_test.go feat: contact verification request (#2586) 2022-07-05 15:49:44 -04:00
messenger_sync_wallets_test.go Wallet sync for generated accounts 2022-07-06 19:24:43 +03:00
messenger_test.go feat: sync saved addresses 2022-10-10 11:26:35 +02:00
messenger_walletconnect.go Implement wallet connect session CRUD API 2022-08-19 12:32:00 +01:00
messenger_walletconnect_test.go Implement wallet connect session CRUD API 2022-08-19 12:32:00 +01:00
persistence.go Use image server for all kind of images and integrate identity rings 2022-09-16 09:52:08 +01:00
persistence_test.go Send all encryption keys 2022-10-20 12:19:44 +01:00
push_notification_test.go feat(messenger): add `createDefaultChannel` flag to `CreateCommunity` API 2022-07-26 10:23:49 +02:00
status_update.go feat: user status (#2276) 2021-07-22 13:41:49 -04:00
transaction_validator.go Move message to common namespace 2020-09-09 21:22:12 +02:00
transaction_validator_test.go Move message to common namespace 2020-09-09 21:22:12 +02:00

README.md

status-go/protocol

This is an implementation of the secure transport and payloads which are a part of the Status Client specification.

This implementation uses SQLite and SQLCipher for persistent storage.

The payloads are encoded using protocol-buffers.

Content

  • messenger.go is the main file which exports Messenger struct. This is a public API to interact with this implementation of the Status Chat Protocol.
  • protobuf/ contains protobuf files implementing payloads described in the Payloads spec.
  • encryption/ implements the Secure Transport spec.
  • transport/ connects the Status Chat Protocol with a wire-protocol which in our case is either Whisper or Waku.
  • datasync/ is an adapter for MVDS.
  • applicationmetadata/ is an outer layer wrapping a payload with an app-specific metadata like a signature.
  • identity/ implements details related to creating a three-word name and identicon.
  • migrations/ contains implementation specific migrations for the sqlite database which is used by Messenger as a persistent data store.

History

Originally this package was a dedicated repo called status-protocol-go and was migrated into status-go. The new status-go/protocol package maintained its own dependencies until sub modules were removed and the root go.mod file managed all dependencies for the entire status-go repo.