Skip to content

Commit

Permalink
Reorder API methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc committed Sep 9, 2024
1 parent 5493dd5 commit 2c8c05f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
32 changes: 16 additions & 16 deletions include/zenoh-pico/api/liveliness.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ typedef struct z_liveliness_get_options_t {
} z_liveliness_get_options_t;

/**
* Constructs default value for `z_liveliness_declaration_options_t`.
* Constucts default value for `z_liveliness_declare_subscriber_options_t`.
*/
int8_t z_liveliness_declaration_options_default(z_liveliness_declaration_options_t *options);
int8_t z_liveliness_subscriber_options_default(z_liveliness_subscriber_options_t *options);

/**
* Declares a subscriber on liveliness tokens that intersect `key_expr`.
Expand All @@ -67,6 +67,11 @@ int8_t z_liveliness_declaration_options_default(z_liveliness_declaration_options
int8_t z_liveliness_declare_subscriber(z_owned_subscriber_t *token, const z_loaned_session_t *session,
const z_loaned_keyexpr_t *key_expr, z_moved_closure_sample_t *callback,
z_liveliness_subscriber_options_t *_options);
/**
* Constructs default value for `z_liveliness_declaration_options_t`.
*/
int8_t z_liveliness_declaration_options_default(z_liveliness_declaration_options_t *options);

/**
* Constructs and declares a liveliness token on the network.
*
Expand All @@ -82,6 +87,11 @@ int8_t z_liveliness_declare_token(z_owned_liveliness_token_t *token, const z_loa
const z_loaned_keyexpr_t *key_expr,
const z_liveliness_declaration_options_t *_options);

/**
* Constructs default value `z_liveliness_get_options_t`.
*/
int8_t z_liveliness_get_options_default(z_liveliness_get_options_t *options);

/**
* Queries liveliness tokens currently on the network with a key expression intersecting with `key_expr`.
*
Expand All @@ -93,29 +103,19 @@ int8_t z_liveliness_declare_token(z_owned_liveliness_token_t *token, const z_loa
int8_t z_liveliness_get(const z_loaned_session_t *session, const z_loaned_keyexpr_t *key_expr,
z_moved_closure_reply_t *callback, z_liveliness_get_options_t *options);

/**
* Constructs default value `z_liveliness_get_options_t`.
*/
int8_t z_liveliness_get_options_default(z_liveliness_get_options_t *options);

/**
* Constucts default value for `z_liveliness_declare_subscriber_options_t`.
*/
int8_t z_liveliness_subscriber_options_default(z_liveliness_subscriber_options_t *options);

/**
* Undeclares liveliness token, frees memory and resets it to a gravestone state.
*/
int8_t z_liveliness_token_drop(z_moved_liveliness_token_t *token);

/**
* Borrows token.
* Destroys a liveliness token, notifying subscribers of its destruction.
*/
const z_loaned_liveliness_token_t *z_liveliness_token_loan(const z_owned_liveliness_token_t *token);

int8_t z_liveliness_undeclare_token(z_moved_liveliness_token_t *token);
/**
* Destroys a liveliness token, notifying subscribers of its destruction.
* Borrows token.
*/
int8_t z_liveliness_undeclare_token(z_moved_liveliness_token_t *token);
const z_loaned_liveliness_token_t *z_liveliness_token_loan(const z_owned_liveliness_token_t *token);

#endif // INCLUDE_ZENOH_PICO_API_LIVELINESS_H
24 changes: 12 additions & 12 deletions src/api/liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
//

#include "zenoh-pico/api/liveliness.h"

#include "zenoh-pico/utils/result.h"

int8_t z_liveliness_declaration_options_default(z_liveliness_declaration_options_t *options) {
int8_t z_liveliness_subscriber_options_default(z_liveliness_subscriber_options_t *options) {
options->__dummy = 0;
return _Z_RES_OK;
}
Expand All @@ -32,6 +31,12 @@ int8_t z_liveliness_declare_subscriber(z_owned_subscriber_t *token, const z_loan
(void)_options;
return _Z_RES_OK;
}

int8_t z_liveliness_declaration_options_default(z_liveliness_declaration_options_t *options) {
options->__dummy = 0;
return _Z_RES_OK;
}

int8_t z_liveliness_declare_token(z_owned_liveliness_token_t *token, const z_loaned_session_t *session,
const z_loaned_keyexpr_t *key_expr,
const z_liveliness_declaration_options_t *_options) {
Expand All @@ -43,6 +48,11 @@ int8_t z_liveliness_declare_token(z_owned_liveliness_token_t *token, const z_loa
return _Z_RES_OK;
}

int8_t z_liveliness_get_options_default(z_liveliness_get_options_t *options) {
options->timeout_ms = 0; // TODO(sashacmc): correct value;
return _Z_RES_OK;
}

int8_t z_liveliness_get(const z_loaned_session_t *session, const z_loaned_keyexpr_t *key_expr,
z_moved_closure_reply_t *callback, z_liveliness_get_options_t *options) {
// TODO(sashacmc): Implement
Expand All @@ -53,16 +63,6 @@ int8_t z_liveliness_get(const z_loaned_session_t *session, const z_loaned_keyexp
return _Z_RES_OK;
}

int8_t z_liveliness_get_options_default(z_liveliness_get_options_t *options) {
options->timeout_ms = 0; // TODO(sashacmc): correct value;
return _Z_RES_OK;
}

int8_t z_liveliness_subscriber_options_default(z_liveliness_subscriber_options_t *options) {
options->__dummy = 0;
return _Z_RES_OK;
}

int8_t z_liveliness_token_drop(z_moved_liveliness_token_t *token) {
// TODO(sashacmc): Implement
(void)token;
Expand Down

0 comments on commit 2c8c05f

Please sign in to comment.