diff --git a/src/main/kotlin/com/pubnub/api/eventengine/Effect.kt b/src/main/kotlin/com/pubnub/api/eventengine/Effect.kt index 67844b374..b2c9dfefb 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/Effect.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/Effect.kt @@ -1,5 +1,5 @@ package com.pubnub.api.eventengine -interface Effect { +internal interface Effect { fun runEffect() } diff --git a/src/main/kotlin/com/pubnub/api/eventengine/EffectDispatcher.kt b/src/main/kotlin/com/pubnub/api/eventengine/EffectDispatcher.kt index 6f251364c..c1771f106 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/EffectDispatcher.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/EffectDispatcher.kt @@ -5,7 +5,7 @@ import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ExecutorService import java.util.concurrent.Executors -class EffectDispatcher( +internal class EffectDispatcher( private val effectFactory: EffectFactory, private val effectSource: Source, private val managedEffects: ConcurrentHashMap = ConcurrentHashMap(), diff --git a/src/main/kotlin/com/pubnub/api/eventengine/EffectFactory.kt b/src/main/kotlin/com/pubnub/api/eventengine/EffectFactory.kt index e581316dd..391f06edc 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/EffectFactory.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/EffectFactory.kt @@ -1,5 +1,5 @@ package com.pubnub.api.eventengine -interface EffectFactory { +internal interface EffectFactory { fun create(effectInvocation: T): Effect? } diff --git a/src/main/kotlin/com/pubnub/api/eventengine/EffectInvocation.kt b/src/main/kotlin/com/pubnub/api/eventengine/EffectInvocation.kt index d43ff9623..b25fb0cfd 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/EffectInvocation.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/EffectInvocation.kt @@ -1,14 +1,14 @@ package com.pubnub.api.eventengine -interface EffectInvocation { +internal interface EffectInvocation { val id: String val type: EffectInvocationType } -sealed interface EffectInvocationType +internal sealed interface EffectInvocationType -data class Cancel(val idToCancel: String) : EffectInvocationType +internal data class Cancel(val idToCancel: String) : EffectInvocationType -object Managed : EffectInvocationType +internal object Managed : EffectInvocationType -object NonManaged : EffectInvocationType +internal object NonManaged : EffectInvocationType diff --git a/src/main/kotlin/com/pubnub/api/eventengine/Event.kt b/src/main/kotlin/com/pubnub/api/eventengine/Event.kt index 57e0059b8..aa3ae3750 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/Event.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/Event.kt @@ -1,3 +1,3 @@ package com.pubnub.api.eventengine -interface Event +internal interface Event diff --git a/src/main/kotlin/com/pubnub/api/eventengine/EventEngine.kt b/src/main/kotlin/com/pubnub/api/eventengine/EventEngine.kt index df266918e..2a50b12f7 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/EventEngine.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/EventEngine.kt @@ -3,7 +3,7 @@ package com.pubnub.api.eventengine import java.util.concurrent.ExecutorService import java.util.concurrent.Executors -class EventEngine>( +internal class EventEngine>( private val effectSink: Sink, private val eventSource: Source, private var currentState: S, diff --git a/src/main/kotlin/com/pubnub/api/eventengine/EventEngineConf.kt b/src/main/kotlin/com/pubnub/api/eventengine/EventEngineConf.kt index 6bba39669..3b63c50bf 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/EventEngineConf.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/EventEngineConf.kt @@ -1,13 +1,13 @@ package com.pubnub.api.eventengine -interface EventEngineConf { +internal interface EventEngineConf { val eventSink: Sink val eventSource: Source val effectSink: Sink val effectSource: Source } -class QueueEventEngineConf( +internal class QueueEventEngineConf( effectSinkSource: SinkSource = QueueSinkSource(), eventSinkSource: SinkSource = QueueSinkSource() ) : EventEngineConf { diff --git a/src/main/kotlin/com/pubnub/api/eventengine/EventEngineManager.kt b/src/main/kotlin/com/pubnub/api/eventengine/EventEngineManager.kt index 526e2180c..8db25c949 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/EventEngineManager.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/EventEngineManager.kt @@ -1,6 +1,6 @@ package com.pubnub.api.eventengine -class EventEngineManager, Ee : EventEngine>( +internal class EventEngineManager, Ee : EventEngine>( private val eventEngine: Ee, private val effectDispatcher: EffectDispatcher, private val eventSink: Sink diff --git a/src/main/kotlin/com/pubnub/api/eventengine/ManagedEffect.kt b/src/main/kotlin/com/pubnub/api/eventengine/ManagedEffect.kt index 873298741..9c0429476 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/ManagedEffect.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/ManagedEffect.kt @@ -1,5 +1,5 @@ package com.pubnub.api.eventengine -interface ManagedEffect : Effect { +internal interface ManagedEffect : Effect { fun cancel() } diff --git a/src/main/kotlin/com/pubnub/api/eventengine/QueueSinkSource.kt b/src/main/kotlin/com/pubnub/api/eventengine/QueueSinkSource.kt index 587578cca..671343cd9 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/QueueSinkSource.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/QueueSinkSource.kt @@ -3,9 +3,9 @@ package com.pubnub.api.eventengine import java.util.concurrent.BlockingQueue import java.util.concurrent.LinkedBlockingQueue -interface SinkSource : Sink, Source +internal interface SinkSource : Sink, Source -class QueueSinkSource(private val queue: BlockingQueue = LinkedBlockingQueue()) : SinkSource { +internal class QueueSinkSource(private val queue: BlockingQueue = LinkedBlockingQueue()) : SinkSource { override fun take(): T { return queue.take() } diff --git a/src/main/kotlin/com/pubnub/api/eventengine/Sink.kt b/src/main/kotlin/com/pubnub/api/eventengine/Sink.kt index c1bb20703..ae4239d3c 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/Sink.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/Sink.kt @@ -1,5 +1,5 @@ package com.pubnub.api.eventengine -interface Sink { +internal interface Sink { fun add(item: T) } diff --git a/src/main/kotlin/com/pubnub/api/eventengine/Source.kt b/src/main/kotlin/com/pubnub/api/eventengine/Source.kt index 75ba9dde2..5ef45469a 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/Source.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/Source.kt @@ -1,5 +1,5 @@ package com.pubnub.api.eventengine -interface Source { +internal interface Source { fun take(): T } diff --git a/src/main/kotlin/com/pubnub/api/eventengine/State.kt b/src/main/kotlin/com/pubnub/api/eventengine/State.kt index f0fe74a3e..7f240fdbd 100644 --- a/src/main/kotlin/com/pubnub/api/eventengine/State.kt +++ b/src/main/kotlin/com/pubnub/api/eventengine/State.kt @@ -1,13 +1,13 @@ package com.pubnub.api.eventengine -interface State> { +internal interface State> { open fun onEntry(): Set = setOf() open fun onExit(): Set = setOf() abstract fun transition(event: Ev): Pair> } -fun > S.noTransition(): Pair> = Pair(this, emptySet()) -fun > S.transitionTo( +internal fun > S.noTransition(): Pair> = Pair(this, emptySet()) +internal fun > S.transitionTo( state: S, vararg invocations: Ei ): Pair> { diff --git a/src/main/kotlin/com/pubnub/api/managers/PresenceEventEngineManager.kt b/src/main/kotlin/com/pubnub/api/managers/PresenceEventEngineManager.kt index b0c82b92a..4fd182b84 100644 --- a/src/main/kotlin/com/pubnub/api/managers/PresenceEventEngineManager.kt +++ b/src/main/kotlin/com/pubnub/api/managers/PresenceEventEngineManager.kt @@ -6,4 +6,4 @@ import com.pubnub.api.presence.eventengine.effect.PresenceEffectInvocation import com.pubnub.api.presence.eventengine.event.PresenceEvent import com.pubnub.api.presence.eventengine.state.PresenceState -typealias PresenceEventEngineManager = EventEngineManager +internal typealias PresenceEventEngineManager = EventEngineManager diff --git a/src/main/kotlin/com/pubnub/api/managers/SubscribeEventEngineManager.kt b/src/main/kotlin/com/pubnub/api/managers/SubscribeEventEngineManager.kt index 47c2f3e29..074159abe 100644 --- a/src/main/kotlin/com/pubnub/api/managers/SubscribeEventEngineManager.kt +++ b/src/main/kotlin/com/pubnub/api/managers/SubscribeEventEngineManager.kt @@ -6,4 +6,4 @@ import com.pubnub.api.subscribe.eventengine.effect.SubscribeEffectInvocation import com.pubnub.api.subscribe.eventengine.event.SubscribeEvent import com.pubnub.api.subscribe.eventengine.state.SubscribeState -typealias SubscribeEventEngineManager = EventEngineManager +internal typealias SubscribeEventEngineManager = EventEngineManager diff --git a/src/main/kotlin/com/pubnub/api/presence/Presence.kt b/src/main/kotlin/com/pubnub/api/presence/Presence.kt index ee08536bc..996ad6af4 100644 --- a/src/main/kotlin/com/pubnub/api/presence/Presence.kt +++ b/src/main/kotlin/com/pubnub/api/presence/Presence.kt @@ -13,7 +13,7 @@ import com.pubnub.api.subscribe.eventengine.effect.RetryPolicy import java.time.Duration import java.util.concurrent.Executors -interface Presence { +internal interface Presence { companion object { internal fun create( heartbeatProvider: HeartbeatProvider, diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/PresenceEventEngine.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/PresenceEventEngine.kt index 80623da02..d3b72a78c 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/PresenceEventEngine.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/PresenceEventEngine.kt @@ -7,9 +7,9 @@ import com.pubnub.api.presence.eventengine.effect.PresenceEffectInvocation import com.pubnub.api.presence.eventengine.event.PresenceEvent import com.pubnub.api.presence.eventengine.state.PresenceState -typealias PresenceEventEngine = EventEngine +internal typealias PresenceEventEngine = EventEngine -fun PresenceEventEngine( +internal fun PresenceEventEngine( effectSink: Sink, eventSource: Source, currentState: PresenceState = PresenceState.HeartbeatInactive, diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/HeartbeatEffect.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/HeartbeatEffect.kt index 80e89344c..6d2344e80 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/HeartbeatEffect.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/HeartbeatEffect.kt @@ -7,7 +7,7 @@ import com.pubnub.api.eventengine.Sink import com.pubnub.api.presence.eventengine.event.PresenceEvent import org.slf4j.LoggerFactory -class HeartbeatEffect( +internal class HeartbeatEffect( private val heartbeatRemoteAction: RemoteAction, private val presenceEventSink: Sink ) : Effect { diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/LeaveEffect.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/LeaveEffect.kt index 878113250..22aec4303 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/LeaveEffect.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/LeaveEffect.kt @@ -4,7 +4,7 @@ import com.pubnub.api.endpoints.remoteaction.RemoteAction import com.pubnub.api.eventengine.Effect import org.slf4j.LoggerFactory -class LeaveEffect( +internal class LeaveEffect( private val leaveRemoteAction: RemoteAction ) : Effect { private val log = LoggerFactory.getLogger(LeaveEffect::class.java) diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/PresenceEffectInvocation.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/PresenceEffectInvocation.kt index c6e0f2f52..4762c1c52 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/PresenceEffectInvocation.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/PresenceEffectInvocation.kt @@ -7,7 +7,7 @@ import com.pubnub.api.eventengine.EffectInvocationType import com.pubnub.api.eventengine.Managed import com.pubnub.api.eventengine.NonManaged -sealed class PresenceEffectInvocation(override val type: EffectInvocationType) : EffectInvocation { +internal sealed class PresenceEffectInvocation(override val type: EffectInvocationType) : EffectInvocation { override val id: String = "any value for NonManged and Cancel effect" data class Heartbeat( diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/WaitEffect.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/WaitEffect.kt index 018a5bbb7..5d8cf8947 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/WaitEffect.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/WaitEffect.kt @@ -9,9 +9,9 @@ import java.util.concurrent.Executors import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.ScheduledFuture -class WaitEffect( // todo handle pubnub.configuration.heartbeatInterval <= 0 - private val heartbeatInterval: Duration, // todo if the interval is 0 or less, do not start the timer - private val presenceEventSink: Sink, // todo this should be check at PresenceEventEngineCreation +internal class WaitEffect( + private val heartbeatInterval: Duration, + private val presenceEventSink: Sink, private val executorService: ScheduledExecutorService = Executors.newSingleThreadScheduledExecutor() ) : ManagedEffect { diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/effectprovider/HeartbeatProvider.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/effectprovider/HeartbeatProvider.kt index 27a38392b..68e0b8490 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/effectprovider/HeartbeatProvider.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/effectprovider/HeartbeatProvider.kt @@ -2,6 +2,6 @@ package com.pubnub.api.presence.eventengine.effect.effectprovider import com.pubnub.api.endpoints.remoteaction.RemoteAction -fun interface HeartbeatProvider { +internal fun interface HeartbeatProvider { fun getHeartbeatRemoteAction(channels: Set, channelGroups: Set): RemoteAction } diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/effectprovider/LeaveProvider.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/effectprovider/LeaveProvider.kt index e294c7909..687a057a4 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/effectprovider/LeaveProvider.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/effect/effectprovider/LeaveProvider.kt @@ -2,6 +2,6 @@ package com.pubnub.api.presence.eventengine.effect.effectprovider import com.pubnub.api.endpoints.remoteaction.RemoteAction -fun interface LeaveProvider { +internal fun interface LeaveProvider { fun getLeaveRemoteAction(channels: Set, channelGroups: Set): RemoteAction } diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/event/PresenceEvent.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/event/PresenceEvent.kt index cf24ba2bc..e755cf674 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/event/PresenceEvent.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/event/PresenceEvent.kt @@ -3,7 +3,7 @@ package com.pubnub.api.presence.eventengine.event import com.pubnub.api.PubNubException import com.pubnub.api.eventengine.Event -sealed class PresenceEvent : Event { +internal sealed class PresenceEvent : Event { data class Joined(val channels: Set, val channelGroups: Set) : PresenceEvent() data class Left(val channels: Set, val channelGroups: Set) : PresenceEvent() diff --git a/src/main/kotlin/com/pubnub/api/presence/eventengine/state/PresenceState.kt b/src/main/kotlin/com/pubnub/api/presence/eventengine/state/PresenceState.kt index 691ce1f81..e4a92b1f1 100644 --- a/src/main/kotlin/com/pubnub/api/presence/eventengine/state/PresenceState.kt +++ b/src/main/kotlin/com/pubnub/api/presence/eventengine/state/PresenceState.kt @@ -7,7 +7,7 @@ import com.pubnub.api.eventengine.transitionTo import com.pubnub.api.presence.eventengine.effect.PresenceEffectInvocation import com.pubnub.api.presence.eventengine.event.PresenceEvent -sealed class PresenceState : State { +internal sealed class PresenceState : State { object HeartbeatInactive : PresenceState() { override fun transition(event: PresenceEvent): Pair> { return when (event) { diff --git a/src/main/kotlin/com/pubnub/api/subscribe/Subscribe.kt b/src/main/kotlin/com/pubnub/api/subscribe/Subscribe.kt index 51ee6fb38..a96970bb5 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/Subscribe.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/Subscribe.kt @@ -22,7 +22,7 @@ import java.util.concurrent.Executors private const val PRESENCE_CHANNEL_SUFFIX = "-pnpres" -class Subscribe( +internal class Subscribe( private val subscribeEventEngineManager: SubscribeEventEngineManager, private val subscriptionData: SubscriptionData = SubscriptionData() ) { diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/SubscribeEventEngine.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/SubscribeEventEngine.kt index 3f465cb90..d2fff90a7 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/SubscribeEventEngine.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/SubscribeEventEngine.kt @@ -7,9 +7,9 @@ import com.pubnub.api.subscribe.eventengine.effect.SubscribeEffectInvocation import com.pubnub.api.subscribe.eventengine.event.SubscribeEvent import com.pubnub.api.subscribe.eventengine.state.SubscribeState -typealias SubscribeEventEngine = EventEngine +internal typealias SubscribeEventEngine = EventEngine -fun SubscribeEventEngine( +internal fun SubscribeEventEngine( effectSink: Sink, eventSource: Source, currentState: SubscribeState = SubscribeState.Unsubscribed diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/configuration/EventEnginesConf.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/configuration/EventEnginesConf.kt index 8fd167b1c..b1d319b7c 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/configuration/EventEnginesConf.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/configuration/EventEnginesConf.kt @@ -7,7 +7,7 @@ import com.pubnub.api.presence.eventengine.event.PresenceEvent import com.pubnub.api.subscribe.eventengine.effect.SubscribeEffectInvocation import com.pubnub.api.subscribe.eventengine.event.SubscribeEvent -class EventEnginesConf( +internal class EventEnginesConf( val subscribe: EventEngineConf = QueueEventEngineConf(), val presence: EventEngineConf = QueueEventEngineConf() ) diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/data/SubscriptionData.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/data/SubscriptionData.kt index e31a196e5..440f0bc40 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/data/SubscriptionData.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/data/SubscriptionData.kt @@ -1,6 +1,6 @@ package com.pubnub.api.subscribe.eventengine.data -class SubscriptionData { +internal class SubscriptionData { internal val channels: MutableSet = mutableSetOf() internal val channelGroups: MutableSet = mutableSetOf() } diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/EmitMessagesEffect.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/EmitMessagesEffect.kt index 1c654a359..ee149ce45 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/EmitMessagesEffect.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/EmitMessagesEffect.kt @@ -10,7 +10,7 @@ import com.pubnub.api.models.consumer.pubsub.message_actions.PNMessageActionResu import com.pubnub.api.models.consumer.pubsub.objects.PNObjectEventResult import org.slf4j.LoggerFactory -class EmitMessagesEffect( +internal class EmitMessagesEffect( private val messagesConsumer: MessagesConsumer, private val messages: List ) : Effect { diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/EmitStatusEffect.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/EmitStatusEffect.kt index 4f19a3426..ecf67e5a2 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/EmitStatusEffect.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/EmitStatusEffect.kt @@ -4,7 +4,7 @@ import com.pubnub.api.eventengine.Effect import com.pubnub.api.models.consumer.PNStatus import org.slf4j.LoggerFactory -class EmitStatusEffect( +internal class EmitStatusEffect( private val statusConsumer: StatusConsumer, private val status: PNStatus ) : Effect { diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/HandshakeEffect.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/HandshakeEffect.kt index db5f40aa1..1d06d3ecb 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/HandshakeEffect.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/HandshakeEffect.kt @@ -8,7 +8,7 @@ import com.pubnub.api.subscribe.eventengine.event.SubscribeEvent import com.pubnub.api.subscribe.eventengine.event.SubscriptionCursor import org.slf4j.LoggerFactory -class HandshakeEffect( +internal class HandshakeEffect( private val handshakeRemoteAction: RemoteAction, private val subscribeEventSink: Sink, ) : ManagedEffect { diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/HandshakeReconnectEffect.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/HandshakeReconnectEffect.kt index 6c8fca38d..0b84cce29 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/HandshakeReconnectEffect.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/HandshakeReconnectEffect.kt @@ -11,7 +11,7 @@ import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.ScheduledFuture import java.util.concurrent.TimeUnit -class HandshakeReconnectEffect( +internal class HandshakeReconnectEffect( private val handshakeRemoteAction: RemoteAction, private val subscribeEventSink: Sink, private val policy: RetryPolicy, diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/MessagesConsumer.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/MessagesConsumer.kt index 0c8bb3353..8cbf27cee 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/MessagesConsumer.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/MessagesConsumer.kt @@ -7,7 +7,7 @@ import com.pubnub.api.models.consumer.pubsub.files.PNFileEventResult import com.pubnub.api.models.consumer.pubsub.message_actions.PNMessageActionResult import com.pubnub.api.models.consumer.pubsub.objects.PNObjectEventResult -interface MessagesConsumer { +internal interface MessagesConsumer { fun announce(message: PNMessageResult) fun announce(presence: PNPresenceEventResult) diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReceiveMessagesEffect.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReceiveMessagesEffect.kt index 6ad4538b1..545fdbeb5 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReceiveMessagesEffect.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReceiveMessagesEffect.kt @@ -7,7 +7,7 @@ import com.pubnub.api.eventengine.Sink import com.pubnub.api.subscribe.eventengine.event.SubscribeEvent import org.slf4j.LoggerFactory -class ReceiveMessagesEffect( +internal class ReceiveMessagesEffect( private val receiveMessagesRemoteAction: RemoteAction, private val subscribeEventSink: Sink, ) : ManagedEffect { @@ -21,7 +21,7 @@ class ReceiveMessagesEffect( subscribeEventSink.add( SubscribeEvent.ReceiveFailure( status.exception - ?: PubNubException("Unknown error") // todo check it that can happen + ?: PubNubException("Unknown error") ) ) } else { diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReceiveReconnectEffect.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReceiveReconnectEffect.kt index 8842279e5..76a2afa3b 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReceiveReconnectEffect.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReceiveReconnectEffect.kt @@ -10,7 +10,7 @@ import java.util.concurrent.ScheduledExecutorService import java.util.concurrent.ScheduledFuture import java.util.concurrent.TimeUnit -class ReceiveReconnectEffect( +internal class ReceiveReconnectEffect( private val receiveMessagesRemoteAction: RemoteAction, private val subscribeEventSink: Sink, private val policy: RetryPolicy, diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReconnectionPolicy.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReconnectionPolicy.kt index 5e669d92a..f280479e2 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReconnectionPolicy.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/ReconnectionPolicy.kt @@ -3,7 +3,7 @@ package com.pubnub.api.subscribe.eventengine.effect import java.time.Duration import kotlin.math.pow -abstract class RetryPolicy { +internal abstract class RetryPolicy { protected abstract val maxRetries: Int protected abstract fun computeDelay(count: Int): Duration fun nextDelay(attempt: Int): Duration? { @@ -14,18 +14,18 @@ abstract class RetryPolicy { } } -object NoRetriesPolicy : RetryPolicy() { +internal object NoRetriesPolicy : RetryPolicy() { override val maxRetries: Int = 0 override fun computeDelay(count: Int): Duration = Duration.ZERO } -class LinearPolicy( +internal class LinearPolicy( override val maxRetries: Int = 5, // LinearPolicy is created in PNConfiguration default maxRetries is -1 which is unlimited private val fixedDelay: Duration = Duration.ofSeconds(3) ) : RetryPolicy() { override fun computeDelay(count: Int): Duration = fixedDelay } -class ExponentialPolicy(override val maxRetries: Int = 5) : RetryPolicy() { // LinearPolicy is created in PNConfiguration default maxRetries is -1 which is unlimited +internal class ExponentialPolicy(override val maxRetries: Int = 5) : RetryPolicy() { // LinearPolicy is created in PNConfiguration default maxRetries is -1 which is unlimited override fun computeDelay(count: Int): Duration = Duration.ofSeconds((2.0.pow(count - 1)).toLong()) } diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/StatusConsumer.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/StatusConsumer.kt index a171ac47d..ae0a2fe53 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/StatusConsumer.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/StatusConsumer.kt @@ -2,6 +2,6 @@ package com.pubnub.api.subscribe.eventengine.effect import com.pubnub.api.models.consumer.PNStatus -interface StatusConsumer { +internal interface StatusConsumer { fun announce(status: PNStatus) } diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/SubscribeEffectFactory.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/SubscribeEffectFactory.kt index d8570e344..c2286f02f 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/SubscribeEffectFactory.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/SubscribeEffectFactory.kt @@ -12,7 +12,7 @@ import com.pubnub.api.subscribe.eventengine.event.SubscriptionCursor import java.util.concurrent.Executors import java.util.concurrent.ScheduledExecutorService -data class ReceiveMessagesResult( +internal data class ReceiveMessagesResult( val messages: List, val subscriptionCursor: SubscriptionCursor ) diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/SubscribeEffectInvocation.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/SubscribeEffectInvocation.kt index eec15ed17..4323e67e7 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/SubscribeEffectInvocation.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/SubscribeEffectInvocation.kt @@ -10,7 +10,7 @@ import com.pubnub.api.models.consumer.PNStatus import com.pubnub.api.models.consumer.pubsub.PNEvent import com.pubnub.api.subscribe.eventengine.event.SubscriptionCursor -sealed class SubscribeEffectInvocation(override val type: EffectInvocationType) : EffectInvocation { +internal sealed class SubscribeEffectInvocation(override val type: EffectInvocationType) : EffectInvocation { override val id: String = "any value for NonManged and Cancel effect" diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/effectprovider/HandshakeProvider.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/effectprovider/HandshakeProvider.kt index b96d4b41e..98bce48d7 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/effectprovider/HandshakeProvider.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/effectprovider/HandshakeProvider.kt @@ -3,6 +3,6 @@ package com.pubnub.api.subscribe.eventengine.effect.effectprovider import com.pubnub.api.endpoints.remoteaction.RemoteAction import com.pubnub.api.subscribe.eventengine.event.SubscriptionCursor -fun interface HandshakeProvider { +internal fun interface HandshakeProvider { fun getHandshakeRemoteAction(channels: Set, channelGroups: Set): RemoteAction } diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/effectprovider/ReceiveMessagesProvider.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/effectprovider/ReceiveMessagesProvider.kt index 4c38e3679..037241559 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/effectprovider/ReceiveMessagesProvider.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/effect/effectprovider/ReceiveMessagesProvider.kt @@ -4,7 +4,7 @@ import com.pubnub.api.endpoints.remoteaction.RemoteAction import com.pubnub.api.subscribe.eventengine.effect.ReceiveMessagesResult import com.pubnub.api.subscribe.eventengine.event.SubscriptionCursor -fun interface ReceiveMessagesProvider { +internal fun interface ReceiveMessagesProvider { fun getReceiveMessagesRemoteAction( channels: Set, channelGroups: Set, diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/event/SubscribeEvent.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/event/SubscribeEvent.kt index a3fe97fa1..30dcb98f8 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/event/SubscribeEvent.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/event/SubscribeEvent.kt @@ -4,7 +4,7 @@ import com.pubnub.api.PubNubException import com.pubnub.api.eventengine.Event import com.pubnub.api.models.consumer.pubsub.PNEvent -sealed class SubscribeEvent : Event { +internal sealed class SubscribeEvent : Event { data class SubscriptionChanged(val channels: Set, val channelGroups: Set) : SubscribeEvent() data class SubscriptionRestored( val channels: Set, diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/event/SubscriptionCursor.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/event/SubscriptionCursor.kt index 9a0c9294d..cf3d5bd95 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/event/SubscriptionCursor.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/event/SubscriptionCursor.kt @@ -1,3 +1,3 @@ package com.pubnub.api.subscribe.eventengine.event -data class SubscriptionCursor(val timetoken: Long, val region: String?) +internal data class SubscriptionCursor(val timetoken: Long, val region: String?) diff --git a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/state/SubscribeState.kt b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/state/SubscribeState.kt index 897bd382e..c455204a0 100644 --- a/src/main/kotlin/com/pubnub/api/subscribe/eventengine/state/SubscribeState.kt +++ b/src/main/kotlin/com/pubnub/api/subscribe/eventengine/state/SubscribeState.kt @@ -11,7 +11,7 @@ import com.pubnub.api.subscribe.eventengine.effect.SubscribeEffectInvocation import com.pubnub.api.subscribe.eventengine.event.SubscribeEvent import com.pubnub.api.subscribe.eventengine.event.SubscriptionCursor -sealed class SubscribeState : State { +internal sealed class SubscribeState : State { object Unsubscribed : SubscribeState() { override fun transition(event: SubscribeEvent): Pair> { return when (event) { diff --git a/src/test/kotlin/com/pubnub/api/eventengine/EffectDispatcherTest.kt b/src/test/kotlin/com/pubnub/api/eventengine/EffectDispatcherTest.kt index b7857bc93..6c40e3c99 100644 --- a/src/test/kotlin/com/pubnub/api/eventengine/EffectDispatcherTest.kt +++ b/src/test/kotlin/com/pubnub/api/eventengine/EffectDispatcherTest.kt @@ -13,19 +13,19 @@ import java.util.concurrent.ConcurrentHashMap class EffectDispatcherTest { - sealed class TestEffectInvocation(override val type: EffectInvocationType) : EffectInvocation { + internal sealed class TestEffectInvocation(override val type: EffectInvocationType) : EffectInvocation { override val id: String = this::class.java.simpleName } - object TestEffect : + internal object TestEffect : TestEffectInvocation(Managed) - object ImmediateEndingTestEffect : + internal object ImmediateEndingTestEffect : TestEffectInvocation(Managed) - object CancelTestEffect : TestEffectInvocation(Cancel(TestEffect::class.java.simpleName)) + internal object CancelTestEffect : TestEffectInvocation(Cancel(TestEffect::class.java.simpleName)) - class EffectHandlerFactoryImpl : EffectFactory { + internal class EffectHandlerFactoryImpl : EffectFactory { override fun create(effectInvocation: TestEffectInvocation): ManagedEffect { return object : ManagedEffect { diff --git a/src/test/kotlin/com/pubnub/api/eventengine/EventEngineTest.kt b/src/test/kotlin/com/pubnub/api/eventengine/EventEngineTest.kt index 112b4b36e..94c07ddf6 100644 --- a/src/test/kotlin/com/pubnub/api/eventengine/EventEngineTest.kt +++ b/src/test/kotlin/com/pubnub/api/eventengine/EventEngineTest.kt @@ -6,12 +6,12 @@ import org.junit.jupiter.api.Test class EventEngineTest { - object TestEffectInvocation : EffectInvocation { + internal object TestEffectInvocation : EffectInvocation { override val id: String = "id" override val type: EffectInvocationType = NonManaged } - object TestState : State { + internal object TestState : State { override fun transition(event: Event): Pair> { return transitionTo(TestState, TestEffectInvocation) } diff --git a/src/test/kotlin/com/pubnub/api/presence/PresenceTest.kt b/src/test/kotlin/com/pubnub/api/presence/PresenceTest.kt index a65878113..0c080e4ae 100644 --- a/src/test/kotlin/com/pubnub/api/presence/PresenceTest.kt +++ b/src/test/kotlin/com/pubnub/api/presence/PresenceTest.kt @@ -17,7 +17,7 @@ import org.junit.jupiter.params.provider.Arguments.arguments import org.junit.jupiter.params.provider.MethodSource import java.time.Duration -class PresenceTest { +internal class PresenceTest { companion object { @JvmStatic diff --git a/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromHandshakeFailedStateTest.kt b/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromHandshakeFailedStateTest.kt index b0ce3e8fd..8bd7afb9d 100644 --- a/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromHandshakeFailedStateTest.kt +++ b/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromHandshakeFailedStateTest.kt @@ -9,7 +9,7 @@ import com.pubnub.api.subscribe.eventengine.state.SubscribeState import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -class TransitionFromHandshakeFailedStateTest { +internal class TransitionFromHandshakeFailedStateTest { val channels = setOf("Channel1") val channelGroups = setOf("ChannelGroup1") val exception = PubNubException("Test") diff --git a/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromReceiveFailedStateTest.kt b/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromReceiveFailedStateTest.kt index fb8951365..f75bd78b3 100644 --- a/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromReceiveFailedStateTest.kt +++ b/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromReceiveFailedStateTest.kt @@ -9,7 +9,7 @@ import com.pubnub.api.subscribe.eventengine.state.SubscribeState import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -class TransitionFromReceiveFailedStateTest { +internal class TransitionFromReceiveFailedStateTest { val channels = setOf("Channel1") val channelGroups = setOf("ChannelGroup1") val exception = PubNubException("Test") diff --git a/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromReceivingReconnectingStateTest.kt b/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromReceivingReconnectingStateTest.kt index 00f78870e..2b843b242 100644 --- a/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromReceivingReconnectingStateTest.kt +++ b/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromReceivingReconnectingStateTest.kt @@ -17,7 +17,7 @@ import com.pubnub.api.subscribe.eventengine.state.SubscribeState import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -class TransitionFromReceivingReconnectingStateTest { +internal class TransitionFromReceivingReconnectingStateTest { val channels = setOf("Channel1") val channelGroups = setOf("ChannelGroup1") val reason = PubNubException(PubNubError.PARSING_ERROR) diff --git a/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromUnsubscribedStateTest.kt b/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromUnsubscribedStateTest.kt index 2886cf331..d694160f5 100644 --- a/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromUnsubscribedStateTest.kt +++ b/src/test/kotlin/com/pubnub/api/subscribe/eventengine/worker/TransitionFromUnsubscribedStateTest.kt @@ -8,7 +8,7 @@ import com.pubnub.api.subscribe.eventengine.state.SubscribeState import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -class TransitionFromUnsubscribedStateTest { +internal class TransitionFromUnsubscribedStateTest { val channels = setOf("Channel1") val channelGroups = setOf("ChannelGroup1") val timeToken = 12345345452L diff --git a/src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/state/EventEngineState.kt b/src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/state/EventEngineState.kt index 7c15df621..cc142684c 100644 --- a/src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/state/EventEngineState.kt +++ b/src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/state/EventEngineState.kt @@ -9,7 +9,7 @@ import com.pubnub.contract.state.World import com.pubnub.contract.state.WorldState import java.util.concurrent.CopyOnWriteArrayList -fun testEventEnginesConf( +internal fun testEventEnginesConf( subscribeQueuedElements: MutableList>, presenceQueuedElements: MutableList>, diff --git a/src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/state/TestSinkSource.kt b/src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/state/TestSinkSource.kt index a48b3a4f6..7b1d0fc37 100644 --- a/src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/state/TestSinkSource.kt +++ b/src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/state/TestSinkSource.kt @@ -7,7 +7,7 @@ import com.pubnub.api.eventengine.QueueSinkSource import com.pubnub.api.eventengine.SinkSource import com.pubnub.api.eventengine.Source -class TestSinkSource( +internal class TestSinkSource( private val testSink: MutableList>, private val sinkSource: QueueSinkSource = QueueSinkSource() ) : SinkSource, Source by sinkSource {