diff --git a/build-resources/opaque-types/src/lib.rs b/build-resources/opaque-types/src/lib.rs index 10c90db9e..29c81353b 100644 --- a/build-resources/opaque-types/src/lib.rs +++ b/build-resources/opaque-types/src/lib.rs @@ -228,10 +228,10 @@ get_opaque_type_data!(Subscriber<()>, z_loaned_subscriber_t); /// expressions. /// /// A DELETE on the token's key expression will be received by subscribers if the token is destroyed, or if connectivity between the subscriber and the token's creator is lost. -get_opaque_type_data!(Option, zc_owned_liveliness_token_t); +get_opaque_type_data!(Option, z_owned_liveliness_token_t); #[cfg(feature = "unstable")] /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -get_opaque_type_data!(LivelinessToken, zc_loaned_liveliness_token_t); +get_opaque_type_data!(LivelinessToken, z_loaned_liveliness_token_t); #[cfg(feature = "unstable")] /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief An owned Zenoh publication cache. diff --git a/docs/api.rst b/docs/api.rst index 31c711a34..92b41c189 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -815,7 +815,7 @@ Liveliness Types ----- -.. doxygenstruct:: zc_owned_liveliness_token_t +.. doxygenstruct:: z_owned_liveliness_token_t .. doxygenstruct:: z_liveliness_token_options_t .. doxygenstruct:: z_liveliness_get_options_t .. doxygenstruct:: z_liveliness_subscriber_options_t diff --git a/examples/z_liveliness.c b/examples/z_liveliness.c index 73316b20c..662b8fe7f 100644 --- a/examples/z_liveliness.c +++ b/examples/z_liveliness.c @@ -44,7 +44,7 @@ int main(int argc, char** argv) { } printf("Declaring liveliness token '%s'...\n", args.keyexpr); - zc_owned_liveliness_token_t token; + z_owned_liveliness_token_t token; if (z_liveliness_declare_token(z_loan(s), &token, z_loan(keyexpr), NULL) < 0) { printf("Unable to create liveliness token!\n"); exit(-1); diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 24a0a680d..726422f6d 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -2763,6 +2763,22 @@ ZENOHC_API bool z_internal_keyexpr_check(const struct z_owned_keyexpr_t *this_); * Constructs an owned key expression in a gravestone state. */ ZENOHC_API void z_internal_keyexpr_null(struct z_owned_keyexpr_t *this_); +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Returns ``true`` if liveliness token is valid, ``false`` otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +bool z_internal_liveliness_token_check(const z_owned_liveliness_token_t *this_); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Constructs liveliness token in its gravestone state. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +void z_internal_liveliness_token_null(z_owned_liveliness_token_t *this_); +#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Returns ``true`` if `this` is valid. @@ -3178,7 +3194,7 @@ z_result_t z_liveliness_declare_subscriber(const struct z_loaned_session_t *sess #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API z_result_t z_liveliness_declare_token(const struct z_loaned_session_t *session, - zc_owned_liveliness_token_t *token, + z_owned_liveliness_token_t *token, const struct z_loaned_keyexpr_t *key_expr, const struct z_liveliness_token_options_t *_options); #endif @@ -3220,7 +3236,7 @@ void z_liveliness_subscriber_options_default(struct z_liveliness_subscriber_opti */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void z_liveliness_token_drop(zc_moved_liveliness_token_t *this_); +void z_liveliness_token_drop(z_moved_liveliness_token_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3228,7 +3244,7 @@ void z_liveliness_token_drop(zc_moved_liveliness_token_t *this_); */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -const zc_loaned_liveliness_token_t *z_liveliness_token_loan(const zc_owned_liveliness_token_t *this_); +const z_loaned_liveliness_token_t *z_liveliness_token_loan(const z_owned_liveliness_token_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -3244,7 +3260,7 @@ void z_liveliness_token_options_default(struct z_liveliness_token_options_t *thi */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -z_result_t z_liveliness_undeclare_token(zc_moved_liveliness_token_t *this_); +z_result_t z_liveliness_undeclare_token(z_moved_liveliness_token_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -4946,22 +4962,6 @@ bool zc_internal_closure_matching_status_check(const struct zc_owned_closure_mat ZENOHC_API void zc_internal_closure_matching_status_null(struct zc_owned_closure_matching_status_t *this_); #endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Returns ``true`` if liveliness token is valid, ``false`` otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -bool zc_internal_liveliness_token_check(const zc_owned_liveliness_token_t *this_); -#endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Constructs liveliness token in its gravestone state. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -void zc_internal_liveliness_token_null(zc_owned_liveliness_token_t *this_); -#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Checks the matching listener is for the gravestone state diff --git a/splitguide.yaml b/splitguide.yaml index ae3d53895..f8f2fe53a 100644 --- a/splitguide.yaml +++ b/splitguide.yaml @@ -54,8 +54,8 @@ zenoh_opaque.h: - zc_owned_matching_listener_t!#unstable - z_owned_subscriber_t! - z_loaned_subscriber_t! - - zc_owned_liveliness_token_t!#unstable - - zc_loaned_liveliness_token_t!#unstable + - z_owned_liveliness_token_t!#unstable + - z_loaned_liveliness_token_t!#unstable - ze_owned_publication_cache_t!#unstable - z_owned_mutex_t! - z_loaned_mutex_t! diff --git a/src/liveliness.rs b/src/liveliness.rs index 7f75bfdb1..bfc1b2040 100644 --- a/src/liveliness.rs +++ b/src/liveliness.rs @@ -22,23 +22,23 @@ use zenoh::{ }; use crate::{ - opaque_types::{zc_loaned_liveliness_token_t, zc_owned_liveliness_token_t}, + opaque_types::{z_loaned_liveliness_token_t, z_owned_liveliness_token_t}, result, transmute::{LoanedCTypeRef, RustTypeRef, RustTypeRefUninit, TakeRustType}, z_closure_reply_call, z_closure_reply_loan, z_closure_sample_call, z_closure_sample_loan, z_loaned_keyexpr_t, z_loaned_session_t, z_moved_closure_reply_t, z_moved_closure_sample_t, - z_owned_subscriber_t, zc_moved_liveliness_token_t, + z_owned_subscriber_t, z_moved_liveliness_token_t, }; decl_c_type!( - owned(zc_owned_liveliness_token_t, option LivelinessToken), - loaned(zc_loaned_liveliness_token_t), + owned(z_owned_liveliness_token_t, option LivelinessToken), + loaned(z_loaned_liveliness_token_t), ); /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Constructs liveliness token in its gravestone state. #[no_mangle] -pub extern "C" fn zc_internal_liveliness_token_null( - this_: &mut MaybeUninit, +pub extern "C" fn z_internal_liveliness_token_null( + this_: &mut MaybeUninit, ) { this_.as_rust_type_mut_uninit().write(None); } @@ -46,14 +46,14 @@ pub extern "C" fn zc_internal_liveliness_token_null( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Returns ``true`` if liveliness token is valid, ``false`` otherwise. #[no_mangle] -pub extern "C" fn zc_internal_liveliness_token_check(this_: &zc_owned_liveliness_token_t) -> bool { +pub extern "C" fn z_internal_liveliness_token_check(this_: &z_owned_liveliness_token_t) -> bool { this_.as_rust_type_ref().is_some() } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Undeclares liveliness token, frees memory and resets it to a gravestone state. #[no_mangle] -pub extern "C" fn z_liveliness_token_drop(this_: &mut zc_moved_liveliness_token_t) { +pub extern "C" fn z_liveliness_token_drop(this_: &mut z_moved_liveliness_token_t) { let _ = this_.take_rust_type(); } @@ -78,8 +78,8 @@ pub extern "C" fn z_liveliness_token_options_default( #[no_mangle] #[allow(clippy::missing_safety_doc)] pub unsafe extern "C" fn z_liveliness_token_loan( - this: &zc_owned_liveliness_token_t, -) -> &zc_loaned_liveliness_token_t { + this: &z_owned_liveliness_token_t, +) -> &z_loaned_liveliness_token_t { this.as_rust_type_ref() .as_ref() .unwrap_unchecked() @@ -99,7 +99,7 @@ pub unsafe extern "C" fn z_liveliness_token_loan( #[no_mangle] pub extern "C" fn z_liveliness_declare_token( session: &z_loaned_session_t, - token: &mut MaybeUninit, + token: &mut MaybeUninit, key_expr: &z_loaned_keyexpr_t, _options: Option<&z_liveliness_token_options_t>, ) -> result::z_result_t { @@ -123,7 +123,7 @@ pub extern "C" fn z_liveliness_declare_token( /// @brief Destroys a liveliness token, notifying subscribers of its destruction. #[no_mangle] pub extern "C" fn z_liveliness_undeclare_token( - this: &mut zc_moved_liveliness_token_t, + this: &mut z_moved_liveliness_token_t, ) -> result::z_result_t { if let Some(token) = this.take_rust_type() { if let Err(e) = token.undeclare().wait() { diff --git a/tests/z_api_liveliness.c b/tests/z_api_liveliness.c index bf2f77814..7a179efc9 100644 --- a/tests/z_api_liveliness.c +++ b/tests/z_api_liveliness.c @@ -74,7 +74,7 @@ void test_liveliness_sub() { z_liveliness_declare_subscriber(z_loan(s2), &sub, z_loan(k), z_move(closure), NULL); z_sleep_s(1); - zc_owned_liveliness_token_t t1, t2; + z_owned_liveliness_token_t t1, t2; z_liveliness_declare_token(z_loan(s1), &t1, z_loan(k1), NULL); z_liveliness_declare_token(z_loan(s1), &t2, z_loan(k2), NULL); @@ -109,7 +109,7 @@ void test_liveliness_get() { z_open(&s2, z_move(c2), NULL); z_sleep_s(1); - zc_owned_liveliness_token_t t1; + z_owned_liveliness_token_t t1; z_liveliness_declare_token(z_loan(s1), &t1, z_loan(k1), NULL); z_sleep_s(1);