Skip to content

Commit

Permalink
rename _settings_t -> _options_t
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Dec 12, 2024
1 parent 9b1fea2 commit 2add223
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 59 deletions.
12 changes: 6 additions & 6 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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:
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions examples/z_advanced_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
18 changes: 9 additions & 9 deletions examples/z_advanced_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 15 additions & 15 deletions include/zenoh_commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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.
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
Expand All @@ -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.
*
Expand All @@ -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.
Expand All @@ -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``.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions src/advanced_publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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,
Expand All @@ -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<ze_advanced_publisher_cache_settings_t>,
pub extern "C" fn ze_advanced_publisher_cache_options_default(
this: &mut MaybeUninit<ze_advanced_publisher_cache_options_t>,
) {
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()
Expand All @@ -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.
Expand Down
32 changes: 16 additions & 16 deletions src/advanced_subscriber.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<ze_advanced_subscriber_history_settings_t>,
pub extern "C" fn ze_advanced_subscriber_history_options_default(
this: &mut MaybeUninit<ze_advanced_subscriber_history_options_t>,
) {
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();
Expand All @@ -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.
Expand All @@ -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)));
Expand All @@ -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<ze_advanced_subscriber_recovery_settings_t>,
pub extern "C" fn ze_advanced_subscriber_recovery_options_default(
this: &mut MaybeUninit<ze_advanced_subscriber_recovery_options_t>,
) {
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.
Expand All @@ -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,
Expand Down

0 comments on commit 2add223

Please sign in to comment.