migrations onto new libraries

This commit is contained in:
InsanusMokrassar 2024-07-30 23:25:54 +06:00
parent 0d776e602e
commit 647cd7d7b4
21 changed files with 93 additions and 83 deletions

View File

@ -1,19 +1,19 @@
[versions]
kt = "2.0.0"
kt = "2.0.20-RC"
kt-serialization = "1.7.1"
kt-coroutines = "1.8.1"
kslog = "1.3.4"
jb-compose = "1.7.0-dev1742"
jb-compose = "1.7.0-dev1750"
jb-exposed = "0.51.1"
jb-dokka = "1.9.20"
korlibs = "5.4.0"
uuid = "0.8.4"
ktor = "2.3.11"
ktor = "3.0.0-beta-2"
gh-release = "2.5.2"

View File

@ -1,3 +1,3 @@
package dev.inmo.micro_utils.ktor.client
typealias OnUploadCallback = suspend (uploaded: Long, count: Long) -> Unit
typealias OnUploadCallback = suspend (uploaded: Long, count: Long?) -> Unit

View File

@ -1,10 +1,8 @@
package dev.inmo.micro_utils.ktor.common
import io.ktor.utils.io.core.Input
import io.ktor.utils.io.core.copyTo
import io.ktor.utils.io.streams.asOutput
import kotlinx.io.asSink
import java.io.File
import java.io.InputStream
import java.util.UUID
fun Input.downloadToTempFile(
@ -17,7 +15,7 @@ fun Input.downloadToTempFile(
folder
).apply {
outputStream().use {
copyTo(it.asOutput())
this@downloadToTempFile.transferTo(it.asSink())
}
deleteOnExit()
}

View File

@ -1,8 +1,9 @@
package dev.inmo.micro_utils.ktor.server
import io.ktor.server.application.ApplicationCall
import io.ktor.server.http.*
import io.ktor.server.response.responseType
import io.ktor.util.InternalAPI
import io.ktor.utils.io.InternalAPI
import io.ktor.util.reflect.TypeInfo
@InternalAPI
@ -11,5 +12,5 @@ suspend fun <T : Any> ApplicationCall.respond(
typeInfo: TypeInfo
) {
response.responseType = typeInfo
response.pipeline.execute(this, message as Any)
respond(message, typeInfo)
}

View File

@ -2,21 +2,19 @@ package dev.inmo.micro_utils.ktor.server
import com.benasher44.uuid.uuid4
import io.ktor.http.content.PartData
import io.ktor.utils.io.copyTo
import io.ktor.utils.io.core.copyTo
import io.ktor.util.cio.*
import io.ktor.utils.io.*
import io.ktor.utils.io.jvm.javaio.copyTo
import io.ktor.utils.io.streams.asOutput
import kotlinx.io.asSink
import java.io.File
fun PartData.FileItem.download(target: File) {
provider().use { input ->
target.outputStream().asOutput().use {
input.copyTo(it)
}
}
suspend fun PartData.FileItem.download(target: File) {
provider().copyAndClose(
target.writeChannel()
)
}
fun PartData.FileItem.downloadToTemporalFile(): File {
suspend fun PartData.FileItem.downloadToTemporalFile(): File {
val outputFile = File.createTempFile(uuid4().toString(), ".temp").apply {
deleteOnExit()
}
@ -27,7 +25,7 @@ fun PartData.FileItem.downloadToTemporalFile(): File {
fun PartData.BinaryItem.download(target: File) {
provider().use { input ->
target.outputStream().use {
input.copyTo(it.asOutput())
input.transferTo(it.asSink())
}
}
}

View File

@ -5,14 +5,14 @@ import dev.inmo.micro_utils.ktor.common.*
import io.ktor.http.URLProtocol
import io.ktor.server.application.install
import io.ktor.server.application.pluginOrNull
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.application
import io.ktor.server.websocket.*
import io.ktor.websocket.send
import kotlinx.coroutines.flow.Flow
import kotlinx.serialization.SerializationStrategy
inline fun <reified T : Any> Route.includeWebsocketHandling(
inline fun <reified T : Any> Routing.includeWebsocketHandling(
suburl: String,
flow: Flow<T>,
protocol: URLProtocol? = null,

View File

@ -1,7 +1,7 @@
package dev.inmo.micro_utils.ktor.server
import dev.inmo.micro_utils.ktor.server.configurators.KtorApplicationConfigurator
import io.ktor.server.application.Application
import io.ktor.server.application.*
import io.ktor.server.cio.CIO
import io.ktor.server.cio.CIOApplicationEngine
import io.ktor.server.engine.*
@ -11,20 +11,22 @@ fun <TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configurati
engine: ApplicationEngineFactory<TEngine, TConfiguration>,
host: String = "localhost",
port: Int = Random.nextInt(1024, 65535),
additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {},
additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {},
additionalConfigurationConfigurator: TConfiguration.() -> Unit = {},
environment: ApplicationEnvironment = applicationEnvironment(),
block: Application.() -> Unit
): TEngine = embeddedServer(
): EmbeddedServer<TEngine, TConfiguration> = embeddedServer<TEngine, TConfiguration>(
engine,
applicationEngineEnvironment {
module(block)
environment,
{
connector {
this.host = host
this.port = port
}
additionalEngineEnvironmentConfigurator()
}
additionalConfigurationConfigurator()
},
additionalConfigurationConfigurator
module = block
)
/**
@ -35,15 +37,17 @@ fun <TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configurati
fun createKtorServer(
host: String = "localhost",
port: Int = Random.nextInt(1024, 65535),
additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {},
additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {},
additionalConfigurationConfigurator: CIOApplicationEngine.Configuration.() -> Unit = {},
environment: ApplicationEnvironment = applicationEnvironment(),
block: Application.() -> Unit
): CIOApplicationEngine = createKtorServer(
): EmbeddedServer<CIOApplicationEngine, CIOApplicationEngine.Configuration> = createKtorServer(
CIO,
host,
port,
additionalEngineEnvironmentConfigurator,
additionalConfigurationConfigurator,
environment,
block
)
@ -51,15 +55,17 @@ fun <TEngine : ApplicationEngine, TConfiguration : ApplicationEngine.Configurati
engine: ApplicationEngineFactory<TEngine, TConfiguration>,
host: String = "localhost",
port: Int = Random.nextInt(1024, 65535),
additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {},
additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {},
additionalConfigurationConfigurator: TConfiguration.() -> Unit = {},
environment: ApplicationEnvironment = applicationEnvironment(),
configurators: List<KtorApplicationConfigurator>
): TEngine = createKtorServer(
): EmbeddedServer<TEngine, TConfiguration> = createKtorServer(
engine,
host,
port,
additionalEngineEnvironmentConfigurator,
additionalConfigurationConfigurator
additionalConfigurationConfigurator,
environment,
) {
configurators.forEach { it.apply { configure() } }
}
@ -73,6 +79,7 @@ fun createKtorServer(
host: String = "localhost",
port: Int = Random.nextInt(1024, 65535),
configurators: List<KtorApplicationConfigurator>,
additionalEngineEnvironmentConfigurator: ApplicationEngineEnvironmentBuilder.() -> Unit = {},
additionalEngineEnvironmentConfigurator: EngineConnectorBuilder.() -> Unit = {},
additionalConfigurationConfigurator: CIOApplicationEngine.Configuration.() -> Unit = {},
): ApplicationEngine = createKtorServer(CIO, host, port, additionalEngineEnvironmentConfigurator, additionalConfigurationConfigurator, configurators)
environment: ApplicationEnvironment = applicationEnvironment(),
): EmbeddedServer<CIOApplicationEngine, CIOApplicationEngine.Configuration> = createKtorServer(CIO, host, port, additionalEngineEnvironmentConfigurator, additionalConfigurationConfigurator, environment, configurators)

View File

@ -14,9 +14,10 @@ import io.ktor.server.application.call
import io.ktor.server.request.receiveMultipart
import io.ktor.server.response.respond
import io.ktor.server.response.respondText
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.post
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
@ -26,7 +27,10 @@ import java.nio.file.attribute.FileTime
class TemporalFilesRoutingConfigurator(
private val subpath: String = DefaultTemporalFilesSubPath,
private val temporalFilesUtilizer: TemporalFilesUtilizer = TemporalFilesUtilizer
private val temporalFilesUtilizer: TemporalFilesUtilizer = TemporalFilesUtilizer,
filesFlowReplay: Int = 0,
filesFlowExtraBufferCapacity: Int = Int.MAX_VALUE,
filesFlowOnBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND
) : ApplicationRoutingConfigurator.Element {
interface TemporalFilesUtilizer {
fun start(filesMap: MutableMap<TemporalFileId, MPPFile>, filesMutex: Mutex, onNewFileFlow: Flow<TemporalFileId>): Job
@ -74,10 +78,14 @@ class TemporalFilesRoutingConfigurator(
private val temporalFilesMap = mutableMapOf<TemporalFileId, MPPFile>()
private val temporalFilesMutex = Mutex()
private val filesFlow = MutableSharedFlow<TemporalFileId>()
private val filesFlow = MutableSharedFlow<TemporalFileId>(
replay = filesFlowReplay,
extraBufferCapacity = filesFlowExtraBufferCapacity,
onBufferOverflow = filesFlowOnBufferOverflow
)
val utilizerJob = temporalFilesUtilizer.start(temporalFilesMap, temporalFilesMutex, filesFlow.asSharedFlow())
override fun Route.invoke() {
override fun Routing.invoke() {
post(subpath) {
val multipart = call.receiveMultipart()
@ -111,7 +119,7 @@ class TemporalFilesRoutingConfigurator(
temporalFilesMap[fileId] = file
}
call.respondText(fileId.string)
launchSafelyWithoutExceptions { filesFlow.emit(fileId) }
filesFlow.emit(fileId)
} ?: call.respond(HttpStatusCode.BadRequest)
}
}

View File

@ -6,6 +6,7 @@ import dev.inmo.micro_utils.ktor.common.downloadToTempFile
import io.ktor.http.content.*
import io.ktor.server.application.ApplicationCall
import io.ktor.server.request.receiveMultipart
import io.ktor.utils.io.*
import io.ktor.utils.io.core.*
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.isActive
@ -47,7 +48,7 @@ suspend fun ApplicationCall.uniloadMultipart(
onBinaryChannelItem
) {
when (it.name) {
"bytes" -> resultInput = it.provider()
"bytes" -> resultInput = it.provider().readBuffer()
else -> onCustomFileItem(it)
}
}

View File

@ -2,8 +2,7 @@ package dev.inmo.micro_utils.ktor.server.configurators
import dev.inmo.micro_utils.ktor.server.configurators.ApplicationRoutingConfigurator.Element
import io.ktor.server.application.*
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.*
import kotlinx.serialization.Contextual
import kotlinx.serialization.Serializable
@ -11,7 +10,7 @@ import kotlinx.serialization.Serializable
class ApplicationRoutingConfigurator(
private val elements: List<@Contextual Element>
) : KtorApplicationConfigurator {
fun interface Element { operator fun Route.invoke() }
fun interface Element { operator fun Routing.invoke() }
private val rootInstaller = Element {
elements.forEach {
it.apply { invoke() }
@ -19,9 +18,7 @@ class ApplicationRoutingConfigurator(
}
override fun Application.configure() {
pluginOrNull(Routing) ?.apply {
rootInstaller.apply { invoke() }
} ?: install(Routing) {
routing {
rootInstaller.apply { invoke() }
}
}

View File

@ -8,7 +8,7 @@ import dev.inmo.micro_utils.repos.ktor.common.key_value.*
import io.ktor.client.HttpClient
import io.ktor.client.request.post
import io.ktor.http.*
import io.ktor.util.InternalAPI
import io.ktor.utils.io.InternalAPI
import io.ktor.util.reflect.TypeInfo
import io.ktor.util.reflect.typeInfo
import kotlinx.coroutines.flow.Flow

View File

@ -8,7 +8,7 @@ import dev.inmo.micro_utils.repos.ktor.common.one_to_many.*
import io.ktor.client.HttpClient
import io.ktor.client.request.post
import io.ktor.http.*
import io.ktor.util.InternalAPI
import io.ktor.utils.io.InternalAPI
import io.ktor.util.reflect.TypeInfo
import io.ktor.util.reflect.typeInfo
import kotlinx.coroutines.flow.Flow

View File

@ -2,10 +2,10 @@ package dev.inmo.micro_utils.repos.ktor.server.crud
import dev.inmo.micro_utils.ktor.common.*
import dev.inmo.micro_utils.repos.CRUDRepo
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import kotlinx.serialization.*
inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue : Any> Route.configureCRUDRepoRoutes(
inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue : Any> Routing.configureCRUDRepoRoutes(
originalRepo: CRUDRepo<ObjectType, IdType, InputValue>,
noinline idDeserializer: suspend (String) -> IdType
) {
@ -13,7 +13,7 @@ inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue :
configureWriteCRUDRepoRoutes(originalRepo)
}
inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue : Any> Route.configureCRUDRepoRoutes(
inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue : Any> Routing.configureCRUDRepoRoutes(
originalRepo: CRUDRepo<ObjectType, IdType, InputValue>,
idsSerializer: KSerializer<IdType>,
serialFormat: StringFormat
@ -21,7 +21,7 @@ inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue :
serialFormat.decodeFromString(idsSerializer, it)
}
inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue : Any> Route.configureCRUDRepoRoutes(
inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue : Any> Routing.configureCRUDRepoRoutes(
originalRepo: CRUDRepo<ObjectType, IdType, InputValue>,
idsSerializer: KSerializer<IdType>,
serialFormat: BinaryFormat

View File

@ -11,11 +11,11 @@ import dev.inmo.micro_utils.repos.ktor.common.idParameterName
import io.ktor.http.HttpStatusCode
import io.ktor.server.application.call
import io.ktor.server.response.respond
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.get
import kotlinx.serialization.*
inline fun <reified ObjectType, reified IdType> Route.configureReadCRUDRepoRoutes(
inline fun <reified ObjectType, reified IdType> Routing.configureReadCRUDRepoRoutes(
originalRepo: ReadCRUDRepo<ObjectType, IdType>,
noinline idDeserializer: suspend (String) -> IdType
) {
@ -65,7 +65,7 @@ inline fun <reified ObjectType, reified IdType> Route.configureReadCRUDRepoRoute
}
}
inline fun <reified ObjectType, reified IdType> Route.configureReadCRUDRepoRoutes(
inline fun <reified ObjectType, reified IdType> Routing.configureReadCRUDRepoRoutes(
originalRepo: ReadCRUDRepo<ObjectType, IdType>,
idsSerializer: KSerializer<IdType>,
serialFormat: StringFormat
@ -73,7 +73,7 @@ inline fun <reified ObjectType, reified IdType> Route.configureReadCRUDRepoRoute
serialFormat.decodeFromString(idsSerializer, it)
}
inline fun <reified ObjectType, reified IdType> Route.configureReadCRUDRepoRoutes(
inline fun <reified ObjectType, reified IdType> Routing.configureReadCRUDRepoRoutes(
originalRepo: ReadCRUDRepo<ObjectType, IdType>,
idsSerializer: KSerializer<IdType>,
serialFormat: BinaryFormat

View File

@ -7,10 +7,10 @@ import io.ktor.http.HttpStatusCode
import io.ktor.server.application.call
import io.ktor.server.request.receive
import io.ktor.server.response.respond
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.post
inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue : Any> Route.configureWriteCRUDRepoRoutes(
inline fun <reified ObjectType : Any, reified IdType : Any, reified InputValue : Any> Routing.configureWriteCRUDRepoRoutes(
originalRepo: WriteCRUDRepo<ObjectType, IdType, InputValue>
) {
includeWebsocketHandling(

View File

@ -3,10 +3,10 @@ package dev.inmo.micro_utils.repos.ktor.server.key.value
import dev.inmo.micro_utils.ktor.common.*
import dev.inmo.micro_utils.repos.KeyValueRepo
import io.ktor.http.*
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import kotlinx.serialization.*
inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValueRepoRoutes (
inline fun <reified Key : Any, reified Value : Any> Routing.configureKeyValueRepoRoutes (
originalRepo: KeyValueRepo<Key, Value>,
noinline idDeserializer: suspend (String) -> Key,
noinline valueDeserializer: suspend (String) -> Value
@ -15,7 +15,7 @@ inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValueRepoR
configureWriteKeyValueRepoRoutes(originalRepo)
}
inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValueRepoRoutes(
inline fun <reified Key : Any, reified Value : Any> Routing.configureKeyValueRepoRoutes(
originalRepo: KeyValueRepo<Key, Value>,
idsSerializer: DeserializationStrategy<Key>,
valueSerializer: DeserializationStrategy<Value>,
@ -30,7 +30,7 @@ inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValueRepoR
}
)
inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValueRepoRoutes(
inline fun <reified Key : Any, reified Value : Any> Routing.configureKeyValueRepoRoutes(
originalRepo: KeyValueRepo<Key, Value>,
idsSerializer: DeserializationStrategy<Key>,
valueSerializer: DeserializationStrategy<Value>,

View File

@ -14,14 +14,14 @@ import dev.inmo.micro_utils.repos.ktor.common.reversedParameterName
import io.ktor.http.*
import io.ktor.server.application.call
import io.ktor.server.response.respond
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.get
import io.ktor.util.InternalAPI
import io.ktor.utils.io.InternalAPI
import io.ktor.util.reflect.typeInfo
import kotlinx.serialization.*
@OptIn(InternalAPI::class)
inline fun <reified Key, reified Value> Route.configureReadKeyValueRepoRoutes (
inline fun <reified Key, reified Value> Routing.configureReadKeyValueRepoRoutes (
originalRepo: ReadKeyValueRepo<Key, Value>,
noinline idDeserializer: suspend (String) -> Key,
noinline valueDeserializer: suspend (String) -> Value
@ -79,7 +79,7 @@ inline fun <reified Key, reified Value> Route.configureReadKeyValueRepoRoutes (
}
}
inline fun <reified Key, reified Value> Route.configureReadKeyValueRepoRoutes(
inline fun <reified Key, reified Value> Routing.configureReadKeyValueRepoRoutes(
originalRepo: ReadKeyValueRepo<Key, Value>,
idsSerializer: DeserializationStrategy<Key>,
valueSerializer: DeserializationStrategy<Value>,
@ -94,7 +94,7 @@ inline fun <reified Key, reified Value> Route.configureReadKeyValueRepoRoutes(
}
)
inline fun <reified Key, reified Value> Route.configureReadKeyValueRepoRoutes(
inline fun <reified Key, reified Value> Routing.configureReadKeyValueRepoRoutes(
originalRepo: ReadKeyValueRepo<Key, Value>,
idsSerializer: DeserializationStrategy<Key>,
valueSerializer: DeserializationStrategy<Value>,

View File

@ -7,11 +7,11 @@ import io.ktor.http.HttpStatusCode
import io.ktor.server.application.call
import io.ktor.server.request.receive
import io.ktor.server.response.respond
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.post
import io.ktor.util.reflect.typeInfo
inline fun <reified Key : Any, reified Value : Any> Route.configureWriteKeyValueRepoRoutes (
inline fun <reified Key : Any, reified Value : Any> Routing.configureWriteKeyValueRepoRoutes (
originalRepo: WriteKeyValueRepo<Key, Value>
) {
includeWebsocketHandling(

View File

@ -3,10 +3,10 @@ package dev.inmo.micro_utils.repos.ktor.server.key.values
import dev.inmo.micro_utils.ktor.common.*
import dev.inmo.micro_utils.repos.*
import io.ktor.http.*
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import kotlinx.serialization.*
inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValuesRepoRoutes (
inline fun <reified Key : Any, reified Value : Any> Routing.configureKeyValuesRepoRoutes (
originalRepo: KeyValuesRepo<Key, Value>,
noinline keyDeserializer: suspend (String) -> Key,
noinline valueDeserializer: suspend (String) -> Value
@ -15,7 +15,7 @@ inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValuesRepo
configureWriteKeyValuesRepoRoutes(originalRepo)
}
inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValuesRepoRoutes(
inline fun <reified Key : Any, reified Value : Any> Routing.configureKeyValuesRepoRoutes(
originalRepo: KeyValuesRepo<Key, Value>,
keySerializer: DeserializationStrategy<Key>,
valueSerializer: DeserializationStrategy<Value>,
@ -30,7 +30,7 @@ inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValuesRepo
}
)
inline fun <reified Key : Any, reified Value : Any> Route.configureKeyValuesRepoRoutes(
inline fun <reified Key : Any, reified Value : Any> Routing.configureKeyValuesRepoRoutes(
originalRepo: KeyValuesRepo<Key, Value>,
keySerializer: DeserializationStrategy<Key>,
valueSerializer: DeserializationStrategy<Value>,

View File

@ -12,14 +12,14 @@ import dev.inmo.micro_utils.repos.ktor.common.one_to_many.*
import io.ktor.http.*
import io.ktor.server.application.call
import io.ktor.server.response.respond
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.get
import io.ktor.util.InternalAPI
import io.ktor.utils.io.InternalAPI
import io.ktor.util.reflect.typeInfo
import kotlinx.serialization.*
@OptIn(InternalAPI::class)
inline fun <reified Key, reified Value> Route.configureReadKeyValuesRepoRoutes (
inline fun <reified Key, reified Value> Routing.configureReadKeyValuesRepoRoutes (
originalRepo: ReadKeyValuesRepo<Key, Value>,
noinline keyDeserializer: suspend (String) -> Key,
noinline valueDeserializer: suspend (String) -> Value
@ -76,7 +76,7 @@ inline fun <reified Key, reified Value> Route.configureReadKeyValuesRepoRoutes (
}
}
inline fun <reified Key, reified Value> Route.configureReadKeyValuesRepoRoutes(
inline fun <reified Key, reified Value> Routing.configureReadKeyValuesRepoRoutes(
originalRepo: ReadKeyValuesRepo<Key, Value>,
keySerializer: DeserializationStrategy<Key>,
valueSerializer: DeserializationStrategy<Value>,
@ -91,7 +91,7 @@ inline fun <reified Key, reified Value> Route.configureReadKeyValuesRepoRoutes(
}
)
inline fun <reified Key, reified Value> Route.configureReadKeyValuesRepoRoutes(
inline fun <reified Key, reified Value> Routing.configureReadKeyValuesRepoRoutes(
originalRepo: ReadKeyValuesRepo<Key, Value>,
keySerializer: DeserializationStrategy<Key>,
valueSerializer: DeserializationStrategy<Value>,

View File

@ -7,11 +7,11 @@ import io.ktor.http.HttpStatusCode
import io.ktor.server.application.call
import io.ktor.server.request.receive
import io.ktor.server.response.respond
import io.ktor.server.routing.Route
import io.ktor.server.routing.Routing
import io.ktor.server.routing.post
import io.ktor.util.reflect.typeInfo
inline fun <reified Key : Any, reified Value : Any> Route.configureWriteKeyValuesRepoRoutes (
inline fun <reified Key : Any, reified Value : Any> Routing.configureWriteKeyValuesRepoRoutes (
originalRepo: WriteKeyValuesRepo<Key, Value>
) {
includeWebsocketHandling(