namespace crimson::osd {
-bool Watch::NotifyCmp::operator()(NotifyRef lhs, NotifyRef rhs) const
-{
- ceph_assert(lhs);
- ceph_assert(rhs);
- return lhs->get_id() < rhs->get_id();
-}
-
seastar::future<> Watch::connect(crimson::net::ConnectionRef conn, bool)
{
if (this->conn == conn) {
void Watch::cancel_notify(const uint64_t notify_id)
{
logger().info("{} notify_id={}", __func__, notify_id);
- const auto it = std::find_if(
- std::begin(in_progress_notifies), std::end(in_progress_notifies),
- [notify_id] (const auto& notify) {
- return notify->ninfo.notify_id == notify_id;
- });
+ const auto it = in_progress_notifies.find(notify_id);
assert(it != std::end(in_progress_notifies));
in_progress_notifies.erase(it);
}
// used by create().
struct private_ctag_t{};
- struct NotifyCmp {
- inline bool operator()(NotifyRef lhs, NotifyRef rhs) const;
- };
- std::set<NotifyRef, NotifyCmp> in_progress_notifies;
+ std::set<NotifyRef, std::less<>> in_progress_notifies;
crimson::net::ConnectionRef conn;
crimson::osd::ObjectContextRef obc;
// used by create_n_propagate factory.
struct private_ctag_t{};
+ using ptr_t = seastar::shared_ptr<Notify>;
+ friend bool operator<(const ptr_t& lhs, const ptr_t& rhs) {
+ assert(lhs);
+ assert(rhs);
+ return lhs->get_id() < rhs->get_id();
+ }
+ friend bool operator<(const ptr_t& ptr, const uint64_t id) {
+ assert(ptr);
+ return ptr->get_id() < id;
+ }
+ friend bool operator<(const uint64_t id, const ptr_t& ptr) {
+ assert(ptr);
+ return id < ptr->get_id();
+ }
+
friend Watch;
public: