-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add support for QoS in sample. #46
Merged
OlivierHecart
merged 6 commits into
eclipse-zenoh:main
from
DenisBiryukov91:feature/priority-in-sample
May 15, 2024
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f4f4351
add qos support to sample
DenisBiryukov91 196b5d5
add docs
DenisBiryukov91 5ecfd18
move internal qos functionality into JNIQoS class
DenisBiryukov91 d43fdba
merge
DenisBiryukov91 ee589a7
suppress clippy too_many_arguments warning on decode_sample
DenisBiryukov91 ffdf3f7
code clean up
DenisBiryukov91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,22 @@ | |
// 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 } | ||
} | ||
} |
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,7 +12,7 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
package io.zenoh.publication | ||
package io.zenoh.prelude | ||
|
||
/** | ||
* The Priority of Zenoh messages. | ||
|
@@ -30,5 +30,9 @@ enum class Priority(val value: Int) { | |
DATA(5), | ||
DATA_LOW(6), | ||
BACKGROUND(7); | ||
|
||
companion object { | ||
fun fromInt(value: Int) = entries.first { it.value == value } | ||
} | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why moving sample kind and congestion control under prelude? I wonder because here for instance it's under publication, but it's true that it also appears under prelude (here). So what's the criteria, @p-avital may give us more insight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was mostly done to avoid circular dependencies between modules (yes, I know that kotlin/java can handle it). Also these types are really not something proper to publication only since they appear in other contexts (especially after this pr)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.