Skip to content

Commit 2154d69

Browse files
Merge pull request #173 from jillesvangurp/int-to-long
int to long
2 parents 5ce679e + 1166aea commit 2154d69

File tree

8 files changed

+60
-61
lines changed

8 files changed

+60
-61
lines changed

search-client/src/commonMain/kotlin/com/jillesvangurp/ktsearch/SearchResponse.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ data class SearchResponse(
7070
val innerHits: Map<String, HitsContainer>?,
7171
val highlight: JsonObject?,
7272
@SerialName("_seq_no")
73-
override val seqNo: Int? = null,
73+
override val seqNo: Long? = null,
7474
@SerialName("_primary_term")
75-
override val primaryTerm: Int? = null,
75+
override val primaryTerm: Long? = null,
7676
@SerialName("_version")
7777
override val version: Long?,
7878
@SerialName("_explanation")

search-client/src/commonMain/kotlin/com/jillesvangurp/ktsearch/SniffingNodeSelector.kt

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
package com.jillesvangurp.ktsearch
22

3-
import io.ktor.utils.io.core.*
3+
import kotlin.coroutines.AbstractCoroutineContextElement
4+
import kotlin.coroutines.CoroutineContext
5+
import kotlin.time.Duration
6+
import kotlin.time.Duration.Companion.minutes
47
import kotlinx.coroutines.CoroutineName
58
import kotlinx.coroutines.CoroutineScope
69
import kotlinx.coroutines.coroutineScope
710
import kotlinx.coroutines.launch
811
import kotlinx.datetime.Clock
912
import kotlinx.datetime.Instant
10-
import kotlinx.serialization.encodeToString
1113
import kotlinx.serialization.json.JsonObject
1214
import kotlinx.serialization.json.jsonObject
1315
import kotlinx.serialization.json.jsonPrimitive
14-
import kotlin.coroutines.AbstractCoroutineContextElement
15-
import kotlin.coroutines.CoroutineContext
16-
import kotlin.time.Duration
17-
import kotlin.time.Duration.Companion.minutes
1816

1917
internal data class VerifiedNode(val lastChecked: Instant, val node: Node)
2018

@@ -109,8 +107,7 @@ class SniffingNodeSelector(
109107
affinity.remove(aid)
110108
}
111109
}
112-
} else {
113-
}
110+
}
114111
} finally {
115112
sniffing = false
116113
}

search-client/src/commonMain/kotlin/com/jillesvangurp/ktsearch/bulk-api.kt

+16-16
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ interface BulkSession {
134134
index: String? = null,
135135
id: String? = null,
136136
requireAlias: Boolean? = null,
137-
ifSeqNo: Int? = null,
138-
ifPrimaryTerm: Int? = null,
137+
ifSeqNo: Long? = null,
138+
ifPrimaryTerm: Long? = null,
139139
routing: String? = null
140140
)
141141

@@ -147,8 +147,8 @@ interface BulkSession {
147147
index: String? = null,
148148
requireAlias: Boolean? = null,
149149
upsert: JsonObject? = null,
150-
ifSeqNo: Int? = null,
151-
ifPrimaryTerm: Int? = null,
150+
ifSeqNo: Long? = null,
151+
ifPrimaryTerm: Long? = null,
152152
routing: String? = null,
153153
)
154154

@@ -158,8 +158,8 @@ interface BulkSession {
158158
index: String? = null,
159159
requireAlias: Boolean? = null,
160160
docAsUpsert: Boolean? = null,
161-
ifSeqNo: Int? = null,
162-
ifPrimaryTerm: Int? = null,
161+
ifSeqNo: Long? = null,
162+
ifPrimaryTerm: Long? = null,
163163
routing: String? = null,
164164
)
165165

@@ -169,8 +169,8 @@ interface BulkSession {
169169
index: String? = null,
170170
requireAlias: Boolean? = null,
171171
docAsUpsert: Boolean? = null,
172-
ifSeqNo: Int? = null,
173-
ifPrimaryTerm: Int? = null,
172+
ifSeqNo: Long? = null,
173+
ifPrimaryTerm: Long? = null,
174174
routing: String? = null,
175175
)
176176

@@ -236,8 +236,8 @@ internal class DefaultBulkSession internal constructor(
236236
index: String?,
237237
id: String?,
238238
requireAlias: Boolean?,
239-
ifSeqNo: Int?,
240-
ifPrimaryTerm: Int?,
239+
ifSeqNo: Long?,
240+
ifPrimaryTerm: Long?,
241241
routing: String?,
242242
) {
243243
val opDsl = withJsonDsl {
@@ -290,8 +290,8 @@ internal class DefaultBulkSession internal constructor(
290290
index: String?,
291291
requireAlias: Boolean?,
292292
upsert: JsonObject?,
293-
ifSeqNo: Int?,
294-
ifPrimaryTerm: Int?,
293+
ifSeqNo: Long?,
294+
ifPrimaryTerm: Long?,
295295
routing: String?
296296
) {
297297
val opDsl = withJsonDsl {
@@ -331,8 +331,8 @@ internal class DefaultBulkSession internal constructor(
331331
index: String?,
332332
requireAlias: Boolean?,
333333
docAsUpsert: Boolean?,
334-
ifSeqNo: Int?,
335-
ifPrimaryTerm: Int?,
334+
ifSeqNo: Long?,
335+
ifPrimaryTerm: Long?,
336336
routing: String?
337337
) {
338338
update(
@@ -353,8 +353,8 @@ internal class DefaultBulkSession internal constructor(
353353
index: String?,
354354
requireAlias: Boolean?,
355355
docAsUpsert: Boolean?,
356-
ifSeqNo: Int?,
357-
ifPrimaryTerm: Int?,
356+
ifSeqNo: Long?,
357+
ifPrimaryTerm: Long?,
358358
routing: String?
359359
) {
360360
val opDsl = withJsonDsl {

search-client/src/commonMain/kotlin/com/jillesvangurp/ktsearch/documents-api.kt

+12-12
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import kotlin.time.Duration
1212

1313
interface SourceInformation {
1414
val id: String
15-
val seqNo: Int?
16-
val primaryTerm: Int?
15+
val seqNo: Long?
16+
val primaryTerm: Long?
1717
val version: Long?
1818
val source: JsonObject?
1919
}
@@ -33,9 +33,9 @@ data class DocumentIndexResponse(
3333
@SerialName("_shards")
3434
val shards: Shards,
3535
@SerialName("_seq_no")
36-
override val seqNo: Int,
36+
override val seqNo: Long,
3737
@SerialName("_primary_term")
38-
override val primaryTerm: Int,
38+
override val primaryTerm: Long,
3939
@SerialName("_source")
4040
override val source: JsonObject? = null,
4141
): SourceInformation
@@ -44,8 +44,8 @@ suspend inline fun <reified T> SearchClient.indexDocument(
4444
target: String,
4545
document: T,
4646
id: String? = null,
47-
ifSeqNo: Int? = null,
48-
ifPrimaryTerm: Int? = null,
47+
ifSeqNo: Long? = null,
48+
ifPrimaryTerm: Long? = null,
4949
opType: OperationType? = null,
5050
pipeline: String? = null,
5151
refresh: Refresh? = null,
@@ -82,8 +82,8 @@ suspend fun SearchClient.indexDocument(
8282
target: String,
8383
serializedJson: String,
8484
id: String? = null,
85-
ifSeqNo: Int? = null,
86-
ifPrimaryTerm: Int? = null,
85+
ifSeqNo: Long? = null,
86+
ifPrimaryTerm: Long? = null,
8787
opType: OperationType? = null,
8888
pipeline: String? = null,
8989
refresh: Refresh? = null,
@@ -132,9 +132,9 @@ data class GetDocumentResponse(
132132
@SerialName("_source")
133133
override val source: JsonObject?,
134134
@SerialName("_seq_no")
135-
override val seqNo: Int?,
135+
override val seqNo: Long?,
136136
@SerialName("_primary_term")
137-
override val primaryTerm: Int?,
137+
override val primaryTerm: Long?,
138138
val found: Boolean,
139139
@SerialName("_routing")
140140
val routing: String? = null,
@@ -144,8 +144,8 @@ data class GetDocumentResponse(
144144
suspend fun SearchClient.deleteDocument(
145145
target: String,
146146
id: String,
147-
ifSeqNo: Int? = null,
148-
ifPrimaryTerm: Int? = null,
147+
ifSeqNo: Long? = null,
148+
ifPrimaryTerm: Long? = null,
149149
refresh: Refresh? = null,
150150
routing: String? = null,
151151
timeout: Duration? = null,

search-client/src/commonMain/kotlin/com/jillesvangurp/ktsearch/repository/IndexRepository.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ interface TypedDocumentIBulkSession<T> : BulkSession {
8888
suspend fun update(
8989
id: String,
9090
original: T,
91-
ifSeqNo: Int,
92-
ifPrimaryTerm: Int,
91+
ifSeqNo: Long,
92+
ifPrimaryTerm: Long,
9393
updateBlock: (T) -> T,
9494
)
9595
}
@@ -116,8 +116,8 @@ internal class BulkUpdateSession<T : Any>(
116116
override suspend fun update(
117117
id: String,
118118
original: T,
119-
ifSeqNo: Int,
120-
ifPrimaryTerm: Int,
119+
ifSeqNo: Long,
120+
ifPrimaryTerm: Long,
121121
updateBlock: (T) -> T,
122122
) {
123123
if (updateFunctions.containsKey(id)) {
@@ -266,8 +266,8 @@ class IndexRepository<T : Any>(
266266
suspend fun index(
267267
value: T,
268268
id: String? = null,
269-
ifSeqNo: Int? = null,
270-
ifPrimaryTerm: Int? = null,
269+
ifSeqNo: Long? = null,
270+
ifPrimaryTerm: Long? = null,
271271
opType: OperationType? = null,
272272
pipeline: String? = null,
273273
refresh: Refresh? = null,
@@ -382,8 +382,8 @@ class IndexRepository<T : Any>(
382382

383383
suspend fun delete(
384384
id: String,
385-
ifSeqNo: Int? = null,
386-
ifPrimaryTerm: Int? = null,
385+
ifSeqNo: Long? = null,
386+
ifPrimaryTerm: Long? = null,
387387
refresh: Refresh? = null,
388388
routing: String? = null,
389389
timeout: Duration? = null,

search-client/src/commonMain/kotlin/com/jillesvangurp/ktsearch/update-api.kt

+12-12
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ data class DocumentUpdateResponse(
2424
@SerialName("_shards")
2525
val shards: Shards,
2626
@SerialName("_seq_no")
27-
val seqNo: Int,
27+
val seqNo: Long,
2828
@SerialName("_primary_term")
29-
val primaryTerm: Int,
29+
val primaryTerm: Long,
3030
val get: DocumentUpdateResponse.UpdatedSourceInformation?=null
3131
) {
3232
@Serializable
3333
data class UpdatedSourceInformation(
3434
@SerialName("_source")
3535
val source: JsonObject?,
3636
@SerialName("_seq_no")
37-
val seqNo: Int?,
37+
val seqNo: Long?,
3838
@SerialName("_primary_term")
39-
val primaryTerm: Int?,
39+
val primaryTerm: Long?,
4040
val version: Long?,
4141
val found: Boolean,
4242
@SerialName("_routing")
@@ -50,8 +50,8 @@ suspend inline fun <reified T> SearchClient.updateDocument(
5050
doc: T,
5151
json: Json = DEFAULT_JSON,
5252
detectNoop: Boolean? = null,
53-
ifSeqNo: Int? = null,
54-
ifPrimaryTerm: Int? = null,
53+
ifSeqNo: Long? = null,
54+
ifPrimaryTerm: Long? = null,
5555
requireAlias: Boolean? = null,
5656
retryOnConflict: Int? = null,
5757
refresh: Refresh? = null,
@@ -86,8 +86,8 @@ suspend fun SearchClient.updateDocument(
8686
id: String,
8787
docJson: String,
8888
detectNoop: Boolean? = null,
89-
ifSeqNo: Int? = null,
90-
ifPrimaryTerm: Int? = null,
89+
ifSeqNo: Long? = null,
90+
ifPrimaryTerm: Long? = null,
9191
requireAlias: Boolean? = null,
9292
retryOnConflict: Int? = null,
9393
refresh: Refresh? = null,
@@ -125,8 +125,8 @@ suspend inline fun <reified T> SearchClient.updateDocument(
125125
script: Script,
126126
upsertJson: T,
127127
json: Json = DEFAULT_JSON,
128-
ifSeqNo: Int? = null,
129-
ifPrimaryTerm: Int? = null,
128+
ifSeqNo: Long? = null,
129+
ifPrimaryTerm: Long? = null,
130130
requireAlias: Boolean? = null,
131131
retryOnConflict: Int? = null,
132132
refresh: Refresh? = null,
@@ -161,8 +161,8 @@ suspend fun SearchClient.updateDocument(
161161
id: String,
162162
script: Script,
163163
upsertJson: String? = null,
164-
ifSeqNo: Int? = null,
165-
ifPrimaryTerm: Int? = null,
164+
ifSeqNo: Long? = null,
165+
ifPrimaryTerm: Long? = null,
166166
requireAlias: Boolean? = null,
167167
retryOnConflict: Int? = null,
168168
refresh: Refresh? = null,

search-client/src/jvmMain/kotlin/com/jillesvangurp/ktsearch/defaultHttpClient.kt

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ fun ktorClientWithCIOEngine(
5353
elasticApiKey: String?,
5454
block: HttpClientConfig<*>.() -> Unit,
5555
) = HttpClient(CIO) {
56+
// there are some known issues with using CIO and weird EOF errors in combination with pipelining
5657
engine {
5758
maxConnectionsCount = 100
5859
endpoint {

versions.properties

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ version.com.jillesvangurp..json-dsl=3.0.7
2121

2222
version.com.jillesvangurp..kotlinx-serialization-extensions=1.0.6
2323

24-
version.io.github.oshai..kotlin-logging=7.0.5
24+
version.io.github.oshai..kotlin-logging=7.0.6
2525

2626
version.junit.jupiter=5.12.1
2727
## # available=5.13.0-M1
@@ -30,16 +30,17 @@ version.junit.jupiter=5.12.1
3030
version.kotest=5.9.1
3131
## # available=6.0.0.M1
3232
## # available=6.0.0.M2
33+
## # available=6.0.0.M3
3334

3435
version.kotlin=2.1.20
3536

3637
version.kotlinx.coroutines=1.10.1
3738

3839
version.kotlinx.datetime=0.6.2
3940

40-
version.kotlinx.serialization=1.8.0
41+
version.kotlinx.serialization=1.8.1
4142

42-
version.ktor=3.1.1
43+
version.ktor=3.1.2
4344

4445
version.org.apache.logging.log4j..log4j-to-slf4j=2.24.3
4546
## # available=3.0.0-alpha1

0 commit comments

Comments
 (0)