return std::move(get_omap_vals_by_keys(keys, kv, ec));
}
- ReadOp& list_watchers(std::vector<struct ObjWatcher>* watchers,
+ ReadOp& list_watchers(std::vector<ObjWatcher>* watchers,
boost::system::error_code* ec = nullptr) &;
- ReadOp&& list_watchers(std::vector<struct ObjWatcher>* watchers,
+ ReadOp&& list_watchers(std::vector<ObjWatcher>* watchers,
boost::system::error_code* ec = nullptr) && {
return std::move(list_watchers(watchers, ec));
}
}, consigned);
}
+ tl::expected<ceph::timespan, boost::system::error_code>
+ check_watch(uint64_t cookie);
+
using NotifySig = void(boost::system::error_code, ceph::buffer::list);
using NotifyComp = boost::asio::any_completion_handler<NotifySig>;
template<boost::asio::completion_token_for<NotifySig> CompletionToken>
void watch_(Object o, IOContext ioc,
std::optional<std::chrono::seconds> timeout,
WatchCB cb, WatchComp c);
- tl::expected<ceph::timespan, boost::system::error_code>
- watch_check_(uint64_t cookie);
void notify_ack_(Object o, IOContext _ioc,
uint64_t notify_id,
uint64_t cookie,
nullptr, ioc->extra_op_flags, std::move(c));
}
-tl::expected<ceph::timespan, bs::error_code> RADOS::watch_check_(uint64_t cookie)
+tl::expected<ceph::timespan, bs::error_code> RADOS::check_watch(uint64_t cookie)
{
- Objecter::LingerOp *linger_op = reinterpret_cast<Objecter::LingerOp*>(cookie);
- return impl->objecter->linger_check(linger_op);
+ auto linger_op = reinterpret_cast<Objecter::LingerOp*>(cookie);
+ if (impl->objecter->is_valid_watch(linger_op)) {
+ return impl->objecter->linger_check(linger_op);
+ } else {
+ return tl::unexpected(bs::error_code(ENOTCONN, bs::generic_category()));
+ }
}
void RADOS::unwatch_(uint64_t cookie, IOContext _ioc,
std::map<uint64_t, LingerOp*> linger_ops;
// we use this just to confirm a cookie is valid before dereferencing the ptr
- std::set<LingerOp*> linger_ops_set;
+ std::unordered_set<LingerOp*> linger_ops_set;
std::map<ceph_tid_t,PoolStatOp*> poolstat_ops;
std::map<ceph_tid_t,StatfsOp*> statfs_ops;
friend class CB_Objecter_GetVersion;
friend class CB_DoWatchError;
public:
+
+ bool is_valid_watch(LingerOp* op) {
+ std::shared_lock l(rwlock);
+ return linger_ops_set.contains(op);
+ }
+
template<typename CT>
auto linger_callback_flush(CT&& ct) {
auto consigned = boost::asio::consign(