Skip to content

Commit

Permalink
feat(querier): Adding 'Unstable' annotation to the querier feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIMP committed Dec 5, 2024
1 parent 3e42b04 commit 08f52e9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/src/main/kotlin/io.zenoh/ZQuerier.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package io.zenoh
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.*
import com.github.ajalt.clikt.parameters.types.long
import io.zenoh.annotations.Unstable
import io.zenoh.bytes.ZBytes
import io.zenoh.query.QueryTarget
import io.zenoh.query.intoSelector
Expand All @@ -26,6 +27,7 @@ class ZQuerier(private val emptyArgs: Boolean) : CliktCommand(
help = "Zenoh Querier example"
) {

@OptIn(Unstable::class)
override fun run() {
val config = loadConfig(emptyArgs, configFile, connect, listen, noMulticastScouting, mode)

Expand Down
3 changes: 3 additions & 0 deletions zenoh-kotlin/src/commonMain/kotlin/io/zenoh/Session.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package io.zenoh

import io.zenoh.annotations.Unstable
import io.zenoh.exceptions.ZError
import io.zenoh.handlers.Callback
import io.zenoh.handlers.ChannelHandler
Expand Down Expand Up @@ -401,6 +402,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
* )
* ```
*/
@Unstable
fun declareQuerier(
keyExpr: KeyExpr,
target: QueryTarget = QueryTarget.BEST_MATCHING,
Expand Down Expand Up @@ -776,6 +778,7 @@ class Session private constructor(private val config: Config) : AutoCloseable {
} ?: Result.failure(sessionClosedException)
}

@OptIn(Unstable::class)
private fun resolveQuerier(
keyExpr: KeyExpr,
target: QueryTarget,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Copyright (c) 2023 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.annotations

@RequiresOptIn(
level = RequiresOptIn.Level.WARNING,
message = "This feature is unstable and may change in future releases."
)
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class Unstable
2 changes: 2 additions & 0 deletions zenoh-kotlin/src/commonMain/kotlin/io/zenoh/jni/JNISession.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import io.zenoh.bytes.IntoZBytes
import io.zenoh.config.ZenohId
import io.zenoh.bytes.into
import io.zenoh.Config
import io.zenoh.annotations.Unstable
import io.zenoh.pubsub.Delete
import io.zenoh.pubsub.Publisher
import io.zenoh.pubsub.Put
Expand Down Expand Up @@ -136,6 +137,7 @@ internal class JNISession {
Queryable(keyExpr, receiver, JNIQueryable(queryableRawPtr))
}

@OptIn(Unstable::class)
fun declareQuerier(
keyExpr: KeyExpr,
target: QueryTarget,
Expand Down
2 changes: 2 additions & 0 deletions zenoh-kotlin/src/commonMain/kotlin/io/zenoh/query/Querier.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package io.zenoh.query

import io.zenoh.annotations.Unstable
import io.zenoh.bytes.Encoding
import io.zenoh.bytes.IntoZBytes
import io.zenoh.exceptions.ZError
Expand Down Expand Up @@ -48,6 +49,7 @@ import kotlinx.coroutines.channels.Channel
* ```
*
*/
@Unstable
class Querier internal constructor(val keyExpr: KeyExpr, val qos: QoS, private var jniQuerier: JNIQuerier?) :
SessionDeclaration, AutoCloseable {

Expand Down
2 changes: 2 additions & 0 deletions zenoh-kotlin/src/commonTest/kotlin/io/zenoh/QuerierTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package io.zenoh

import io.zenoh.annotations.Unstable
import io.zenoh.bytes.Encoding
import io.zenoh.bytes.ZBytes
import io.zenoh.keyexpr.KeyExpr
Expand Down Expand Up @@ -50,6 +51,7 @@ class QuerierTest {
}

/** Test validating both Queryable and get operations. */
@OptIn(Unstable::class)
@Test
fun querier_runsWithCallback() = runBlocking {
val sample = Sample(
Expand Down

0 comments on commit 08f52e9

Please sign in to comment.