feat(nomad devices): store remote messages into db (part 13) [WPB-23813]#3923
Conversation
ab986e8 to
260a979
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3923 +/- ##
===========================================
+ Coverage 59.22% 59.79% +0.57%
===========================================
Files 1962 1965 +3
Lines 62891 63255 +364
Branches 6834 6877 +43
===========================================
+ Hits 37249 37826 +577
+ Misses 22590 22328 -262
- Partials 3052 3101 +49
... and 12 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
| Branch | nomad-devices/feat/store-remote-messages-into-DB |
| Testbed | ubuntu-latest |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | microseconds (µs) |
|---|---|---|
| com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInFiles | 📈 view plot | 939.27 µs |
| com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInMemory | 📈 view plot | 593,523.48 µs |
| com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.messageInsertionBenchmark | 📈 view plot | 1,336,735.99 µs |
| com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.queryMessagesBenchmark | 📈 view plot | 21,208.96 µs |
|



https://wearezeta.atlassian.net/browse/WPB-23813
PR Submission Checklist for internal contributors
- [x] conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
- [x] contains a reference JIRA issue number like
SQPIT-764- [x] answers the question:
If merged, this PR will: ... ³
What's new in this PR?
Issues
Solutions
SyncNomadAllMessagesUseCasecallsNomadDeviceSyncApi.getAllMessages()(GET /all-messages) to retrieve all conversations and their messages.NomadAllMessagesMapperdecodes each message's Base64 protobuf payload (NomadDeviceMessagePayload) and maps it to aSyncableMessagePayloadEntity(Text, Asset, Location, Multipart, or Unsupported).NomadMessagesDAO.storeMessages()inserts messages into the SQLDelight database in batches (default 200), each batch in its own transaction. Before inserting messages, placeholder User and Conversation rows are created to satisfy foreign key constraints. Conversations are markedincomplete_metadata=1to be enriched later by a separate metadata sync.INSERT OR IGNOREso re-syncing is safe.Content Type Mapping
NomadDeviceTextTextMessageTextContent+MessageMentionNomadDeviceAssetAssetMessageAssetContentNomadDeviceLocationLocationMessageConversationLocationContentNomadDeviceMultipartMultipartMessageTextContent+MessageMention+MessageAttachmentsUnsupportedMessageUnknownContentKey Behaviors
incomplete_metadata=1for later enrichmentINSERT OR IGNOREon messages, so re-syncing the same data is safeUnknowncontent type