Skip to content

Commit

Permalink
Cleanup QueryTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Feb 12, 2024
1 parent dee4df0 commit 227085d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
15 changes: 0 additions & 15 deletions commons/zenoh-protocol/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,18 +359,3 @@ pub enum CongestionControl {
impl CongestionControl {
pub const DEFAULT: Self = Self::Drop;
}

/// The `zenoh::queryable::Queryable`s that should be target of a `zenoh::Session::get()`.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum QueryTarget {
#[default]
BestMatching,
All,
AllComplete,
#[cfg(feature = "complete_n")]
Complete(u64),
}

impl QueryTarget {
pub const DEFAULT: Self = Self::BestMatching;
}
13 changes: 11 additions & 2 deletions commons/zenoh-protocol/src/network/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ pub struct Request {
pub mod ext {
use crate::{
common::{ZExtZ64, ZExtZBuf},
core::QueryTarget,
zextz64, zextzbuf,
};
use core::{num::NonZeroU32, time::Duration};
Expand All @@ -88,9 +87,19 @@ pub mod ext {
/// +---------------+
///
/// The `zenoh::queryable::Queryable`s that should be target of a `zenoh::Session::get()`.
pub type TargetType = QueryTarget;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum TargetType {
#[default]
BestMatching,
All,
AllComplete,
#[cfg(feature = "complete_n")]
Complete(u64),
}

impl TargetType {
pub const DEFAULT: Self = Self::BestMatching;

#[cfg(feature = "test")]
pub fn rand() -> Self {
use rand::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion zenoh/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use zenoh_protocol::zenoh::query::Consolidation;
use zenoh_result::ZResult;

/// The [`Queryable`](crate::queryable::Queryable)s that should be target of a [`get`](Session::get).
pub use zenoh_protocol::core::QueryTarget;
pub type QueryTarget = zenoh_protocol::network::request::ext::TargetType;

/// The kind of consolidation.
#[derive(Debug, Clone, PartialEq, Eq, Copy)]
Expand Down

0 comments on commit 227085d

Please sign in to comment.