-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for QoS in sample. (#46)
* add qos support to sample * add docs * move internal qos functionality into JNIQoS class * suppress clippy too_many_arguments warning on decode_sample * code clean up
- Loading branch information
1 parent
f890fb0
commit b884ce2
Showing
24 changed files
with
230 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// Copyright (c) 2024 ZettaScale Technology | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License 2.0 which is available at | ||
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// | ||
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
package io.zenoh.jni | ||
|
||
import io.zenoh.prelude.CongestionControl; | ||
import io.zenoh.prelude.Priority; | ||
|
||
internal class JNIQoS internal constructor(internal val qos: Byte) { | ||
|
||
internal constructor(): this(getDefaultQoSViaJNI()) | ||
|
||
fun getExpress(): Boolean { | ||
return getExpressViaJNI(qos) | ||
} | ||
|
||
fun getCongestionControl(): CongestionControl { | ||
return CongestionControl.fromInt(getCongestionControlViaJNI(qos)) | ||
} | ||
|
||
fun getPriority(): Priority { | ||
return Priority.fromInt(getPriorityViaJNI(qos)) | ||
} | ||
|
||
companion object { | ||
private external fun getDefaultQoSViaJNI(): Byte | ||
} | ||
|
||
private external fun getPriorityViaJNI(_qos: Byte): Int | ||
private external fun getCongestionControlViaJNI(_qos: Byte): Int | ||
private external fun getExpressViaJNI(_qos:Byte): Boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,19 +12,23 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
package io.zenoh.publication | ||
package io.zenoh.prelude | ||
|
||
/** The congestion control to be applied when routing the data. */ | ||
enum class CongestionControl { | ||
enum class CongestionControl (val value: Int) { | ||
|
||
/** | ||
* Allows the message to be dropped if all buffers are full. | ||
*/ | ||
DROP(0), | ||
|
||
/** | ||
* Prevents the message from being dropped at all cost. | ||
* In the face of heavy congestion on a part of the network, this could result in your publisher node blocking. | ||
*/ | ||
BLOCK, | ||
BLOCK(1); | ||
|
||
/** | ||
* Allows the message to be dropped if all buffers are full. | ||
*/ | ||
DROP; | ||
companion object { | ||
fun fromInt(value: Int) = entries.first { it.value == value } | ||
} | ||
} |
Oops, something went wrong.