Skip to content

Commit a32c516

Browse files
committed
Adopt the different congestion control defaults as in Rust
1 parent cf9aeab commit a32c516

File tree

9 files changed

+26
-22
lines changed

9 files changed

+26
-22
lines changed

zenoh-java/src/commonMain/kotlin/io/zenoh/pubsub/DeleteOptions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ import io.zenoh.qos.Reliability
3333
data class DeleteOptions(
3434
var reliability: Reliability = Reliability.RELIABLE,
3535
var attachment: IntoZBytes? = null,
36-
var express: Boolean = QoS.defaultQoS.express,
37-
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
38-
var priority: Priority = QoS.defaultQoS.priority
36+
var express: Boolean = QoS.defaultPush.express,
37+
var congestionControl: CongestionControl = QoS.defaultPush.congestionControl,
38+
var priority: Priority = QoS.defaultPush.priority
3939
) {
4040
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
4141
}

zenoh-java/src/commonMain/kotlin/io/zenoh/pubsub/PublisherOptions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ import io.zenoh.qos.*
2828
*/
2929
data class PublisherOptions(var reliability: Reliability = Reliability.RELIABLE,
3030
var encoding: Encoding = Encoding.defaultEncoding(),
31-
var express: Boolean = QoS.defaultQoS.express,
32-
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
33-
var priority: Priority = QoS.defaultQoS.priority)
31+
var express: Boolean = QoS.defaultPush.express,
32+
var congestionControl: CongestionControl = QoS.defaultPush.congestionControl,
33+
var priority: Priority = QoS.defaultPush.priority)

zenoh-java/src/commonMain/kotlin/io/zenoh/pubsub/PutOptions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ data class PutOptions(
3333
var encoding: Encoding? = null,
3434
var reliability: Reliability = Reliability.RELIABLE,
3535
var attachment: IntoZBytes? = null,
36-
var express: Boolean = QoS.defaultQoS.express,
37-
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
38-
var priority: Priority = QoS.defaultQoS.priority
36+
var express: Boolean = QoS.defaultPush.express,
37+
var congestionControl: CongestionControl = QoS.defaultPush.congestionControl,
38+
var priority: Priority = QoS.defaultPush.priority
3939
) {
4040
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
4141
}

zenoh-java/src/commonMain/kotlin/io/zenoh/qos/QoS.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ data class QoS (
2828
) {
2929

3030
companion object {
31-
internal val defaultQoS = QoS()
31+
internal val defaultPush = QoS(CongestionControl.DROP, Priority.DATA, false)
32+
internal val defaultRequest = QoS(CongestionControl.BLOCK, Priority.DATA, false)
33+
internal val defaultResponse = QoS(CongestionControl.BLOCK, Priority.DATA, false)
3234
}
3335
}

zenoh-java/src/commonMain/kotlin/io/zenoh/query/Get.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ data class GetOptions(
3838
var payload: IntoZBytes? = null,
3939
var encoding: Encoding? = null,
4040
var attachment: IntoZBytes? = null,
41-
var qos: QoS = QoS.defaultQoS
41+
var qos: QoS = QoS.defaultRequest
4242
) {
4343
fun setPayload(payload: String) = apply { this.payload = ZBytes.from(payload) }
4444
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }

zenoh-java/src/commonMain/kotlin/io/zenoh/query/Querier.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ data class QuerierOptions(
159159
var target: QueryTarget = QueryTarget.BEST_MATCHING,
160160
var consolidationMode: ConsolidationMode = ConsolidationMode.AUTO,
161161
var timeout: Duration = Duration.ofMillis(10000),
162-
var express: Boolean = QoS.defaultQoS.express,
163-
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
164-
var priority: Priority = QoS.defaultQoS.priority
162+
var express: Boolean = QoS.defaultRequest.express,
163+
var congestionControl: CongestionControl = QoS.defaultRequest.congestionControl,
164+
var priority: Priority = QoS.defaultRequest.priority
165165
)

zenoh-java/src/commonMain/kotlin/io/zenoh/query/Reply.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ data class ReplyOptions(
9292
var encoding: Encoding = Encoding.defaultEncoding(),
9393
var timeStamp: TimeStamp? = null,
9494
var attachment: IntoZBytes? = null,
95-
var express: Boolean = QoS.defaultQoS.express,
96-
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
97-
var priority: Priority = QoS.defaultQoS.priority
95+
var express: Boolean = QoS.defaultResponse.express,
96+
var congestionControl: CongestionControl = QoS.defaultResponse.congestionControl,
97+
var priority: Priority = QoS.defaultResponse.priority
9898
) {
9999
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
100100
}
@@ -111,9 +111,9 @@ data class ReplyOptions(
111111
data class ReplyDelOptions(
112112
var timeStamp: TimeStamp? = null,
113113
var attachment: IntoZBytes? = null,
114-
var express: Boolean = QoS.defaultQoS.express,
115-
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
116-
var priority: Priority = QoS.defaultQoS.priority
114+
var express: Boolean = QoS.defaultResponse.express,
115+
var congestionControl: CongestionControl = QoS.defaultResponse.congestionControl,
116+
var priority: Priority = QoS.defaultResponse.priority
117117
) {
118118
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
119119
}

zenoh-java/src/jvmTest/java/io/zenoh/QuerierTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import io.zenoh.bytes.ZBytes;
1919
import io.zenoh.exceptions.ZError;
2020
import io.zenoh.keyexpr.KeyExpr;
21+
import io.zenoh.qos.CongestionControl;
22+
import io.zenoh.qos.Priority;
2123
import io.zenoh.qos.QoS;
2224
import io.zenoh.query.Querier;
2325
import io.zenoh.query.Reply;
@@ -56,7 +58,7 @@ public void querier_runsWithCallbackTest() throws ZError {
5658
Encoding.defaultEncoding(),
5759
SampleKind.PUT,
5860
new TimeStamp(Date.from(Instant.now())),
59-
new QoS(),
61+
new QoS(CongestionControl.BLOCK, Priority.DATA, false),
6062
null
6163
);
6264
var examplePayload = ZBytes.from("Example payload");

zenoh-java/src/jvmTest/java/io/zenoh/QueryableTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void queryableRunsWithCallback() throws ZError {
5353
Encoding.defaultEncoding(),
5454
SampleKind.PUT,
5555
timestamp,
56-
new QoS(),
56+
new QoS(CongestionControl.BLOCK, Priority.DATA, false),
5757
null
5858
);
5959

0 commit comments

Comments
 (0)