Skip to content

Commit

Permalink
revert the renaming of implicit session functions (#755)
Browse files Browse the repository at this point in the history
* revert the renaming of implicit session functions

* change order of arguments in implicit session declare/undeclare methods

* return undeclare functions

* fix arguments order in zc_publisher_declare_matching_listener

* revert renaming of zc_liveliness_undeclare_token
  • Loading branch information
DenisBiryukov91 authored Oct 10, 2024
1 parent 7a11163 commit c672563
Show file tree
Hide file tree
Showing 43 changed files with 945 additions and 953 deletions.
31 changes: 18 additions & 13 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,8 @@ Functions
.. doxygenfunction:: z_put
.. doxygenfunction:: z_delete

.. doxygenfunction:: z_publisher_declare
.. doxygenfunction:: z_declare_publisher
.. doxygenfunction:: z_undeclare_publisher
.. doxygenfunction:: z_publisher_put
.. doxygenfunction:: z_publisher_delete
.. doxygenfunction:: z_publisher_keyexpr
Expand All @@ -587,8 +588,8 @@ Functions
.. doxygenfunction:: zc_closure_matching_status

.. doxygenfunction:: zc_publisher_get_matching_status
.. doxygenfunction:: zc_publisher_matching_listener_declare
.. doxygenfunction:: zc_publisher_matching_listener_declare_background
.. doxygenfunction:: zc_publisher_declare_matching_listener
.. doxygenfunction:: zc_publisher_declare_background_matching_listener

.. doxygenfunction:: zc_publisher_matching_listener_drop

Expand All @@ -615,8 +616,9 @@ Types
Functions
---------

.. doxygenfunction:: z_subscriber_declare
.. doxygenfunction:: z_subscriber_declare_background
.. doxygenfunction:: z_declare_subscriber
.. doxygenfunction:: z_undeclare_subscriber
.. doxygenfunction:: z_declare_background_subscriber
.. doxygenfunction:: z_subscriber_keyexpr

.. doxygenfunction:: z_subscriber_drop
Expand Down Expand Up @@ -673,8 +675,9 @@ Types

Functions
---------
.. doxygenfunction:: z_queryable_declare
.. doxygenfunction:: z_queryable_declare_background
.. doxygenfunction:: z_declare_queryable
.. doxygenfunction:: z_undeclare_queryable
.. doxygenfunction:: z_declare_background_queryable
.. doxygenfunction:: z_queryable_id

.. doxygenfunction:: z_queryable_options_default
Expand Down Expand Up @@ -823,8 +826,8 @@ Types

Functions
---------
.. doxygenfunction:: zc_liveliness_subscriber_declare
.. doxygenfunction:: zc_liveliness_subscriber_declare_background
.. doxygenfunction:: zc_liveliness_declare_subscriber
.. doxygenfunction:: zc_liveliness_declare_background_subscriber
.. doxygenfunction:: zc_liveliness_get

.. doxygenfunction:: zc_liveliness_declare_token
Expand All @@ -851,8 +854,9 @@ Types
Functions
---------

.. doxygenfunction:: ze_publication_cache_declare
.. doxygenfunction:: ze_publication_cache_declare_background
.. doxygenfunction:: ze_declare_publication_cache
.. doxygenfunction:: ze_undeclare_publication_cache
.. doxygenfunction:: ze_declare_background_publication_cache

.. doxygenfunction:: ze_publication_cache_drop
.. doxygenfunction:: ze_publication_cache_loan
Expand All @@ -875,8 +879,9 @@ Types
Functions
---------

.. doxygenfunction:: ze_querying_subscriber_declare
.. doxygenfunction:: ze_querying_subscriber_declare_background
.. doxygenfunction:: ze_declare_querying_subscriber
.. doxygenfunction:: ze_undeclare_querying_subscriber
.. doxygenfunction:: ze_declare_background_querying_subscriber
.. doxygenfunction:: ze_querying_subscriber_get

.. doxygenfunction:: ze_querying_subscriber_drop
Expand Down
4 changes: 2 additions & 2 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Subscribe
z_view_keyexpr_from_string(&key_expr, "key/expression");
z_owned_subscriber_t sub;
if (z_subscriber_declare(&sub, z_loan(s), z_loan(key_expr) z_move(callback), NULL) != 0) {
if (z_declare_subscriber(z_loan(s), &sub, z_loan(key_expr) z_move(callback), NULL) != 0) {
printf("Unable to create Zenoh subscriber.\n");
z_drop(z_move(s));
exit(-1);
Expand Down Expand Up @@ -195,7 +195,7 @@ Queryable
z_closure(&callback, query_handler, NULL, (void*)keyexpr);
z_owned_queryable_t qable;
if (z_queryable_declare(&qable, z_loan(s), z_loan(key_expr), z_move(callback), NULL) < 0) {
if (z_declare_queryable(z_loan(s), &qable, z_loan(key_expr), z_move(callback), NULL) < 0) {
printf("Unable to create Zenoh queryable.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main(int argc, char** argv) {

printf("Declaring liveliness token '%s'...\n", args.keyexpr);
zc_owned_liveliness_token_t token;
if (zc_liveliness_declare_token(&token, z_loan(s), z_loan(keyexpr), NULL) < 0) {
if (zc_liveliness_declare_token(z_loan(s), &token, z_loan(keyexpr), NULL) < 0) {
printf("Unable to create liveliness token!\n");
exit(-1);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publisher_declare(&pub, z_loan(session), z_loan(ping), NULL);
z_declare_publisher(z_loan(session), &pub, z_loan(ping), NULL);
z_owned_closure_sample_t respond;
z_closure(&respond, callback, drop, (void*)(&pub));
z_owned_subscriber_t sub;
z_subscriber_declare(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL);
z_declare_subscriber(&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;
Expand Down
4 changes: 2 additions & 2 deletions examples/z_ping_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publisher_declare(&pub, z_loan(session), z_loan(ping), NULL);
z_declare_publisher(z_loan(session), &pub, z_loan(ping), NULL);
z_owned_closure_sample_t respond;
z_closure(&respond, callback, drop, (void*)(&pub));
z_owned_subscriber_t sub;
z_subscriber_declare(&sub, z_loan(session), z_loan(pong), z_move(respond), NULL);
z_declare_subscriber(z_loan(session), &sub, z_loan(pong), z_move(respond), NULL);

// Create SHM Provider
z_alloc_alignment_t alignment = {0};
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publisher_declare(&pub, z_loan(session), z_loan(pong), NULL);
z_declare_publisher(z_loan(session), &pub, z_loan(pong), NULL);
z_owned_closure_sample_t respond;
z_closure(&respond, callback, drop, (void*)&pub);
z_subscriber_declare_background(z_loan(session), z_loan(ping), z_move(respond), NULL);
z_declare_background_subscriber(z_loan(session), z_loan(ping), z_move(respond), NULL);

while (1) {
z_sleep_s(1);
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) {
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) {
printf("Unable to declare Publisher for key expression!\n");
exit(-1);
}
Expand All @@ -64,7 +64,7 @@ int main(int argc, char** argv) {
if (args.add_matching_listener) {
zc_owned_closure_matching_status_t callback;
z_closure(&callback, matching_status_handler, NULL, NULL);
zc_publisher_matching_listener_declare(&listener, z_loan(pub), z_move(callback));
zc_publisher_declare_matching_listener(z_loan(pub), &listener, z_move(callback));
}
#else
if (args.add_matching_listener) {
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL)) {
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL)) {
printf("Unable to declare Publisher for key expression!\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publication_cache_declare(&pub_cache, z_loan(s), z_loan(ke), &pub_cache_opts) != Z_OK) {
if (ze_declare_publication_cache(z_loan(s), &pub_cache, z_loan(ke), &pub_cache_opts) != Z_OK) {
printf("Unable to declare publication cache for key expression!\n");
exit(-1);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/z_pub_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publisher_declare(&pub, z_loan(s), z_loan(ke), NULL) < 0) {
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), NULL) < 0) {
printf("Unable to declare Publisher for key expression!\n");
exit(-1);
}
Expand All @@ -64,7 +64,7 @@ int main(int argc, char** argv) {
if (args.add_matching_listener) {
zc_owned_closure_matching_status_t callback;
z_closure(&callback, matching_status_handler, NULL, NULL);
zc_publisher_matching_listener_declare(&listener, z_loan(pub), z_move(callback));
zc_publisher_declare_matching_listener(z_loan(pub), &listener, z_move(callback));
}
#else
if (add_matching_listener) {
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_shm_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publisher_declare(&pub, z_loan(s), z_loan(ke), &options)) {
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), &options)) {
printf("Unable to declare publisher for key expression!\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_publisher_declare(&pub, z_loan(s), z_loan(ke), &options)) {
if (z_declare_publisher(z_loan(s), &pub, z_loan(ke), &options)) {
printf("Unable to declare publisher for key expression!\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(closure), NULL) < 0) {
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(closure), NULL) < 0) {
printf("Unable to declare subscriber.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_query_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_querying_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), &sub_opts) < 0) {
if (ze_declare_querying_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), &sub_opts) < 0) {
printf("Unable to declare querying subscriber.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ int main(int argc, char **argv) {
z_closure(&callback, query_handler, NULL, (void *)args.keyexpr);
z_owned_queryable_t qable;

if (z_queryable_declare(&qable, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) {
if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to create queryable.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_queryable_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ int main(int argc, char **argv) {
z_closure(&callback, query_handler, (void *)z_loan(provider), (void *)keyexpr);
z_owned_queryable_t qable;

if (z_queryable_declare(&qable, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) {
if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to create queryable.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_queryable_with_channels.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char** argv) {
z_fifo_channel_query_new(&closure, &handler, 16);
z_owned_queryable_t qable;

if (z_queryable_declare(&qable, z_loan(s), z_loan(ke), z_move(closure), NULL) < 0) {
if (z_declare_queryable(z_loan(s), &qable, z_loan(ke), z_move(closure), NULL) < 0) {
printf("Unable to create queryable.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) {
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare subscriber.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub_attachment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL)) {
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL)) {
printf("Unable to declare subscriber.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub_liveliness.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) {
if (zc_liveliness_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare liveliness subscriber.\n");
exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/z_sub_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_subscriber_declare(&sub, z_loan(s), z_loan(ke), z_move(callback), NULL) < 0) {
if (z_declare_subscriber(z_loan(s), &sub, z_loan(ke), z_move(callback), NULL) < 0) {
printf("Unable to declare subscriber.\n");
exit(-1);
}
Expand Down
6 changes: 3 additions & 3 deletions examples/z_sub_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ int main(int argc, char **argv) {
z_view_keyexpr_t ke;
z_view_keyexpr_from_str(&ke, "test/thr");
z_owned_keyexpr_t declared_ke;
z_declare_keyexpr(&declared_ke, z_loan(s), z_loan(ke));
z_declare_keyexpr(z_loan(s), &declared_ke, z_loan(ke));

z_stats_t *context = z_stats_make();
z_owned_closure_sample_t callback;
z_closure(&callback, on_sample, drop_stats, context);
if (z_subscriber_declare_background(z_loan(s), z_loan(declared_ke), z_move(callback), NULL)) {
if (z_declare_background_subscriber(z_loan(s), z_loan(declared_ke), z_move(callback), NULL)) {
printf("Unable to create subscriber.\n");
exit(-1);
}
Expand All @@ -105,7 +105,7 @@ int main(int argc, char **argv) {
z_sleep_s(1);
}

z_undeclare_keyexpr(z_move(declared_ke), z_loan(s));
z_undeclare_keyexpr(z_loan(s), z_move(declared_ke));
z_drop(z_move(s));
return 0;
}
Expand Down
Loading

0 comments on commit c672563

Please sign in to comment.