diff --git a/docs/api.rst b/docs/api.rst index 6b25fbb0a..fccf34209 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -563,7 +563,7 @@ Functions .. doxygenfunction:: z_put .. doxygenfunction:: z_delete -.. doxygenfunction:: z_declare_publisher +.. doxygenfunction:: z_publisher_declare .. doxygenfunction:: z_publisher_put .. doxygenfunction:: z_publisher_delete .. doxygenfunction:: z_publisher_keyexpr @@ -613,8 +613,8 @@ Types Functions --------- -.. doxygenfunction:: z_declare_subscriber -.. doxygenfunction:: z_declare_background_subscriber +.. doxygenfunction:: z_subscriber_declare +.. doxygenfunction:: z_subscriber_declare_background .. doxygenfunction:: z_subscriber_keyexpr .. doxygenfunction:: z_subscriber_drop @@ -670,7 +670,7 @@ Types Functions --------- .. doxygenfunction:: z_declare_queryable -.. doxygenfunction:: z_declare_background_queryable +.. doxygenfunction:: z_queryable_declare_background .. doxygenfunction:: z_queryable_id .. doxygenfunction:: z_queryable_options_default @@ -816,8 +816,8 @@ Types Functions --------- -.. doxygenfunction:: zc_liveliness_declare_subscriber -.. doxygenfunction:: zc_liveliness_declare_background_subscriber +.. doxygenfunction:: zc_liveliness_subscriber_declare +.. doxygenfunction:: zc_liveliness_subscriber_declare_background .. doxygenfunction:: zc_liveliness_get .. doxygenfunction:: zc_liveliness_declare_token @@ -844,7 +844,7 @@ Types Functions --------- -.. doxygenfunction:: ze_declare_publication_cache +.. doxygenfunction:: ze_publication_cache_declare .. doxygenfunction:: ze_publication_cache_drop .. doxygenfunction:: ze_publication_cache_loan @@ -867,8 +867,8 @@ Types Functions --------- -.. doxygenfunction:: ze_declare_querying_subscriber -.. doxygenfunction:: ze_declare_background_querying_subscriber +.. doxygenfunction:: ze_querying_subscriber_declare +.. doxygenfunction:: ze_querying_subscriber_declare_background .. doxygenfunction:: ze_querying_subscriber_get .. doxygenfunction:: ze_querying_subscriber_drop diff --git a/docs/examples.rst b/docs/examples.rst index dd642fcb7..ac9bb875b 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -81,7 +81,7 @@ Subscribe z_view_keyexpr_from_string(&key_expr, "key/expression"); z_owned_subscriber_t sub; - if (z_declare_subscriber(&sub, z_loan(s), z_loan(key_expr) z_move(callback), NULL) != 0) { + if (z_subscriber_declare(&sub, z_loan(s), z_loan(key_expr) z_move(callback), NULL) != 0) { printf("Unable to create Zenoh subscriber.\n"); z_drop(z_move(s)); exit(-1); diff --git a/examples/z_ping.c b/examples/z_ping.c index bf703077b..77e867054 100644 --- a/examples/z_ping.c +++ b/examples/z_ping.c @@ -46,11 +46,11 @@ int main(int argc, char** argv) { z_view_keyexpr_t pong; z_view_keyexpr_from_str_unchecked(&pong, "test/pong"); z_owned_publisher_t pub; - z_declare_publisher(&pub, z_loan(session), z_loan(ping), NULL); + z_publisher_declare(&pub, z_loan(session), z_loan(ping), NULL); z_owned_closure_sample_t respond; z_closure(&respond, callback, drop, (void*)(&pub)); z_owned_subscriber_t sub; - z_declare_subscriber(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL); + z_subscriber_declare(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL); uint8_t* data = z_malloc(args.size); for (int i = 0; i < args.size; i++) { data[i] = i % 10; diff --git a/examples/z_ping_shm.c b/examples/z_ping_shm.c index 9a0283ce5..e6fe35100 100644 --- a/examples/z_ping_shm.c +++ b/examples/z_ping_shm.c @@ -64,11 +64,11 @@ int main(int argc, char** argv) { z_view_keyexpr_t pong; z_view_keyexpr_from_str_unchecked(&pong, "test/pong"); z_owned_publisher_t pub; - z_declare_publisher(&pub, z_loan(session), z_loan(ping), NULL); + z_publisher_declare(&pub, z_loan(session), z_loan(ping), NULL); z_owned_closure_sample_t respond; z_closure(&respond, callback, drop, (void*)(&pub)); z_owned_subscriber_t sub; - z_declare_subscriber(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL); + z_subscriber_declare(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL); // Create SHM Provider z_alloc_alignment_t alignment = {0}; diff --git a/examples/z_pong.c b/examples/z_pong.c index cfd77a654..9f14d1add 100644 --- a/examples/z_pong.c +++ b/examples/z_pong.c @@ -34,10 +34,10 @@ int main(int argc, char** argv) { z_view_keyexpr_t pong; z_view_keyexpr_from_str_unchecked(&pong, "test/pong"); z_owned_publisher_t pub; - z_declare_publisher(&pub, z_loan(session), z_loan(pong), NULL); + z_publisher_declare(&pub, z_loan(session), z_loan(pong), NULL); z_owned_closure_sample_t respond; z_closure(&respond, callback, drop, (void*)&pub); - z_declare_background_subscriber(z_loan(session), z_loan(ping), z_move(respond), NULL); + z_subscriber_declare_background(z_loan(session), z_loan(ping), z_move(respond), NULL); while (1) { z_sleep_s(1); diff --git a/examples/z_pub.c b/examples/z_pub.c index 6294bed39..ec74cf3e8 100644 --- a/examples/z_pub.c +++ b/examples/z_pub.c @@ -54,7 +54,7 @@ int main(int argc, char** argv) { z_owned_publisher_t pub; z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, args.keyexpr); - if (z_declare_publisher(&pub, z_loan(s), z_loan(ke), NULL) < 0) { + if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) { printf("Unable to declare Publisher for key expression!\n"); exit(-1); } diff --git a/examples/z_pub_attachment.c b/examples/z_pub_attachment.c index a9f78f2e2..5e3743950 100644 --- a/examples/z_pub_attachment.c +++ b/examples/z_pub_attachment.c @@ -48,7 +48,7 @@ int main(int argc, char** argv) { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, args.keyexpr); z_owned_publisher_t pub; - if (z_declare_publisher(&pub, z_loan(s), z_loan(ke), NULL)) { + if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL)) { printf("Unable to declare Publisher for key expression!\n"); exit(-1); } diff --git a/examples/z_pub_cache.c b/examples/z_pub_cache.c index 3d76177b4..7858ac0a9 100644 --- a/examples/z_pub_cache.c +++ b/examples/z_pub_cache.c @@ -56,7 +56,7 @@ int main(int argc, char** argv) { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, args.keyexpr); - if (ze_declare_publication_cache(&pub_cache, z_loan(s), z_loan(ke), &pub_cache_opts) != Z_OK) { + if (ze_publication_cache_declare(&pub_cache, z_loan(s), z_loan(ke), &pub_cache_opts) != Z_OK) { printf("Unable to declare publication cache for key expression!\n"); exit(-1); } diff --git a/examples/z_pub_shm.c b/examples/z_pub_shm.c index ceb932866..896043fae 100644 --- a/examples/z_pub_shm.c +++ b/examples/z_pub_shm.c @@ -55,7 +55,7 @@ int main(int argc, char** argv) { z_owned_publisher_t pub; z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, args.keyexpr); - if (z_declare_publisher(&pub, z_loan(s), z_loan(ke), NULL) < 0) { + if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) { printf("Unable to declare Publisher for key expression!\n"); exit(-1); } diff --git a/examples/z_pub_shm_thr.c b/examples/z_pub_shm_thr.c index db58f3d1c..8fa4e5de1 100644 --- a/examples/z_pub_shm_thr.c +++ b/examples/z_pub_shm_thr.c @@ -53,7 +53,7 @@ int main(int argc, char **argv) { z_owned_publisher_t pub; z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); - if (z_declare_publisher(&pub, z_loan(s), z_loan(ke), &options)) { + if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), &options)) { printf("Unable to declare publisher for key expression!\n"); exit(-1); } diff --git a/examples/z_pub_thr.c b/examples/z_pub_thr.c index 1545dea9e..19a057a92 100644 --- a/examples/z_pub_thr.c +++ b/examples/z_pub_thr.c @@ -48,7 +48,7 @@ int main(int argc, char** argv) { z_owned_publisher_t pub; z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); - if (z_declare_publisher(&pub, z_loan(s), z_loan(ke), &options)) { + if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), &options)) { printf("Unable to declare publisher for key expression!\n"); exit(-1); } diff --git a/examples/z_pull.c b/examples/z_pull.c index 9995c63f9..d8c6d5b5a 100644 --- a/examples/z_pull.c +++ b/examples/z_pull.c @@ -59,7 +59,7 @@ int main(int argc, char** argv) { z_view_keyexpr_from_str(&ke, args.keyexpr); z_owned_subscriber_t sub; - if (z_declare_subscriber(&sub, z_loan(s), z_loan(ke), z_move(closure), NULL) < 0) { + if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(closure), NULL) < 0) { printf("Unable to declare subscriber.\n"); exit(-1); } diff --git a/examples/z_query_sub.c b/examples/z_query_sub.c index 8c1ca88e9..be9ae30b8 100644 --- a/examples/z_query_sub.c +++ b/examples/z_query_sub.c @@ -59,7 +59,7 @@ int main(int argc, char** argv) { z_closure(&callback, data_handler, NULL, NULL); printf("Declaring querying subscriber on '%s'...\n", args.keyexpr); ze_owned_querying_subscriber_t sub; - if (ze_declare_querying_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), &sub_opts) < 0) { + if (ze_querying_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), &sub_opts) < 0) { printf("Unable to declare querying subscriber.\n"); exit(-1); } diff --git a/examples/z_sub.c b/examples/z_sub.c index eb9d9343f..0d823c686 100644 --- a/examples/z_sub.c +++ b/examples/z_sub.c @@ -70,7 +70,7 @@ int main(int argc, char **argv) { z_closure(&callback, data_handler, NULL, NULL); printf("Declaring Subscriber on '%s'...\n", args.keyexpr); z_owned_subscriber_t sub; - if (z_declare_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to declare subscriber.\n"); exit(-1); } diff --git a/examples/z_sub_attachment.c b/examples/z_sub_attachment.c index 84fcce1ad..6178b15db 100644 --- a/examples/z_sub_attachment.c +++ b/examples/z_sub_attachment.c @@ -74,7 +74,7 @@ int main(int argc, char** argv) { z_closure(&callback, data_handler, NULL, NULL); printf("Declaring Subscriber on '%s'...\n", args.keyexpr); z_owned_subscriber_t sub; - if (z_declare_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL)) { + if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL)) { printf("Unable to declare subscriber.\n"); exit(-1); } diff --git a/examples/z_sub_liveliness.c b/examples/z_sub_liveliness.c index 399e7cbce..f2efd65f1 100644 --- a/examples/z_sub_liveliness.c +++ b/examples/z_sub_liveliness.c @@ -60,7 +60,7 @@ int main(int argc, char** argv) { z_owned_closure_sample_t callback; z_closure(&callback, data_handler, NULL, NULL); z_owned_subscriber_t sub; - if (zc_liveliness_declare_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (zc_liveliness_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to declare liveliness subscriber.\n"); exit(-1); } diff --git a/examples/z_sub_shm.c b/examples/z_sub_shm.c index d0a9bde90..e49eb8b6a 100644 --- a/examples/z_sub_shm.c +++ b/examples/z_sub_shm.c @@ -87,7 +87,7 @@ int main(int argc, char **argv) { z_closure(&callback, data_handler, NULL, NULL); printf("Declaring Subscriber on '%s'...\n", keyexpr); z_owned_subscriber_t sub; - if (z_declare_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { printf("Unable to declare subscriber.\n"); exit(-1); } diff --git a/examples/z_sub_thr.c b/examples/z_sub_thr.c index 2753da942..f5c595fbe 100644 --- a/examples/z_sub_thr.c +++ b/examples/z_sub_thr.c @@ -95,7 +95,7 @@ int main(int argc, char **argv) { z_stats_t *context = z_stats_make(); z_owned_closure_sample_t callback; z_closure(&callback, on_sample, drop_stats, context); - if (z_declare_background_subscriber(z_loan(s), z_loan(declared_ke), z_move(callback), NULL)) { + if (z_subscriber_declare_background(z_loan(s), z_loan(declared_ke), z_move(callback), NULL)) { printf("Unable to create subscriber.\n"); exit(-1); } diff --git a/include/zenoh_commons.h b/include/zenoh_commons.h index 7cd72d832..4b0aecf43 100644 --- a/include/zenoh_commons.h +++ b/include/zenoh_commons.h @@ -614,55 +614,6 @@ typedef struct z_queryable_options_t { */ bool complete; } z_queryable_options_t; -/** - * Options passed to the `z_declare_subscriber()` function. - */ -typedef struct z_subscriber_options_t { - /** - * Dummy field to avoid having fieldless struct - */ - uint8_t _0; -} z_subscriber_options_t; -typedef struct z_moved_encoding_t { - struct z_owned_encoding_t _this; -} z_moved_encoding_t; -/** - * Options passed to the `z_declare_publisher()` function. - */ -typedef struct z_publisher_options_t { - /** - * Default encoding for messages put by this publisher. - */ - struct z_moved_encoding_t *encoding; - /** - * The congestion control to apply when routing messages from this publisher. - */ - enum z_congestion_control_t congestion_control; - /** - * The priority of messages from this publisher. - */ - enum z_priority_t priority; - /** - * If true, Zenoh will not wait to batch this message with others to reduce the bandwith. - */ - bool is_express; -#if defined(Z_FEATURE_UNSTABLE_API) - /** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * - * The publisher reliability. - */ - enum z_reliability_t reliability; -#endif -#if defined(Z_FEATURE_UNSTABLE_API) - /** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * - * The allowed destination for this publisher. - */ - enum zc_locality_t allowed_destination; -#endif -} z_publisher_options_t; /** * Options passed to the `z_delete()` function. */ @@ -700,6 +651,9 @@ typedef struct z_delete_options_t { enum zc_locality_t allowed_destination; #endif } z_delete_options_t; +typedef struct z_moved_encoding_t { + struct z_owned_encoding_t _this; +} z_moved_encoding_t; typedef struct z_moved_fifo_handler_query_t { struct z_owned_fifo_handler_query_t _this; } z_moved_fifo_handler_query_t; @@ -795,6 +749,43 @@ typedef struct z_moved_mutex_t { typedef struct z_open_options_t { uint8_t _dummy; } z_open_options_t; +/** + * Options passed to the `z_publisher_declare()` function. + */ +typedef struct z_publisher_options_t { + /** + * Default encoding for messages put by this publisher. + */ + struct z_moved_encoding_t *encoding; + /** + * The congestion control to apply when routing messages from this publisher. + */ + enum z_congestion_control_t congestion_control; + /** + * The priority of messages from this publisher. + */ + enum z_priority_t priority; + /** + * If true, Zenoh will not wait to batch this message with others to reduce the bandwith. + */ + bool is_express; +#if defined(Z_FEATURE_UNSTABLE_API) + /** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * + * The publisher reliability. + */ + enum z_reliability_t reliability; +#endif +#if defined(Z_FEATURE_UNSTABLE_API) + /** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * + * The allowed destination for this publisher. + */ + enum zc_locality_t allowed_destination; +#endif +} z_publisher_options_t; /** * Represents the set of options that can be applied to the delete operation by a previously declared publisher, * whenever issued via `z_publisher_delete()`. @@ -1101,6 +1092,15 @@ typedef struct zc_shm_provider_backend_callbacks_t { typedef struct z_moved_string_array_t { struct z_owned_string_array_t _this; } z_moved_string_array_t; +/** + * Options passed to the `z_subscriber_declare()` function. + */ +typedef struct z_subscriber_options_t { + /** + * Dummy field to avoid having fieldless struct + */ + uint8_t _0; +} z_subscriber_options_t; typedef struct z_moved_subscriber_t { struct z_owned_subscriber_t _this; } z_moved_subscriber_t; @@ -1214,7 +1214,16 @@ typedef struct zc_liveliness_declaration_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 The options for `zc_liveliness_declare_subscriber()` + * @brief The options for `zc_liveliness_get()` + */ +#if defined(Z_FEATURE_UNSTABLE_API) +typedef struct zc_liveliness_get_options_t { + uint32_t timeout_ms; +} zc_liveliness_get_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 The options for `zc_liveliness_subscriber_declare()` */ #if defined(Z_FEATURE_UNSTABLE_API) typedef struct zc_liveliness_subscriber_options_t { @@ -1223,17 +1232,38 @@ typedef struct zc_liveliness_subscriber_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 The options for `zc_liveliness_get()` + * @brief Options passed to the `ze_publication_cache_declare()` function. */ #if defined(Z_FEATURE_UNSTABLE_API) -typedef struct zc_liveliness_get_options_t { - uint32_t timeout_ms; -} zc_liveliness_get_options_t; +typedef struct ze_publication_cache_options_t { + /** + * The prefix used for queryable. + */ + const struct z_loaned_keyexpr_t *queryable_prefix; +#if defined(Z_FEATURE_UNSTABLE_API) + /** + * The restriction for the matching queries that will be receive by this publication cache. + */ + enum zc_locality_t queryable_origin; +#endif + /** + * The `complete` option for the queryable. + */ + bool queryable_complete; + /** + * The the history size (i.e. maximum number of messages to store). + */ + size_t history; + /** + * The limit number of cached resources. + */ + size_t resources_limit; +} ze_publication_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. * @brief A set of options that can be applied to a querying subscriber, - * upon its declaration via `ze_declare_querying_subscriber()`. + * upon its declaration via `ze_querying_subscriber_declare()`. * */ #if defined(Z_FEATURE_UNSTABLE_API) @@ -1268,36 +1298,6 @@ typedef struct ze_querying_subscriber_options_t { uint64_t query_timeout_ms; } ze_querying_subscriber_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 Options passed to the `ze_declare_publication_cache()` function. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -typedef struct ze_publication_cache_options_t { - /** - * The prefix used for queryable. - */ - const struct z_loaned_keyexpr_t *queryable_prefix; -#if defined(Z_FEATURE_UNSTABLE_API) - /** - * The restriction for the matching queries that will be receive by this publication cache. - */ - enum zc_locality_t queryable_origin; -#endif - /** - * The `complete` option for the queryable. - */ - bool queryable_complete; - /** - * The the history size (i.e. maximum number of messages to store). - */ - size_t history; - /** - * The limit number of cached resources. - */ - size_t resources_limit; -} ze_publication_cache_options_t; -#endif typedef struct ze_moved_serializer_t { struct ze_owned_serializer_t _this; } ze_moved_serializer_t; @@ -1926,38 +1926,6 @@ ZENOHC_API const struct z_loaned_config_t *z_config_loan(const struct z_owned_co * Mutably borrows config. */ ZENOHC_API struct z_loaned_config_t *z_config_loan_mut(struct z_owned_config_t *this_); -/** - * Declares a background queryable for a given keyexpr. The queryable callback will be be called - * to proccess incoming queries until the corresponding session is closed or dropped. - * - * @param session: The zenoh session. - * @param key_expr: The key expression the Queryable will reply to. - * @param callback: The callback function that will be called each time a matching query is received. Its ownership is passed to queryable. - * @param options: Options for the queryable. - * - * @return 0 in case of success, negative error code otherwise (in this case ) - */ -ZENOHC_API -z_result_t z_declare_background_queryable(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_query_t *callback, - struct z_queryable_options_t *options); -/** - * Constructs and declares a background subscriber. Subscriber callback will be called to process the messages, - * until the corresponding session is closed or dropped. - * - * @param session: The zenoh session. - * @param key_expr: The key expression to subscribe. - * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. - * @param _options: The options to be passed to the subscriber declaration. - * - * @return 0 in case of success, negative error code otherwise. - */ -ZENOHC_API -z_result_t z_declare_background_subscriber(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct z_subscriber_options_t *_options); /** * Constructs and declares a key expression on the network. This reduces key key expression to a numerical id, * which allows to save the bandwith, when passing key expression between Zenoh entities. @@ -1971,24 +1939,6 @@ ZENOHC_API z_result_t z_declare_keyexpr(struct z_owned_keyexpr_t *this_, const struct z_loaned_session_t *session, const struct z_loaned_keyexpr_t *key_expr); -/** - * Constructs and declares a publisher for the given key expression. - * - * Data can be put and deleted with this publisher with the help of the - * `z_publisher_put()` and `z_publisher_delete()` functions. - * - * @param this_: An unitilized location in memory where publisher will be constructed. - * @param session: The Zenoh session. - * @param key_expr: The key expression to publish. - * @param options: Additional options for the publisher. - * - * @return 0 in case of success, negative error code otherwise. - */ -ZENOHC_API -z_result_t z_declare_publisher(struct z_owned_publisher_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_publisher_options_t *options); /** * Constructs a Queryable for the given key expression. * @@ -2006,23 +1956,6 @@ z_result_t z_declare_queryable(struct z_owned_queryable_t *this_, const struct z_loaned_keyexpr_t *key_expr, struct z_moved_closure_query_t *callback, struct z_queryable_options_t *options); -/** - * Constructs and declares a subscriber for a given key expression. Dropping subscriber undeclares its callback. - * - * @param this_: An uninitialized location in memory, where subscriber will be constructed. - * @param session: The zenoh session. - * @param key_expr: The key expression to subscribe. - * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. - * @param _options: The options to be passed to the subscriber declaration. - * - * @return 0 in case of success, negative error code otherwise (in this case subscriber will be in its gravestone state). - */ -ZENOHC_API -z_result_t z_declare_subscriber(struct z_owned_subscriber_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct z_subscriber_options_t *_options); /** * Sends request to delete data on specified key expression (used when working with Zenoh storages ). * @@ -3403,6 +3336,24 @@ z_result_t z_posix_shm_provider_new(z_owned_shm_provider_t *this_, * Returns the default value of #z_priority_t. */ ZENOHC_API enum z_priority_t z_priority_default(void); +/** + * Constructs and declares a publisher for the given key expression. + * + * Data can be put and deleted with this publisher with the help of the + * `z_publisher_put()` and `z_publisher_delete()` functions. + * + * @param this_: An unitilized location in memory where publisher will be constructed. + * @param session: The Zenoh session. + * @param key_expr: The key expression to publish. + * @param options: Additional options for the publisher. + * + * @return 0 in case of success, negative error code otherwise. + */ +ZENOHC_API +z_result_t z_publisher_declare(struct z_owned_publisher_t *this_, + const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_publisher_options_t *options); /** * Sends a `DELETE` message onto the publisher's key expression. * @@ -3635,6 +3586,22 @@ ZENOHC_API void z_query_reply_options_default(struct z_query_reply_options_t *th * Create a default `z_query_target_t`. */ ZENOHC_API enum z_query_target_t z_query_target_default(void); +/** + * Declares a background queryable for a given keyexpr. The queryable callback will be be called + * to proccess incoming queries until the corresponding session is closed or dropped. + * + * @param session: The zenoh session. + * @param key_expr: The key expression the Queryable will reply to. + * @param callback: The callback function that will be called each time a matching query is received. Its ownership is passed to queryable. + * @param options: Options for the queryable. + * + * @return 0 in case of success, negative error code otherwise (in this case ) + */ +ZENOHC_API +z_result_t z_queryable_declare_background(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_query_t *callback, + struct z_queryable_options_t *options); /** * Undeclares queryable callback and resets it to its gravestone state. */ @@ -4502,6 +4469,39 @@ ZENOHC_API size_t z_string_len(const struct z_loaned_string_t *this_); * Borrows string. */ ZENOHC_API const struct z_loaned_string_t *z_string_loan(const struct z_owned_string_t *this_); +/** + * Constructs and declares a subscriber for a given key expression. Dropping subscriber undeclares its callback. + * + * @param this_: An uninitialized location in memory, where subscriber will be constructed. + * @param session: The zenoh session. + * @param key_expr: The key expression to subscribe. + * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. + * @param _options: The options to be passed to the subscriber declaration. + * + * @return 0 in case of success, negative error code otherwise (in this case subscriber will be in its gravestone state). + */ +ZENOHC_API +z_result_t z_subscriber_declare(struct z_owned_subscriber_t *this_, + const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct z_subscriber_options_t *_options); +/** + * Constructs and declares a background subscriber. Subscriber callback will be called to process the messages, + * until the corresponding session is closed or dropped. + * + * @param session: The zenoh session. + * @param key_expr: The key expression to subscribe. + * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. + * @param _options: The options to be passed to the subscriber declaration. + * + * @return 0 in case of success, negative error code otherwise. + */ +ZENOHC_API +z_result_t z_subscriber_declare_background(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct z_subscriber_options_t *_options); /** * Undeclares subscriber callback and resets it to its gravestone state. */ @@ -5001,44 +5001,6 @@ void zc_internal_shm_client_list_null(zc_owned_shm_client_list_t *this_); ZENOHC_API void zc_liveliness_declaration_options_default(struct zc_liveliness_declaration_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. - * @brief Declares a background subscriber on liveliness tokens that intersect `key_expr`. Subscriber callback will be called to process the messages, - * until the corresponding session is closed or dropped. - * @param session: The Zenoh session. - * @param key_expr: The key expression to subscribe to. - * @param callback: The callback function that will be called each time a liveliness token status is changed. - * @param options: The options to be passed to the liveliness subscriber declaration. - * - * @return 0 in case of success, negative error values otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t zc_liveliness_declare_background_subscriber(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct zc_liveliness_subscriber_options_t *options); -#endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Declares a subscriber on liveliness tokens that intersect `key_expr`. - * - * @param this_: An uninitialized memory location where subscriber will be constructed. - * @param session: The Zenoh session. - * @param key_expr: The key expression to subscribe to. - * @param callback: The callback function that will be called each time a liveliness token status is changed. - * @param options: The options to be passed to the liveliness subscriber declaration. - * - * @return 0 in case of success, negative error values otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t zc_liveliness_declare_subscriber(struct z_owned_subscriber_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct zc_liveliness_subscriber_options_t *options); -#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Constructs and declares a liveliness token on the network. @@ -5084,7 +5046,45 @@ void zc_liveliness_get_options_default(struct zc_liveliness_get_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. - * @brief Constucts default value for `zc_liveliness_declare_subscriber_options_t`. + * @brief Declares a subscriber on liveliness tokens that intersect `key_expr`. + * + * @param this_: An uninitialized memory location where subscriber will be constructed. + * @param session: The Zenoh session. + * @param key_expr: The key expression to subscribe to. + * @param callback: The callback function that will be called each time a liveliness token status is changed. + * @param options: The options to be passed to the liveliness subscriber declaration. + * + * @return 0 in case of success, negative error values otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t zc_liveliness_subscriber_declare(struct z_owned_subscriber_t *this_, + const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct zc_liveliness_subscriber_options_t *options); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Declares a background subscriber on liveliness tokens that intersect `key_expr`. Subscriber callback will be called to process the messages, + * until the corresponding session is closed or dropped. + * @param session: The Zenoh session. + * @param key_expr: The key expression to subscribe to. + * @param callback: The callback function that will be called each time a liveliness token status is changed. + * @param options: The options to be passed to the liveliness subscriber declaration. + * + * @return 0 in case of success, negative error values otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t zc_liveliness_subscriber_declare_background(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct zc_liveliness_subscriber_options_t *options); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Constucts default value for `zc_liveliness_subscriber_declare_options_t`. */ #if defined(Z_FEATURE_UNSTABLE_API) ZENOHC_API @@ -5238,63 +5238,6 @@ void zc_stop_z_runtime(void); */ ZENOHC_API void zc_try_init_log_from_env(void); -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Declares a background querying subscriber for a given key expression. Subscriber callback will be called to process the messages, - * until the corresponding session is closed or dropped. - * - * @param session: A Zenoh session. - * @param key_expr: A key expression to subscribe to. - * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. - * @param options: Additional options for the querying subscriber. - * - * @return 0 in case of success, negative error code otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t ze_declare_background_querying_subscriber(const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct ze_querying_subscriber_options_t *options); -#endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Constructs and declares a publication cache. - * - * @param this_: An uninitialized location in memory where publication cache will be constructed. - * @param session: A Zenoh session. - * @param key_expr: The key expression to publish to. - * @param options: Additional options for the publication cache. - * - * @returns 0 in case of success, negative error code otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t ze_declare_publication_cache(ze_owned_publication_cache_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct ze_publication_cache_options_t *options); -#endif -/** - * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. - * @brief Constructs and declares a querying subscriber for a given key expression. - * - * @param this_: An uninitialized memory location where querying subscriber will be constructed. - * @param session: A Zenoh session. - * @param key_expr: A key expression to subscribe to. - * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. - * @param options: Additional options for the querying subscriber. - * - * @return 0 in case of success, negative error code otherwise. - */ -#if defined(Z_FEATURE_UNSTABLE_API) -ZENOHC_API -z_result_t ze_declare_querying_subscriber(ze_owned_querying_subscriber_t *this_, - const struct z_loaned_session_t *session, - const struct z_loaned_keyexpr_t *key_expr, - struct z_moved_closure_sample_t *callback, - struct ze_querying_subscriber_options_t *options); -#endif /** * @brief Deserializes into a bool. * @return 0 in case of success, negative error code otherwise. @@ -5506,6 +5449,24 @@ ZENOHC_API bool ze_internal_serializer_check(const struct ze_owned_serializer_t * @brief Constructs a serializer in a gravestone state. */ ZENOHC_API void ze_internal_serializer_null(struct ze_owned_serializer_t *this_); +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Constructs and declares a publication cache. + * + * @param this_: An uninitialized location in memory where publication cache will be constructed. + * @param session: A Zenoh session. + * @param key_expr: The key expression to publish to. + * @param options: Additional options for the publication cache. + * + * @returns 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_publication_cache_declare(ze_owned_publication_cache_t *this_, + const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct ze_publication_cache_options_t *options); +#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Drops publication cache and resets it to its gravestone state. @@ -5538,6 +5499,45 @@ const ze_loaned_publication_cache_t *ze_publication_cache_loan(const ze_owned_pu ZENOHC_API void ze_publication_cache_options_default(struct ze_publication_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. + * @brief Constructs and declares a querying subscriber for a given key expression. + * + * @param this_: An uninitialized memory location where querying subscriber will be constructed. + * @param session: A Zenoh session. + * @param key_expr: A key expression to subscribe to. + * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. + * @param options: Additional options for the querying subscriber. + * + * @return 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_querying_subscriber_declare(ze_owned_querying_subscriber_t *this_, + const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct ze_querying_subscriber_options_t *options); +#endif +/** + * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. + * @brief Declares a background querying subscriber for a given key expression. Subscriber callback will be called to process the messages, + * until the corresponding session is closed or dropped. + * + * @param session: A Zenoh session. + * @param key_expr: A key expression to subscribe to. + * @param callback: The callback function that will be called each time a data matching the subscribed expression is received. + * @param options: Additional options for the querying subscriber. + * + * @return 0 in case of success, negative error code otherwise. + */ +#if defined(Z_FEATURE_UNSTABLE_API) +ZENOHC_API +z_result_t ze_querying_subscriber_declare_background(const struct z_loaned_session_t *session, + const struct z_loaned_keyexpr_t *key_expr, + struct z_moved_closure_sample_t *callback, + struct ze_querying_subscriber_options_t *options); +#endif /** * @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. * @brief Undeclares querying subscriber callback and resets it to its gravestone state. diff --git a/src/liveliness.rs b/src/liveliness.rs index fe67b2d8d..76ae3f895 100644 --- a/src/liveliness.rs +++ b/src/liveliness.rs @@ -135,14 +135,14 @@ pub extern "C" fn zc_liveliness_undeclare_token( } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief The options for `zc_liveliness_declare_subscriber()` +/// @brief The options for `zc_liveliness_subscriber_declare()` #[repr(C)] pub struct zc_liveliness_subscriber_options_t { history: bool, } /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief Constucts default value for `zc_liveliness_declare_subscriber_options_t`. +/// @brief Constucts default value for `zc_liveliness_subscriber_declare_options_t`. #[no_mangle] pub extern "C" fn zc_liveliness_subscriber_options_default( this: &mut MaybeUninit, @@ -185,7 +185,7 @@ fn _liveliness_declare_subscriber_inner<'a, 'b>( /// /// @return 0 in case of success, negative error values otherwise. #[no_mangle] -pub extern "C" fn zc_liveliness_declare_subscriber( +pub extern "C" fn zc_liveliness_subscriber_declare( this: &mut MaybeUninit, session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, @@ -217,7 +217,7 @@ pub extern "C" fn zc_liveliness_declare_subscriber( /// /// @return 0 in case of success, negative error values otherwise. #[no_mangle] -pub extern "C" fn zc_liveliness_declare_background_subscriber( +pub extern "C" fn zc_liveliness_subscriber_declare_background( session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, diff --git a/src/publication_cache.rs b/src/publication_cache.rs index 7d080761e..4af68ef05 100644 --- a/src/publication_cache.rs +++ b/src/publication_cache.rs @@ -26,7 +26,7 @@ use crate::{ use crate::{zc_locality_default, zc_locality_t}; /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. -/// @brief Options passed to the `ze_declare_publication_cache()` function. +/// @brief Options passed to the `ze_publication_cache_declare()` function. #[repr(C)] pub struct ze_publication_cache_options_t { /// The prefix used for queryable. @@ -80,7 +80,7 @@ decl_c_type!( /// @returns 0 in case of success, negative error code otherwise. #[no_mangle] #[allow(clippy::missing_safety_doc)] -pub extern "C" fn ze_declare_publication_cache( +pub extern "C" fn ze_publication_cache_declare( this: &mut MaybeUninit, session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, diff --git a/src/publisher.rs b/src/publisher.rs index dfd356517..d22bef600 100644 --- a/src/publisher.rs +++ b/src/publisher.rs @@ -43,7 +43,7 @@ use crate::{ zc_locality_t, }; -/// Options passed to the `z_declare_publisher()` function. +/// Options passed to the `z_publisher_declare()` function. #[repr(C)] pub struct z_publisher_options_t { /// Default encoding for messages put by this publisher. @@ -100,7 +100,7 @@ decl_c_type!( /// @return 0 in case of success, negative error code otherwise. #[no_mangle] #[allow(clippy::missing_safety_doc)] -pub extern "C" fn z_declare_publisher( +pub extern "C" fn z_publisher_declare( this: &mut MaybeUninit, session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, diff --git a/src/queryable.rs b/src/queryable.rs index 5ab8a9083..260836589 100644 --- a/src/queryable.rs +++ b/src/queryable.rs @@ -274,7 +274,7 @@ pub extern "C" fn z_declare_queryable( /// /// @return 0 in case of success, negative error code otherwise (in this case ) #[no_mangle] -pub extern "C" fn z_declare_background_queryable( +pub extern "C" fn z_queryable_declare_background( session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_query_t, diff --git a/src/querying_subscriber.rs b/src/querying_subscriber.rs index e5a7fadde..100e1b26b 100644 --- a/src/querying_subscriber.rs +++ b/src/querying_subscriber.rs @@ -49,7 +49,7 @@ pub extern "C" fn ze_internal_querying_subscriber_null( /// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release. /// @brief A set of options that can be applied to a querying subscriber, -/// upon its declaration via `ze_declare_querying_subscriber()`. +/// upon its declaration via `ze_querying_subscriber_declare()`. /// #[repr(C)] #[allow(non_camel_case_types)] @@ -141,7 +141,7 @@ unsafe fn _declare_querying_subscriber_inner<'a, 'b>( /// @return 0 in case of success, negative error code otherwise. #[no_mangle] #[allow(clippy::missing_safety_doc)] -pub unsafe extern "C" fn ze_declare_querying_subscriber( +pub unsafe extern "C" fn ze_querying_subscriber_declare( this: &mut MaybeUninit, session: &'static z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, @@ -176,7 +176,7 @@ pub unsafe extern "C" fn ze_declare_querying_subscriber( /// @return 0 in case of success, negative error code otherwise. #[no_mangle] #[allow(clippy::missing_safety_doc)] -pub unsafe extern "C" fn ze_declare_background_querying_subscriber( +pub unsafe extern "C" fn ze_querying_subscriber_declare_background( session: &'static z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, diff --git a/src/subscriber.rs b/src/subscriber.rs index e125f6f25..69886ec50 100644 --- a/src/subscriber.rs +++ b/src/subscriber.rs @@ -50,7 +50,7 @@ pub unsafe extern "C" fn z_subscriber_loan(this_: &z_owned_subscriber_t) -> &z_l .as_loaned_c_type_ref() } -/// Options passed to the `z_declare_subscriber()` function. +/// Options passed to the `z_subscriber_declare()` function. #[allow(non_camel_case_types)] #[repr(C)] pub struct z_subscriber_options_t { @@ -97,7 +97,7 @@ fn _declare_subscriber_inner<'a, 'b>( /// /// @return 0 in case of success, negative error code otherwise (in this case subscriber will be in its gravestone state). #[no_mangle] -pub extern "C" fn z_declare_subscriber( +pub extern "C" fn z_subscriber_declare( this: &mut MaybeUninit, session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, @@ -129,7 +129,7 @@ pub extern "C" fn z_declare_subscriber( /// /// @return 0 in case of success, negative error code otherwise. #[no_mangle] -pub extern "C" fn z_declare_background_subscriber( +pub extern "C" fn z_subscriber_declare_background( session: &z_loaned_session_t, key_expr: &z_loaned_keyexpr_t, callback: &mut z_moved_closure_sample_t, diff --git a/tests/z_api_alignment_test.c b/tests/z_api_alignment_test.c index 3c4be389c..0c10a7635 100644 --- a/tests/z_api_alignment_test.c +++ b/tests/z_api_alignment_test.c @@ -268,7 +268,7 @@ int main(int argc, char **argv) { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr_str); z_owned_subscriber_t _ret_sub; - z_declare_subscriber(&_ret_sub, z_loan(s2), z_loan(ke), z_move(_ret_closure_sample), &_ret_sub_opt); + z_subscriber_declare(&_ret_sub, z_loan(s2), z_loan(ke), z_move(_ret_closure_sample), &_ret_sub_opt); assert(z_internal_check(_ret_sub)); z_sleep_s(SLEEP); diff --git a/tests/z_api_double_drop_test.c b/tests/z_api_double_drop_test.c index b3cc7b7f9..807681eb9 100644 --- a/tests/z_api_double_drop_test.c +++ b/tests/z_api_double_drop_test.c @@ -45,7 +45,7 @@ void test_publisher() { z_keyexpr_from_str(&keyexpr, URL); z_owned_publisher_t pub; - z_declare_publisher(&pub, z_loan(s), z_loan(keyexpr), NULL); + z_publisher_declare(&pub, z_loan(s), z_loan(keyexpr), NULL); assert(z_internal_check(pub)); z_drop(z_move(pub)); assert(!z_internal_check(pub)); @@ -88,7 +88,7 @@ void test_subscriber() { z_view_keyexpr_t keyexpr; z_view_keyexpr_from_str(&keyexpr, URL); z_owned_subscriber_t sub; - z_declare_subscriber(&sub, z_loan(s), z_loan(keyexpr), z_move(callback), NULL); + z_subscriber_declare(&sub, z_loan(s), z_loan(keyexpr), z_move(callback), NULL); assert(z_internal_check(sub)); z_drop(z_move(sub)); assert(!z_internal_check(sub)); diff --git a/tests/z_api_keyexpr_drop_test.c b/tests/z_api_keyexpr_drop_test.c index a98de4e8d..2597884d8 100644 --- a/tests/z_api_keyexpr_drop_test.c +++ b/tests/z_api_keyexpr_drop_test.c @@ -31,7 +31,7 @@ void test_publisher() { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); z_owned_publisher_t pub; - z_declare_publisher(&pub, z_loan(s), z_loan(ke), NULL); + z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL); strncpy(keyexpr, "baz/quax", 256); // Update source string to ensure that the keyexpr is copied into publisher z_view_keyexpr_from_str(&ke, keyexpr); const z_loaned_keyexpr_t *pub_ke = z_publisher_keyexpr(z_loan(pub)); @@ -57,7 +57,7 @@ void test_subscriber() { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); z_owned_subscriber_t sub; - z_declare_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL); + z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL); strncpy(keyexpr, "baz/quax", 256); // Update source string to ensure that the keyexpr is copied into the subscriber z_view_keyexpr_from_str(&ke, keyexpr); const z_loaned_keyexpr_t *sub_ke = z_subscriber_keyexpr(z_loan(sub)); diff --git a/tests/z_api_liveliness.c b/tests/z_api_liveliness.c index c7465132a..d7c2c1939 100644 --- a/tests/z_api_liveliness.c +++ b/tests/z_api_liveliness.c @@ -71,7 +71,7 @@ void test_liveliness_sub() { z_closure(&closure, on_receive, NULL, (void*)(&context)); z_owned_subscriber_t sub; - zc_liveliness_declare_subscriber(&sub, z_loan(s2), z_loan(k), z_move(closure), NULL); + zc_liveliness_subscriber_declare(&sub, z_loan(s2), z_loan(k), z_move(closure), NULL); z_sleep_s(1); zc_owned_liveliness_token_t t1, t2; diff --git a/tests/z_int_pub_cache_query_sub_test.c b/tests/z_int_pub_cache_query_sub_test.c index 123599c49..2248c05ad 100644 --- a/tests/z_int_pub_cache_query_sub_test.c +++ b/tests/z_int_pub_cache_query_sub_test.c @@ -52,13 +52,13 @@ int run_publisher() { z_view_keyexpr_from_str(&ke, keyexpr); ze_owned_publication_cache_t pub_cache; ; - if (ze_declare_publication_cache(&pub_cache, z_loan(s), z_loan(ke), &pub_cache_opts) < 0) { + if (ze_publication_cache_declare(&pub_cache, z_loan(s), z_loan(ke), &pub_cache_opts) < 0) { perror("Unable to declare publication cache for key expression!\n"); return -1; } z_owned_publisher_t pub; - if (z_declare_publisher(&pub, z_loan(s), z_loan(ke), NULL) < 0) { + if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) { perror("Unable to declare Publisher for key expression!"); return -1; } @@ -135,7 +135,7 @@ int run_subscriber() { z_closure(&callback, data_handler, NULL, NULL); ze_owned_querying_subscriber_t sub; ; - if (ze_declare_querying_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) != Z_OK) { + if (ze_querying_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) != Z_OK) { perror("Unable to declare subscriber!"); return -1; } diff --git a/tests/z_int_pub_sub_attachment_test.c b/tests/z_int_pub_sub_attachment_test.c index 9061aa85c..1056174ce 100644 --- a/tests/z_int_pub_sub_attachment_test.c +++ b/tests/z_int_pub_sub_attachment_test.c @@ -94,7 +94,7 @@ int run_publisher() { z_view_keyexpr_t ke; z_view_keyexpr_from_str(&ke, keyexpr); z_owned_publisher_t pub; - if (z_declare_publisher(&pub, z_loan(s), z_loan(ke), NULL) < 0) { + if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) { perror("Unable to declare Publisher for key expression!"); return -1; } @@ -182,7 +182,7 @@ int run_subscriber() { z_closure(&callback, data_handler, NULL, NULL); z_owned_subscriber_t sub; - if (z_declare_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { perror("Unable to declare subscriber!"); return -1; } diff --git a/tests/z_int_pub_sub_test.c b/tests/z_int_pub_sub_test.c index 1a30e09e5..4f502fda0 100644 --- a/tests/z_int_pub_sub_test.c +++ b/tests/z_int_pub_sub_test.c @@ -50,7 +50,7 @@ int run_publisher() { publisher_options.congestion_control = Z_CONGESTION_CONTROL_BLOCK; z_owned_publisher_t pub; - if (z_declare_publisher(&pub, z_loan(s), z_loan(ke), &publisher_options) != Z_OK) { + if (z_publisher_declare(&pub, z_loan(s), z_loan(ke), &publisher_options) != Z_OK) { perror("Unable to declare Publisher for key expression!"); return -1; } @@ -156,7 +156,7 @@ int run_subscriber() { z_owned_closure_sample_t callback; z_closure(&callback, data_handler, NULL, NULL); z_owned_subscriber_t sub; - if (z_declare_subscriber(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { + if (z_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) { perror("Unable to declare subscriber!"); return -1; } diff --git a/tests/z_leak_pub_sub_test.c b/tests/z_leak_pub_sub_test.c index 242f9a943..98bb0504b 100644 --- a/tests/z_leak_pub_sub_test.c +++ b/tests/z_leak_pub_sub_test.c @@ -51,7 +51,7 @@ int main(int argc, char **argv) { z_open(&pub_session, z_move(pub_config), NULL); z_owned_publisher_t publisher; - z_declare_publisher(&publisher, z_loan(pub_session), z_loan(pub_keyexpr), NULL); + z_publisher_declare(&publisher, z_loan(pub_session), z_loan(pub_keyexpr), NULL); printf("Declaring Subscriber on %s\n", SUB_KEY_EXPR); @@ -68,7 +68,7 @@ int main(int argc, char **argv) { z_closure(&callback, data_handler, NULL, NULL); z_owned_subscriber_t subscriber; - z_declare_subscriber(&subscriber, z_loan(sub_session), z_loan(sub_keyexpr), z_move(callback), NULL); + z_subscriber_declare(&subscriber, z_loan(sub_session), z_loan(sub_keyexpr), z_move(callback), NULL); z_sleep_s(1);