Skip to content

Commit

Permalink
deprecate publication cache and advanced subscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Dec 19, 2024
1 parent b1bd209 commit d46756b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion include/zenoh/api/ext/publication_cache.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ namespace zenoh::ext {
/// Used to store publications on intersecting key expressions. Can be queried later via `zenoh::Session::get` to
/// retrieve this data.
/// @note Zenoh-c only
class PublicationCache : public Owned<::ze_owned_publication_cache_t> {
class [[deprecated("Use zenoh::ext::AdvancedPublisher instead.")]] PublicationCache
: public Owned<::ze_owned_publication_cache_t> {
PublicationCache(zenoh::detail::null_object_t) : Owned(nullptr){};
friend struct interop::detail::Converter;

Expand Down
2 changes: 1 addition & 1 deletion include/zenoh/api/ext/querying_subscriber.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class QueryingSubscriberBase : public Owned<::ze_owned_querying_subscriber_t> {
} // namespace detail

template <class Handler>
class QueryingSubscriber;
class [[deprecated("Use zenoh::ext::AdvancedSubscriber instead.")]] QueryingSubscriber;

/// @warning This API has been marked as unstable: it works as advertised, but it may be changed in a future release.
/// @brief A Zenoh querying subscriber.
Expand Down
21 changes: 12 additions & 9 deletions include/zenoh/api/ext/session_ext.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class SessionExt {
/// @param err if not null, the result code will be written to this location, otherwise ZException exception will be
/// thrown in case of error.
/// @return declared ``PublicationCache`` instance.
[[nodiscard]] PublicationCache declare_publication_cache(
[[deprecated("Use declare_advanced_publisher instead.")]] [[nodiscard]] PublicationCache declare_publication_cache(
const KeyExpr& key_expr, PublicationCacheOptions&& options = PublicationCacheOptions::create_default(),
zenoh::ZResult* err = nullptr) const {
::ze_publication_cache_options_t opts = zenoh::interop::detail::Converter::to_c_opts(options);
Expand All @@ -112,6 +112,7 @@ class SessionExt {
/// @param options additional options for the publication cache.
/// @param err if not null, the result code will be written to this location, otherwise ZException exception will be
/// thrown in case of error.
[[deprecated]]
void declare_background_publication_cache(
const KeyExpr& key_expr, PublicationCacheOptions&& options = PublicationCacheOptions::create_default(),
zenoh::ZResult* err = nullptr) const {
Expand Down Expand Up @@ -176,10 +177,10 @@ class SessionExt {
/// thrown in case of error.
/// @return declared ``QueryingSubscriber`` instance.
template <class C, class D>
[[nodiscard]] QueryingSubscriber<void> declare_querying_subscriber(
const KeyExpr& key_expr, C&& on_sample, D&& on_drop,
QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(),
zenoh::ZResult* err = nullptr) const {
[[nodiscard]] [[deprecated("Use declare_advanced_subscriber instead.")]] QueryingSubscriber<void>
declare_querying_subscriber(const KeyExpr& key_expr, C&& on_sample, D&& on_drop,
QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(),
zenoh::ZResult* err = nullptr) const {
static_assert(
std::is_invocable_r<void, C, zenoh::Sample&>::value,
"on_sample should be callable with the following signature: void on_sample(zenoh::Sample& sample)");
Expand Down Expand Up @@ -212,6 +213,7 @@ class SessionExt {
/// @param err if not null, the result code will be written to this location, otherwise ZException exception will be
/// thrown in case of error.
template <class C, class D>
[[deprecated("Use declare_background_advanced_subscriber instead.")]]
void declare_background_querying_subscriber(
const KeyExpr& key_expr, C&& on_sample, D&& on_drop,
QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(),
Expand Down Expand Up @@ -247,10 +249,11 @@ class SessionExt {
/// thrown in case of error.
/// @return a ``QueryingSubscriber`` object.
template <class Channel>
[[nodiscard]] QueryingSubscriber<typename Channel::template HandlerType<zenoh::Sample>> declare_querying_subscriber(
const KeyExpr& key_expr, Channel channel,
QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(),
zenoh::ZResult* err = nullptr) const {
[[deprecated("Use declare_advanced_subscriber instead.")]] [[nodiscard]] QueryingSubscriber<
typename Channel::template HandlerType<zenoh::Sample>>
declare_querying_subscriber(const KeyExpr& key_expr, Channel channel,
QueryingSubscriberOptions&& options = QueryingSubscriberOptions::create_default(),
zenoh::ZResult* err = nullptr) const {
auto cb_handler_pair = channel.template into_cb_handler_pair<Sample>();
::ze_querying_subscriber_options_t opts = zenoh::interop::detail::Converter::to_c_opts(options);
QueryingSubscriber<void> qs = zenoh::interop::detail::null<QueryingSubscriber<void>>();
Expand Down

0 comments on commit d46756b

Please sign in to comment.