From 2add223a305e48759a351fa00ac25e22a2892e87 Mon Sep 17 00:00:00 2001 From: Denis Biryukov Date: Thu, 12 Dec 2024 09:24:55 +0100 Subject: [PATCH] rename _settings_t -> _options_t --- docs/api.rst | 12 ++++++------ examples/z_advanced_pub.c | 8 ++++---- examples/z_advanced_sub.c | 18 +++++++++--------- include/zenoh_commons.h | 30 +++++++++++++++--------------- src/advanced_publisher.rs | 18 +++++++++--------- src/advanced_subscriber.rs | 32 ++++++++++++++++---------------- 6 files changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index f7ec63690..14b35a5b9 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -918,7 +918,7 @@ Types .. doxygenstruct:: ze_owned_advanced_publisher_t .. doxygenstruct:: ze_loaned_advanced_publisher_t -.. doxygenstruct:: ze_advanced_publisher_cache_settings_t +.. doxygenstruct:: ze_advanced_publisher_cache_options_t :members: .. doxygenstruct:: ze_advanced_publisher_options_t :members: @@ -940,7 +940,7 @@ Functions .. doxygenfunction:: ze_advanced_publisher_drop .. doxygenfunction:: ze_advanced_publisher_options_default -.. doxygenfunction:: ze_advanced_publisher_cache_settings_default +.. doxygenfunction:: ze_advanced_publisher_cache_options_default .. doxygenfunction:: ze_advanced_publisher_put_options_default .. doxygenfunction:: ze_advanced_publisher_delete_options_default @@ -956,9 +956,9 @@ Types .. doxygenstruct:: ze_owned_advanced_subscriber_t .. doxygenstruct:: ze_loaned_advanced_subscriber_t -.. doxygenstruct:: ze_advanced_subscriber_history_settings_t +.. doxygenstruct:: ze_advanced_subscriber_history_options_t :members: -.. doxygenstruct:: ze_advanced_subscriber_recovery_settings_t +.. doxygenstruct:: ze_advanced_subscriber_recovery_options_t :members: .. doxygenstruct:: ze_advanced_subscriber_options_t :members: @@ -975,8 +975,8 @@ Functions .. doxygenfunction:: ze_advanced_subscriber_drop -.. doxygenfunction:: ze_advanced_subscriber_history_settings_default -.. doxygenfunction:: ze_advanced_subscriber_recovery_settings_default +.. doxygenfunction:: ze_advanced_subscriber_history_options_default +.. doxygenfunction:: ze_advanced_subscriber_recovery_options_default .. doxygenfunction:: ze_advanced_subscriber_options_default Publication Cache (deprecated) diff --git a/examples/z_advanced_pub.c b/examples/z_advanced_pub.c index 0716e3b58..86d79bc7f 100644 --- a/examples/z_advanced_pub.c +++ b/examples/z_advanced_pub.c @@ -53,10 +53,10 @@ int main(int argc, char** argv) { ze_advanced_publisher_options_t pub_opts; ze_advanced_publisher_options_default(&pub_opts); - ze_advanced_publisher_cache_settings_t cache_settings; - ze_advanced_publisher_cache_settings_default(&cache_settings); - cache_settings.max_samples = args.history; - pub_opts.cache = &cache_settings; + ze_advanced_publisher_cache_options_t cache_options; + ze_advanced_publisher_cache_options_default(&cache_options); + cache_options.max_samples = args.history; + pub_opts.cache = &cache_options; pub_opts.publisher_detection = true; pub_opts.sample_miss_detection = true; diff --git a/examples/z_advanced_sub.c b/examples/z_advanced_sub.c index c3df8fd40..075978a5d 100644 --- a/examples/z_advanced_sub.c +++ b/examples/z_advanced_sub.c @@ -65,15 +65,15 @@ int main(int argc, char** argv) { ze_advanced_subscriber_options_t sub_opts; ze_advanced_subscriber_options_default(&sub_opts); - ze_advanced_subscriber_history_settings_t sub_history_settings; - ze_advanced_subscriber_history_settings_default(&sub_history_settings); - sub_history_settings.detect_late_publishers = true; - - ze_advanced_subscriber_recovery_settings_t sub_recovery_settings; - ze_advanced_subscriber_recovery_settings_default(&sub_recovery_settings); - sub_recovery_settings.periodic_queries_period_ms = 1000; - sub_opts.history = &sub_history_settings; - sub_opts.recovery = &sub_recovery_settings; + ze_advanced_subscriber_history_options_t sub_history_options; + ze_advanced_subscriber_history_options_default(&sub_history_options); + sub_history_options.detect_late_publishers = true; + + ze_advanced_subscriber_recovery_options_t sub_recovery_options; + ze_advanced_subscriber_recovery_options_default(&sub_recovery_options); + sub_recovery_options.periodic_queries_period_ms = 1000; + sub_opts.history = &sub_history_options; + sub_opts.recovery = &sub_recovery_options; sub_opts.subscriber_detection = true; z_owned_closure_sample_t callback; diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 79b418822..881a808cf 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -1007,7 +1007,7 @@ typedef struct zc_moved_shm_client_list_t { * @brief Setting for advanced publisher's cache. The cache allows advanced subscribers to recover history and/or lost samples. */ #if defined(Z_FEATURE_UNSTABLE_API) -typedef struct ze_advanced_publisher_cache_settings_t { +typedef struct ze_advanced_publisher_cache_options_t { /** * Number of samples to keep for each resource */ @@ -1024,7 +1024,7 @@ typedef struct ze_advanced_publisher_cache_settings_t { * If true, Zenoh will not wait to batch the cache replies with other messages to reduce the bandwith. */ bool is_express; -} ze_advanced_publisher_cache_settings_t; +} ze_advanced_publisher_cache_options_t; #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1055,7 +1055,7 @@ typedef struct ze_advanced_publisher_options_t { /** * Optional settings for publisher cache. */ - struct ze_advanced_publisher_cache_settings_t *cache; + struct ze_advanced_publisher_cache_options_t *cache; /** * Allow matching Subscribers to detect lost samples and optionally ask for retransimission. * @@ -1141,7 +1141,7 @@ typedef struct ze_moved_advanced_subscriber_t { * @brief Settings for retrievieng historical data for Advanced Subscriber. */ #if defined(Z_FEATURE_UNSTABLE_API) -typedef struct ze_advanced_subscriber_history_settings_t { +typedef struct ze_advanced_subscriber_history_options_t { /** * Enable detection of late joiner publishers and query for their historical data. * Late joiner detection can only be achieved for Publishers that enable publisher_detection. @@ -1156,14 +1156,14 @@ typedef struct ze_advanced_subscriber_history_settings_t { * Maximum age of samples to query. ``0`` corresponds to no limit on samples' age. */ uint64_t max_age_ms; -} ze_advanced_subscriber_history_settings_t; +} ze_advanced_subscriber_history_options_t; #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Settings for recovering lost messages for Advanced Subscriber. */ #if defined(Z_FEATURE_UNSTABLE_API) -typedef struct ze_advanced_subscriber_recovery_settings_t { +typedef struct ze_advanced_subscriber_recovery_options_t { /** * Period for queries for not yet received Samples. * @@ -1173,7 +1173,7 @@ typedef struct ze_advanced_subscriber_recovery_settings_t { * Retransmission can only be achieved by Publishers that also activate retransmission. */ uint64_t periodic_queries_period_ms; -} ze_advanced_subscriber_recovery_settings_t; +} ze_advanced_subscriber_recovery_options_t; #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -1189,13 +1189,13 @@ typedef struct ze_advanced_subscriber_options_t { * Optional settings for querying historical data. History can only be retransmitted by Publishers that enable caching. * Querying historical data is disabled if the value is ``NULL``. */ - struct ze_advanced_subscriber_history_settings_t *history; + struct ze_advanced_subscriber_history_options_t *history; /** * Optional settings for retransmission of detected lost Samples. Retransmission of lost samples can only be done by Publishers that enable * caching and sample_miss_detection. * Retransmission is disabled if the value is ``NULL``. */ - struct ze_advanced_subscriber_recovery_settings_t *recovery; + struct ze_advanced_subscriber_recovery_options_t *recovery; /** * Timeout to be used for history and recovery queries. * Default value will be used if set to ``0``. @@ -5406,11 +5406,11 @@ z_result_t zc_undeclare_matching_listener(struct zc_moved_matching_listener_t *t #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Constructs the default value for `ze_advanced_publisher_cache_settings_t`. + * @brief Constructs the default value for `ze_advanced_publisher_cache_options_t`. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void ze_advanced_publisher_cache_settings_default(struct ze_advanced_publisher_cache_settings_t *this_); +void ze_advanced_publisher_cache_options_default(struct ze_advanced_publisher_cache_options_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -5622,11 +5622,11 @@ void ze_advanced_subscriber_drop(struct ze_moved_advanced_subscriber_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 the default value for `ze_advanced_subscriber_history_settings_t`. + * @brief Constructs the default value for `ze_advanced_subscriber_history_options_t`. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void ze_advanced_subscriber_history_settings_default(struct ze_advanced_subscriber_history_settings_t *this_); +void ze_advanced_subscriber_history_options_default(struct ze_advanced_subscriber_history_options_t *this_); #endif /** * Borrows subscriber. @@ -5645,11 +5645,11 @@ void ze_advanced_subscriber_options_default(struct ze_advanced_subscriber_option #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Constructs the default value for `ze_advanced_subscriber_recovery_settings_t`. + * @brief Constructs the default value for `ze_advanced_subscriber_recovery_options_t`. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API -void ze_advanced_subscriber_recovery_settings_default(struct ze_advanced_subscriber_recovery_settings_t *this_); +void ze_advanced_subscriber_recovery_options_default(struct ze_advanced_subscriber_recovery_options_t *this_); #endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. diff --git a/src/advanced_publisher.rs b/src/advanced_publisher.rs index 950068870..c1e81c827 100644 --- a/src/advanced_publisher.rs +++ b/src/advanced_publisher.rs @@ -36,7 +36,7 @@ use crate::{ /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief Setting for advanced publisher's cache. The cache allows advanced subscribers to recover history and/or lost samples. #[repr(C)] -pub struct ze_advanced_publisher_cache_settings_t { +pub struct ze_advanced_publisher_cache_options_t { /// Number of samples to keep for each resource pub max_samples: usize, /// The congestion control to apply to replies. @@ -47,7 +47,7 @@ pub struct ze_advanced_publisher_cache_settings_t { pub is_express: bool, } -impl Default for ze_advanced_publisher_cache_settings_t { +impl Default for ze_advanced_publisher_cache_options_t { fn default() -> Self { Self { max_samples: 1, @@ -59,16 +59,16 @@ impl Default for ze_advanced_publisher_cache_settings_t { } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief Constructs the default value for `ze_advanced_publisher_cache_settings_t`. +/// @brief Constructs the default value for `ze_advanced_publisher_cache_options_t`. #[no_mangle] -pub extern "C" fn ze_advanced_publisher_cache_settings_default( - this: &mut MaybeUninit, +pub extern "C" fn ze_advanced_publisher_cache_options_default( + this: &mut MaybeUninit, ) { - this.write(ze_advanced_publisher_cache_settings_t::default()); + this.write(ze_advanced_publisher_cache_options_t::default()); } -impl From<&ze_advanced_publisher_cache_settings_t> for CacheConfig { - fn from(val: &ze_advanced_publisher_cache_settings_t) -> CacheConfig { +impl From<&ze_advanced_publisher_cache_options_t> for CacheConfig { + fn from(val: &ze_advanced_publisher_cache_options_t) -> CacheConfig { let mut c = CacheConfig::default(); c = c.max_samples(val.max_samples); let qos = zenoh_ext::RepliesConfig::default() @@ -87,7 +87,7 @@ pub struct ze_advanced_publisher_options_t { /// Base publisher options. pub publisher_options: z_publisher_options_t, /// Optional settings for publisher cache. - pub cache: Option<&'static mut ze_advanced_publisher_cache_settings_t>, + pub cache: Option<&'static mut ze_advanced_publisher_cache_options_t>, /// Allow matching Subscribers to detect lost samples and optionally ask for retransimission. /// /// Retransmission can only be done if history is enabled on subscriber side. diff --git a/src/advanced_subscriber.rs b/src/advanced_subscriber.rs index 5bf005602..8ae603bc6 100644 --- a/src/advanced_subscriber.rs +++ b/src/advanced_subscriber.rs @@ -32,7 +32,7 @@ use crate::{ /// @brief Settings for retrievieng historical data for Advanced Subscriber. #[repr(C)] #[derive(Default)] -pub struct ze_advanced_subscriber_history_settings_t { +pub struct ze_advanced_subscriber_history_options_t { /// Enable detection of late joiner publishers and query for their historical data. /// Late joiner detection can only be achieved for Publishers that enable publisher_detection. /// History can only be retransmitted by Publishers that enable caching. @@ -44,16 +44,16 @@ pub struct ze_advanced_subscriber_history_settings_t { } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief Constructs the default value for `ze_advanced_subscriber_history_settings_t`. +/// @brief Constructs the default value for `ze_advanced_subscriber_history_options_t`. #[no_mangle] -pub extern "C" fn ze_advanced_subscriber_history_settings_default( - this: &mut MaybeUninit, +pub extern "C" fn ze_advanced_subscriber_history_options_default( + this: &mut MaybeUninit, ) { - this.write(ze_advanced_subscriber_history_settings_t::default()); + this.write(ze_advanced_subscriber_history_options_t::default()); } -impl From<&ze_advanced_subscriber_history_settings_t> for HistoryConfig { - fn from(val: &ze_advanced_subscriber_history_settings_t) -> Self { +impl From<&ze_advanced_subscriber_history_options_t> for HistoryConfig { + fn from(val: &ze_advanced_subscriber_history_options_t) -> Self { let mut h = HistoryConfig::default(); if val.detect_late_publishers { h = h.detect_late_publishers(); @@ -72,7 +72,7 @@ impl From<&ze_advanced_subscriber_history_settings_t> for HistoryConfig { /// @brief Settings for recovering lost messages for Advanced Subscriber. #[repr(C)] #[derive(Default)] -pub struct ze_advanced_subscriber_recovery_settings_t { +pub struct ze_advanced_subscriber_recovery_options_t { /// Period for queries for not yet received Samples. /// /// These queries allow to retrieve the last Sample(s) if the last Sample(s) is/are lost. @@ -82,8 +82,8 @@ pub struct ze_advanced_subscriber_recovery_settings_t { pub periodic_queries_period_ms: u64, } -impl From<&ze_advanced_subscriber_recovery_settings_t> for RecoveryConfig { - fn from(val: &ze_advanced_subscriber_recovery_settings_t) -> RecoveryConfig { +impl From<&ze_advanced_subscriber_recovery_options_t> for RecoveryConfig { + fn from(val: &ze_advanced_subscriber_recovery_options_t) -> RecoveryConfig { let mut r = RecoveryConfig::default(); if val.periodic_queries_period_ms > 0 { r = r.periodic_queries(Some(Duration::from_millis(val.periodic_queries_period_ms))); @@ -93,12 +93,12 @@ impl From<&ze_advanced_subscriber_recovery_settings_t> for RecoveryConfig { } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief Constructs the default value for `ze_advanced_subscriber_recovery_settings_t`. +/// @brief Constructs the default value for `ze_advanced_subscriber_recovery_options_t`. #[no_mangle] -pub extern "C" fn ze_advanced_subscriber_recovery_settings_default( - this: &mut MaybeUninit, +pub extern "C" fn ze_advanced_subscriber_recovery_options_default( + this: &mut MaybeUninit, ) { - this.write(ze_advanced_subscriber_recovery_settings_t::default()); + this.write(ze_advanced_subscriber_recovery_options_t::default()); } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. @@ -109,11 +109,11 @@ pub struct ze_advanced_subscriber_options_t { pub subscriber_options: z_subscriber_options_t, /// Optional settings for querying historical data. History can only be retransmitted by Publishers that enable caching. /// Querying historical data is disabled if the value is ``NULL``. - pub history: Option<&'static mut ze_advanced_subscriber_history_settings_t>, + pub history: Option<&'static mut ze_advanced_subscriber_history_options_t>, /// Optional settings for retransmission of detected lost Samples. Retransmission of lost samples can only be done by Publishers that enable /// caching and sample_miss_detection. /// Retransmission is disabled if the value is ``NULL``. - pub recovery: Option<&'static mut ze_advanced_subscriber_recovery_settings_t>, + pub recovery: Option<&'static mut ze_advanced_subscriber_recovery_options_t>, /// Timeout to be used for history and recovery queries. /// Default value will be used if set to ``0``. pub query_timeout_ms: u64,