Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mls (epic) #2015

Merged
merged 47 commits into from
Oct 15, 2023
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d0e6944
feat(mls-migration): fetch migration configuration every 24 hours #1 …
typfel Jun 1, 2023
80119d7
feat(mls-migration): migrate proteus conversations to "mixed" protoco…
typfel Jun 1, 2023
ead755b
feat(mls-migration): support the mixed protocol #3 (#1747)
typfel Jun 2, 2023
a20d905
feat(mls-migration): supported protocols for users #4 (#1786)
typfel Jun 15, 2023
c75f3af
feat(mls-migration): add use case for updating self supported protoco…
typfel Jun 19, 2023
d0bb79d
feat(mls-migration): update conversation protocol to MLS when every m…
typfel Jun 20, 2023
3d57abd
feat(mls-migration): handle protocol changed events #7 (#1811)
typfel Jun 23, 2023
4604487
fix(mls-migration): migration feature config #8 (#1822)
typfel Jun 23, 2023
71c9ed9
feat(mls-migration): update self supported protocols during slow sync…
typfel Jun 26, 2023
5d122b2
feat(mls-migration): force migration when migration deadline arrives …
typfel Jun 26, 2023
bc8f3e7
feat(mls-migration): ignore inactive clients when calculating support…
typfel Jul 20, 2023
4bb4694
fix: updating isMLSCapable (#1905)
typfel Jul 24, 2023
2c72895
chore: fix detekt
typfel Aug 28, 2023
7341205
fix: fetch group id on protocol change event (#2051)
typfel Sep 14, 2023
fc08ffc
chore: fix rebase issues
typfel Sep 19, 2023
c79d1a7
feat(mls-one2one): support fetching mls 1-1 conversation details (#1848)
typfel Jul 11, 2023
dcc3790
feat: support migrating to mls 1-1 (#1875)
typfel Jul 12, 2023
2e09d34
refactor: allow fetching whole conversations by a member (#1940)
vitorhugods Aug 2, 2023
62856c8
feat(mls): establish one-to-one conversation [WPB-2258] (#1953)
vitorhugods Aug 4, 2023
477602b
feat(mls): migrate 1:1 connections from Proteus to MLS [WPB-2258] (#1…
vitorhugods Aug 9, 2023
4b95752
feat: choose 1:1 protocol [WPB-2181] (#1993)
vitorhugods Aug 23, 2023
6fa911d
feat: check supported protocols when creating/fetching team 1-1 (#1995)
typfel Aug 24, 2023
8b8b44a
feat: active one-on-one conversations (#2010)
typfel Aug 31, 2023
e41e4b2
feat: resolve one-on-one conversation to either proteus or mls (#2012)
typfel Aug 31, 2023
2e7cb42
chore: default selfUser when creator field is missing (#2022)
typfel Aug 31, 2023
be386c8
feat: resolve one-on-one conversaions when receiving a welcome messag…
typfel Sep 6, 2023
f4506ed
feat: resolve one-on-on conversation when the connection is accepted …
typfel Sep 6, 2023
fcb0e42
feat: resolve active 1-1 after accepting a connection request (#2042)
typfel Sep 7, 2023
f9c75ea
feat: support parsing quantum safe ciphersuite (#2049)
typfel Sep 12, 2023
c6a2216
feat: avoid race condition when establishing mls 1-1 (#2048)
typfel Sep 15, 2023
a18236f
fix: improve stability of MLS 1-1 conversations (#2063)
typfel Sep 18, 2023
fbc7c12
feat: limit re-trying commit to 2 retry attemps (#2068)
typfel Sep 18, 2023
e58cec6
chore: fix rebase issues
typfel Sep 19, 2023
a958d16
fix: map and ignore BufferedFutureMessage (#2084)
typfel Sep 26, 2023
f8a1a12
feat: update supported protocols after deleting a client (#2083)
typfel Sep 26, 2023
bba019c
feat(mls): recover from stale epoch on message sending (#2076)
typfel Sep 26, 2023
b47e9d8
chore: fix rebase issues
typfel Sep 26, 2023
9b57efb
feat(debug): add use case for disabling event processing (#2096)
typfel Sep 27, 2023
3a07257
chore: fix rebase issues
typfel Oct 4, 2023
2fe242b
refactor: mls feature config handling (#2114)
typfel Oct 6, 2023
8874209
fix: assign supported_protocols when migration user db (#2126)
typfel Oct 11, 2023
0672672
chore(mls): propagate activeOneOnOneConversation on ConversationDetai…
vitorhugods Oct 12, 2023
73f40c3
refactor: only have one main query for inserting/updating users (#2124)
typfel Oct 13, 2023
7c83ef5
fix: supported protocols is only available since API v5 (#2128)
typfel Oct 13, 2023
303cdf5
fix: skip updating supported protocols when mls is not supported (#2131)
typfel Oct 13, 2023
6d73cb0
chore: fix rebase issues
typfel Oct 13, 2023
9a3ef70
chore: squash migrations when possible
typfel Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(debug): add use case for disabling event processing (#2096)
  • Loading branch information
typfel committed Oct 13, 2023
commit 9b57efbfefabdf068c17f542448d29e140df67b3
Original file line number Diff line number Diff line change
@@ -792,8 +792,8 @@ class UserSessionScope internal constructor(

private val eventGatherer: EventGatherer get() = EventGathererImpl(eventRepository, incrementalSyncRepository)

private val eventProcessor: EventProcessor
get() = EventProcessorImpl(
private val eventProcessor: EventProcessor by lazy {
EventProcessorImpl(
eventRepository,
conversationEventReceiver,
userEventReceiver,
@@ -802,6 +802,7 @@ class UserSessionScope internal constructor(
userPropertiesEventReceiver,
federationEventReceiver
)
}

private val slowSyncCriteriaProvider: SlowSyncCriteriaProvider
get() = SlowSlowSyncCriteriaProviderImpl(clientRepository, logoutRepository)
@@ -1439,6 +1440,7 @@ class UserSessionScope internal constructor(
messageSendingScheduler,
selfConversationIdProvider,
staleEpochVerifier,
eventProcessor,
this
)
val messages: MessageScope
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@ import com.wire.kalium.logic.feature.message.ephemeral.DeleteEphemeralMessageFor
import com.wire.kalium.logic.feature.message.ephemeral.DeleteEphemeralMessageForSelfUserAsSenderUseCaseImpl
import com.wire.kalium.logic.feature.message.ephemeral.EphemeralMessageDeletionHandlerImpl
import com.wire.kalium.logic.sync.SyncManager
import com.wire.kalium.logic.sync.incremental.EventProcessor
import com.wire.kalium.logic.util.MessageContentEncoder
import com.wire.kalium.util.KaliumDispatcher
import com.wire.kalium.util.KaliumDispatcherImpl
@@ -77,6 +78,7 @@ class DebugScope internal constructor(
private val messageSendingScheduler: MessageSendingScheduler,
private val selfConversationIdProvider: SelfConversationIdProvider,
private val staleEpochVerifier: StaleEpochVerifier,
private val eventProcessor: EventProcessor,
private val scope: CoroutineScope,
internal val dispatcher: KaliumDispatcher = KaliumDispatcherImpl
) {
@@ -101,6 +103,11 @@ class DebugScope internal constructor(
messageSender
)

val disableEventProcessing: DisableEventProcessingUseCase
get() = DisableEventProcessingUseCaseImpl(
eventProcessor = eventProcessor
)

private val messageSendFailureHandler: MessageSendFailureHandler
get() = MessageSendFailureHandlerImpl(userRepository, clientRepository, messageRepository, messageSendingScheduler)

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Wire
* Copyright (C) 2023 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
package com.wire.kalium.logic.feature.debug

import com.wire.kalium.logic.sync.incremental.EventProcessor

/**
* Disables processing of incoming events but still mark them as processed.
*
* This use case useful for testing error scenarios where messages have been lost,
* putting the client in an inconsistent state with the backend.
*/
interface DisableEventProcessingUseCase {
suspend operator fun invoke(disabled: Boolean)
}

internal class DisableEventProcessingUseCaseImpl(
private val eventProcessor: EventProcessor
) : DisableEventProcessingUseCase {

override suspend fun invoke(disabled: Boolean) {
eventProcessor.disableEventProcessing = disabled
}
}
Original file line number Diff line number Diff line change
@@ -40,6 +40,12 @@ import com.wire.kalium.util.serialization.toJsonElement
* @see [Event]
*/
internal interface EventProcessor {

/**
* When enabled events will be consumed but no event processing will occur.
*/
var disableEventProcessing: Boolean

/**
* Process the [event], and persist the last processed event ID if the event
* is not transient.
@@ -66,23 +72,31 @@ internal class EventProcessorImpl(
kaliumLogger.withFeatureId(EVENT_RECEIVER)
}

override suspend fun processEvent(event: Event): Either<CoreFailure, Unit> = when (event) {
is Event.Conversation -> conversationEventReceiver.onEvent(event)
is Event.User -> userEventReceiver.onEvent(event)
is Event.FeatureConfig -> featureConfigEventReceiver.onEvent(event)
is Event.Unknown -> {
kaliumLogger
.logEventProcessing(
EventLoggingStatus.SKIPPED,
event
)
// Skipping event = success
override var disableEventProcessing: Boolean = false

override suspend fun processEvent(event: Event): Either<CoreFailure, Unit> =
if (disableEventProcessing) {
logger.w("Skipping processing of $event due to debug option")
Either.Right(Unit)
}
} else {
when (event) {
is Event.Conversation -> conversationEventReceiver.onEvent(event)
is Event.User -> userEventReceiver.onEvent(event)
is Event.FeatureConfig -> featureConfigEventReceiver.onEvent(event)
is Event.Unknown -> {
kaliumLogger
.logEventProcessing(
EventLoggingStatus.SKIPPED,
event
)
// Skipping event = success
Either.Right(Unit)
}

is Event.Team -> teamEventReceiver.onEvent(event)
is Event.UserProperty -> userPropertiesEventReceiver.onEvent(event)
is Event.Federation -> federationEventReceiver.onEvent(event)
is Event.Team -> teamEventReceiver.onEvent(event)
is Event.UserProperty -> userPropertiesEventReceiver.onEvent(event)
is Event.Federation -> federationEventReceiver.onEvent(event)
}
}.onSuccess {
val logMap = mapOf<String, Any>(
"event" to event.toLogMap()