Skip to content

Commit f116f8f

Browse files
committed
Deprecate old transport API for removal in next release
1 parent 2c32d25 commit f116f8f

File tree

27 files changed

+67
-45
lines changed

27 files changed

+67
-45
lines changed

build-logic/src/main/kotlin/rsocketbuild.multiplatform-base.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ kotlin {
4545
optIn(OptIns.DelicateCoroutinesApi)
4646

4747
// rsocket related
48-
optIn(OptIns.TransportApi)
4948
optIn(OptIns.RSocketTransportApi)
5049
optIn(OptIns.ExperimentalMetadataApi)
5150
optIn(OptIns.ExperimentalStreamsApi)

build-logic/src/main/kotlin/rsocketbuild/OptIns.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ object OptIns {
2222
const val ExperimentalCoroutinesApi = "kotlinx.coroutines.ExperimentalCoroutinesApi"
2323
const val DelicateCoroutinesApi = "kotlinx.coroutines.DelicateCoroutinesApi"
2424

25-
const val TransportApi = "io.rsocket.kotlin.TransportApi"
2625
const val RSocketTransportApi = "io.rsocket.kotlin.transport.RSocketTransportApi"
2726
const val ExperimentalMetadataApi = "io.rsocket.kotlin.ExperimentalMetadataApi"
2827
const val ExperimentalStreamsApi = "io.rsocket.kotlin.ExperimentalStreamsApi"

rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/Annotations.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ package io.rsocket.kotlin
2121
level = RequiresOptIn.Level.WARNING,
2222
message = "This is an API which is used to implement transport for RSocket, such as WS or TCP. This API can change in future in non backwards-compatible manner."
2323
)
24+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated in favor of new Transport API")
2425
public annotation class TransportApi
2526

2627
@Retention(value = AnnotationRetention.BINARY)

rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/Connection.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ package io.rsocket.kotlin
1919
import io.ktor.utils.io.core.*
2020
import kotlinx.coroutines.*
2121

22-
/**
23-
* That interface isn't stable for inheritance.
24-
*/
25-
@TransportApi
22+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated in favor of new Transport API")
2623
public interface Connection : CoroutineScope {
2724
public suspend fun send(packet: ByteReadPacket)
2825
public suspend fun receive(): ByteReadPacket

rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/connection/OldConnection.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import io.rsocket.kotlin.transport.internal.*
2424
import kotlinx.coroutines.*
2525
import kotlinx.coroutines.channels.*
2626

27-
@TransportApi
27+
@Suppress("DEPRECATION_ERROR")
2828
@RSocketTransportApi
2929
internal suspend fun RSocketConnectionHandler.handleConnection(connection: Connection): Unit = coroutineScope {
3030
val outboundQueue = PrioritizationFrameQueue(Channel.BUFFERED)
@@ -43,7 +43,7 @@ internal suspend fun RSocketConnectionHandler.handleConnection(connection: Conne
4343
}
4444
}
4545

46-
@TransportApi
46+
@Suppress("DEPRECATION_ERROR")
4747
@RSocketTransportApi
4848
private class OldConnection(
4949
private val outboundQueue: PrioritizationFrameQueue,

rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/core/InterceptorsBuilder.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2022 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,12 +13,12 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
@file:OptIn(TransportApi::class)
1716

1817
package io.rsocket.kotlin.core
1918

2019
import io.rsocket.kotlin.*
2120

21+
@Suppress("DEPRECATION_ERROR")
2222
public class InterceptorsBuilder internal constructor() {
2323
private val requesters = mutableListOf<Interceptor<RSocket>>()
2424
private val responders = mutableListOf<Interceptor<RSocket>>()
@@ -33,7 +33,7 @@ public class InterceptorsBuilder internal constructor() {
3333
responders += interceptor
3434
}
3535

36-
@TransportApi
36+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated without replacement")
3737
public fun forConnection(interceptor: Interceptor<Connection>) {
3838
connections += interceptor
3939
}
@@ -45,6 +45,7 @@ public class InterceptorsBuilder internal constructor() {
4545
internal fun build(): Interceptors = Interceptors(requesters, responders, connections, acceptors)
4646
}
4747

48+
@Suppress("DEPRECATION_ERROR")
4849
internal class Interceptors(
4950
private val requesters: List<Interceptor<RSocket>>,
5051
private val responders: List<Interceptor<RSocket>>,

rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/core/RSocketConnector.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import io.rsocket.kotlin.transport.*
2626
import kotlinx.coroutines.*
2727
import kotlin.coroutines.*
2828

29-
@OptIn(TransportApi::class, RSocketTransportApi::class, RSocketLoggingApi::class)
29+
@OptIn(RSocketTransportApi::class, RSocketLoggingApi::class)
3030
public class RSocketConnector internal constructor(
3131
loggerFactory: LoggerFactory,
3232
private val maxFragmentSize: Int,
@@ -39,6 +39,8 @@ public class RSocketConnector internal constructor(
3939
private val connectionLogger = loggerFactory.logger("io.rsocket.kotlin.connection")
4040
private val frameLogger = loggerFactory.logger("io.rsocket.kotlin.frame")
4141

42+
@Suppress("DEPRECATION_ERROR")
43+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated in favor of new Transport API")
4244
public suspend fun connect(transport: ClientTransport): RSocket = connect(object : RSocketClientTarget {
4345
override val coroutineContext: CoroutineContext get() = transport.coroutineContext
4446
override fun connectClient(handler: RSocketConnectionHandler): Job = launch {

rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/core/RSocketServer.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import io.rsocket.kotlin.logging.*
2525
import io.rsocket.kotlin.transport.*
2626
import kotlinx.coroutines.*
2727

28-
@OptIn(TransportApi::class, RSocketTransportApi::class, RSocketLoggingApi::class)
28+
@OptIn(RSocketTransportApi::class, RSocketLoggingApi::class)
2929
public class RSocketServer internal constructor(
3030
loggerFactory: LoggerFactory,
3131
private val maxFragmentSize: Int,
@@ -34,12 +34,16 @@ public class RSocketServer internal constructor(
3434
) {
3535
private val frameLogger = loggerFactory.logger("io.rsocket.kotlin.frame")
3636

37+
@Suppress("DEPRECATION_ERROR")
38+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated in favor of new Transport API")
3739
@DelicateCoroutinesApi
3840
public fun <T> bind(
3941
transport: ServerTransport<T>,
4042
acceptor: ConnectionAcceptor,
4143
): T = bindIn(GlobalScope, transport, acceptor)
4244

45+
@Suppress("DEPRECATION_ERROR")
46+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated in favor of new Transport API")
4347
public fun <T> bindIn(
4448
scope: CoroutineScope,
4549
transport: ServerTransport<T>,

rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/transport/ClientTransport.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2022 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,18 +20,17 @@ import io.rsocket.kotlin.*
2020
import kotlinx.coroutines.*
2121
import kotlin.coroutines.*
2222

23+
@Suppress("DEPRECATION_ERROR")
24+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated in favor of new Transport API")
2325
public fun interface ClientTransport : CoroutineScope {
2426
override val coroutineContext: CoroutineContext get() = EmptyCoroutineContext
25-
26-
@TransportApi
2727
public suspend fun connect(): Connection
2828
}
2929

30-
@TransportApi
30+
@Suppress("DEPRECATION_ERROR")
31+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated in favor of new Transport API")
3132
public fun ClientTransport(coroutineContext: CoroutineContext, transport: ClientTransport): ClientTransport =
3233
object : ClientTransport {
3334
override val coroutineContext: CoroutineContext get() = coroutineContext
34-
35-
@TransportApi
3635
override suspend fun connect(): Connection = transport.connect()
3736
}

rsocket-core/src/commonMain/kotlin/io/rsocket/kotlin/transport/ServerTransport.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2022 the original author or authors.
2+
* Copyright 2015-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,8 @@ package io.rsocket.kotlin.transport
1919
import io.rsocket.kotlin.*
2020
import kotlinx.coroutines.*
2121

22+
@Suppress("DEPRECATION_ERROR")
23+
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated in favor of new Transport API")
2224
public fun interface ServerTransport<T> {
23-
@TransportApi
2425
public fun CoroutineScope.start(accept: suspend CoroutineScope.(Connection) -> Unit): T
2526
}

0 commit comments

Comments
 (0)