Skip to content

Adopt the different congestion control defaults as in Rust #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import io.zenoh.qos.Reliability
data class DeleteOptions(
var reliability: Reliability = Reliability.RELIABLE,
var attachment: IntoZBytes? = null,
var express: Boolean = QoS.defaultQoS.express,
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
var priority: Priority = QoS.defaultQoS.priority
var express: Boolean = QoS.defaultPush.express,
var congestionControl: CongestionControl = QoS.defaultPush.congestionControl,
var priority: Priority = QoS.defaultPush.priority
) {
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ import io.zenoh.qos.*
*/
data class PublisherOptions(var reliability: Reliability = Reliability.RELIABLE,
var encoding: Encoding = Encoding.defaultEncoding(),
var express: Boolean = QoS.defaultQoS.express,
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
var priority: Priority = QoS.defaultQoS.priority)
var express: Boolean = QoS.defaultPush.express,
var congestionControl: CongestionControl = QoS.defaultPush.congestionControl,
var priority: Priority = QoS.defaultPush.priority)
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ data class PutOptions(
var encoding: Encoding? = null,
var reliability: Reliability = Reliability.RELIABLE,
var attachment: IntoZBytes? = null,
var express: Boolean = QoS.defaultQoS.express,
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
var priority: Priority = QoS.defaultQoS.priority
var express: Boolean = QoS.defaultPush.express,
var congestionControl: CongestionControl = QoS.defaultPush.congestionControl,
var priority: Priority = QoS.defaultPush.priority
) {
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
}
4 changes: 3 additions & 1 deletion zenoh-java/src/commonMain/kotlin/io/zenoh/qos/QoS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ data class QoS (
) {

companion object {
internal val defaultQoS = QoS()
internal val defaultPush = QoS(CongestionControl.DROP, Priority.DATA, false)
internal val defaultRequest = QoS(CongestionControl.BLOCK, Priority.DATA, false)
internal val defaultResponse = QoS(CongestionControl.BLOCK, Priority.DATA, false)
}
}
2 changes: 1 addition & 1 deletion zenoh-java/src/commonMain/kotlin/io/zenoh/query/Get.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ data class GetOptions(
var payload: IntoZBytes? = null,
var encoding: Encoding? = null,
var attachment: IntoZBytes? = null,
var qos: QoS = QoS.defaultQoS
var qos: QoS = QoS.defaultRequest
) {
fun setPayload(payload: String) = apply { this.payload = ZBytes.from(payload) }
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
Expand Down
6 changes: 3 additions & 3 deletions zenoh-java/src/commonMain/kotlin/io/zenoh/query/Querier.kt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ data class QuerierOptions(
var target: QueryTarget = QueryTarget.BEST_MATCHING,
var consolidationMode: ConsolidationMode = ConsolidationMode.AUTO,
var timeout: Duration = Duration.ofMillis(10000),
var express: Boolean = QoS.defaultQoS.express,
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
var priority: Priority = QoS.defaultQoS.priority
var express: Boolean = QoS.defaultRequest.express,
var congestionControl: CongestionControl = QoS.defaultRequest.congestionControl,
var priority: Priority = QoS.defaultRequest.priority
)
12 changes: 6 additions & 6 deletions zenoh-java/src/commonMain/kotlin/io/zenoh/query/Reply.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ data class ReplyOptions(
var encoding: Encoding = Encoding.defaultEncoding(),
var timeStamp: TimeStamp? = null,
var attachment: IntoZBytes? = null,
var express: Boolean = QoS.defaultQoS.express,
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
var priority: Priority = QoS.defaultQoS.priority
var express: Boolean = QoS.defaultResponse.express,
var congestionControl: CongestionControl = QoS.defaultResponse.congestionControl,
var priority: Priority = QoS.defaultResponse.priority
) {
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
}
Expand All @@ -111,9 +111,9 @@ data class ReplyOptions(
data class ReplyDelOptions(
var timeStamp: TimeStamp? = null,
var attachment: IntoZBytes? = null,
var express: Boolean = QoS.defaultQoS.express,
var congestionControl: CongestionControl = QoS.defaultQoS.congestionControl,
var priority: Priority = QoS.defaultQoS.priority
var express: Boolean = QoS.defaultResponse.express,
var congestionControl: CongestionControl = QoS.defaultResponse.congestionControl,
var priority: Priority = QoS.defaultResponse.priority
) {
fun setAttachment(attachment: String) = apply { this.attachment = ZBytes.from(attachment) }
}
Expand Down
4 changes: 3 additions & 1 deletion zenoh-java/src/jvmTest/java/io/zenoh/QuerierTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import io.zenoh.bytes.ZBytes;
import io.zenoh.exceptions.ZError;
import io.zenoh.keyexpr.KeyExpr;
import io.zenoh.qos.CongestionControl;
import io.zenoh.qos.Priority;
import io.zenoh.qos.QoS;
import io.zenoh.query.Querier;
import io.zenoh.query.Reply;
Expand Down Expand Up @@ -56,7 +58,7 @@ public void querier_runsWithCallbackTest() throws ZError {
Encoding.defaultEncoding(),
SampleKind.PUT,
new TimeStamp(Date.from(Instant.now())),
new QoS(),
new QoS(CongestionControl.BLOCK, Priority.DATA, false),
null
);
var examplePayload = ZBytes.from("Example payload");
Expand Down
2 changes: 1 addition & 1 deletion zenoh-java/src/jvmTest/java/io/zenoh/QueryableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void queryableRunsWithCallback() throws ZError {
Encoding.defaultEncoding(),
SampleKind.PUT,
timestamp,
new QoS(),
new QoS(CongestionControl.BLOCK, Priority.DATA, false),
null
);

Expand Down