Skip to content
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

adding complete option to publication_cache #243

Merged
merged 10 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ target

# vscode
.vscode
out

# IntelliJ / CLion
.idea
Expand Down
78 changes: 51 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ log = "0.4.17"
rand = "0.8.5"
spin = "0.9.5"
# shared-memory enabled for zenoh even if zenoh-c "shared-memory" feature is disabled. This is to make "std::mem::transmute" work for `ZSLice`
zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false }
zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] }
zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] }
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false }
Mallets marked this conversation as resolved.
Show resolved Hide resolved
zenoh-protocol = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] }
zenoh-util = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
zenoh-ext = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] }

[build-dependencies]
cbindgen = "0.24.3"
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ log = "0.4.17"
rand = "0.8.5"
spin = "0.9.5"
# shared-memory enabled for zenoh even if zenoh-c "shared-memory" feature is disabled. This is to make "std::mem::transmute" work for `ZSLice`
zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [ "shared-memory", "unstable" ], default-features = false }
Mallets marked this conversation as resolved.
Show resolved Hide resolved
zenoh-protocol = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [ "shared-memory" ] }
zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [ "unstable" ]}
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory", "unstable"], default-features = false }
zenoh-protocol = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["shared-memory"] }
zenoh-util = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
zenoh-ext = { git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = ["unstable"] }

[build-dependencies]
cbindgen = "0.24.3"
Expand Down
1 change: 1 addition & 0 deletions examples/z_pub_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ int main(int argc, char **argv) {

ze_publication_cache_options_t pub_cache_opts = ze_publication_cache_options_default();
pub_cache_opts.history = 42;
pub_cache_opts.queryable_complete = false;

printf("Declaring publication cache on '%s'...\n", keyexpr);
ze_owned_publication_cache_t pub_cache =
Expand Down
2 changes: 2 additions & 0 deletions include/zenoh_commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -905,12 +905,14 @@ typedef struct ze_owned_publication_cache_t {
* z_keyexpr_t queryable_prefix: The prefix used for queryable
* zcu_locality_t queryable_origin: The restriction for the matching queries that will be receive by this
* publication cache
* bool queryable_complete: the `complete` option for the queryable
* size_t history: The the history size
* size_t resources_limit: The limit number of cached resources
*/
typedef struct ze_publication_cache_options_t {
struct z_keyexpr_t queryable_prefix;
enum zcu_locality_t queryable_origin;
bool queryable_complete;
size_t history;
size_t resources_limit;
} ze_publication_cache_options_t;
Expand Down
3 changes: 2 additions & 1 deletion src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
// ZettaScale Zenoh team, <[email protected]>
//
use crate::{session::*, z_closure_zid_call, z_owned_closure_zid_t};
use zenoh::prelude::sync::SyncResolve;
use zenoh::SessionDeclarations;
use zenoh_protocol::core::ZenohId;
use zenoh_util::core::SyncResolve;
Mallets marked this conversation as resolved.
Show resolved Hide resolved

/// Represents a Zenoh ID.
///
Expand Down
4 changes: 4 additions & 0 deletions src/publication_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ use crate::{
/// z_keyexpr_t queryable_prefix: The prefix used for queryable
/// zcu_locality_t queryable_origin: The restriction for the matching queries that will be receive by this
/// publication cache
/// bool queryable_complete: the `complete` option for the queryable
/// size_t history: The the history size
/// size_t resources_limit: The limit number of cached resources
#[repr(C)]
pub struct ze_publication_cache_options_t {
pub queryable_prefix: z_keyexpr_t,
pub queryable_origin: zcu_locality_t,
pub queryable_complete: bool,
pub history: usize,
pub resources_limit: usize,
}
Expand All @@ -45,6 +47,7 @@ pub extern "C" fn ze_publication_cache_options_default() -> ze_publication_cache
ze_publication_cache_options_t {
queryable_prefix: z_keyexpr_t::null(),
queryable_origin: zcu_locality_default(),
queryable_complete: false,
history: 1,
resources_limit: 0,
}
Expand Down Expand Up @@ -133,6 +136,7 @@ pub extern "C" fn ze_declare_publication_cache(
if let Some(options) = options {
p = p.history(options.history);
p = p.queryable_allowed_origin(options.queryable_origin.into());
p = p.queryable_complete(options.queryable_complete);
if options.resources_limit != 0 {
p = p.resources_limit(options.resources_limit)
}
Expand Down
Loading