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

Rename zc_owned_liveliness_get_options_t to zc_liveliness_get_options_t #290

Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Types

.. autocstruct:: zenoh_commons.h::zc_owned_liveliness_token_t
.. autocstruct:: zenoh_commons.h::zc_owned_liveliness_declaration_options_t
.. autocstruct:: zenoh_commons.h::zc_owned_liveliness_get_options_t
.. autocstruct:: zenoh_commons.h::zc_liveliness_get_options_t
.. autocstruct:: zenoh_commons.h::zc_owned_liveliness_declare_subscriber_options_t

Functions
Expand Down
19 changes: 9 additions & 10 deletions include/zenoh_commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,9 @@ typedef struct zc_owned_liveliness_token_t {
/**
* The options for :c:func:`zc_liveliness_declare_subscriber`
*/
typedef struct zc_owned_liveliness_get_options_t {
typedef struct zc_liveliness_get_options_t {
uint32_t timeout_ms;
} zc_owned_liveliness_get_options_t;
} zc_liveliness_get_options_t;
/**
* An owned payload, backed by a reference counted owner.
*
Expand Down Expand Up @@ -2320,24 +2320,23 @@ ZENOHC_API
int8_t zc_liveliness_get(struct z_session_t session,
struct z_keyexpr_t key,
struct z_owned_closure_reply_t *callback,
const struct zc_owned_liveliness_get_options_t *options);
const struct zc_liveliness_get_options_t *options);
/**
* Returns `true` if the options are valid.
*/
ZENOHC_API
bool zc_liveliness_get_options_check(const struct zc_owned_liveliness_get_options_t *_opts);
ZENOHC_API bool zc_liveliness_get_options_check(const struct zc_liveliness_get_options_t *_opts);
/**
* The gravestone value for `zc_owned_liveliness_get_options_t`
* The gravestone value for `zc_liveliness_get_options_t`
*/
ZENOHC_API struct zc_owned_liveliness_get_options_t zc_liveliness_get_options_default(void);
ZENOHC_API struct zc_liveliness_get_options_t zc_liveliness_get_options_default(void);
/**
* Destroys the options.
*/
ZENOHC_API void zc_liveliness_get_options_drop(struct zc_owned_liveliness_get_options_t *opts);
ZENOHC_API void zc_liveliness_get_options_drop(struct zc_liveliness_get_options_t *opts);
/**
* The gravestone value for `zc_owned_liveliness_get_options_t`
* The gravestone value for `zc_liveliness_get_options_t`
*/
ZENOHC_API struct zc_owned_liveliness_get_options_t zc_liveliness_get_options_null(void);
ZENOHC_API struct zc_liveliness_get_options_t zc_liveliness_get_options_null(void);
/**
* Returns `true` if the options are valid.
*/
Expand Down
22 changes: 10 additions & 12 deletions src/liveliness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,29 +197,27 @@ pub extern "C" fn zc_liveliness_declare_subscriber(

/// The options for :c:func:`zc_liveliness_declare_subscriber`
#[repr(C)]
pub struct zc_owned_liveliness_get_options_t {
pub struct zc_liveliness_get_options_t {
timeout_ms: u32,
}
/// The gravestone value for `zc_owned_liveliness_get_options_t`
/// The gravestone value for `zc_liveliness_get_options_t`
#[no_mangle]
pub extern "C" fn zc_liveliness_get_options_null() -> zc_owned_liveliness_get_options_t {
zc_owned_liveliness_get_options_t { timeout_ms: 0 }
pub extern "C" fn zc_liveliness_get_options_null() -> zc_liveliness_get_options_t {
zc_liveliness_get_options_t { timeout_ms: 0 }
}
/// The gravestone value for `zc_owned_liveliness_get_options_t`
/// The gravestone value for `zc_liveliness_get_options_t`
#[no_mangle]
pub extern "C" fn zc_liveliness_get_options_default() -> zc_owned_liveliness_get_options_t {
zc_owned_liveliness_get_options_t { timeout_ms: 10000 }
pub extern "C" fn zc_liveliness_get_options_default() -> zc_liveliness_get_options_t {
zc_liveliness_get_options_t { timeout_ms: 10000 }
}
/// Returns `true` if the options are valid.
#[no_mangle]
pub extern "C" fn zc_liveliness_get_options_check(
_opts: &zc_owned_liveliness_get_options_t,
) -> bool {
pub extern "C" fn zc_liveliness_get_options_check(_opts: &zc_liveliness_get_options_t) -> bool {
true
}
/// Destroys the options.
#[no_mangle]
pub extern "C" fn zc_liveliness_get_options_drop(opts: &mut zc_owned_liveliness_get_options_t) {
pub extern "C" fn zc_liveliness_get_options_drop(opts: &mut zc_liveliness_get_options_t) {
*opts = zc_liveliness_get_options_null()
}

Expand All @@ -233,7 +231,7 @@ pub extern "C" fn zc_liveliness_get(
session: z_session_t,
key: z_keyexpr_t,
callback: &mut z_owned_closure_reply_t,
options: Option<&zc_owned_liveliness_get_options_t>,
options: Option<&zc_liveliness_get_options_t>,
) -> i8 {
let Some(session) = session.upgrade() else {
log::error!("Failed to declare liveliness token: provided session was invalid");
Expand Down
Loading