X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Flibrbd%2Fwatcher%2FUtils.h;fp=src%2Fceph%2Fsrc%2Flibrbd%2Fwatcher%2FUtils.h;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=78966d6a58a1be25fe6ddfc0c5c9df339468dcf0;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/librbd/watcher/Utils.h b/src/ceph/src/librbd/watcher/Utils.h deleted file mode 100644 index 78966d6..0000000 --- a/src/ceph/src/librbd/watcher/Utils.h +++ /dev/null @@ -1,73 +0,0 @@ -// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- -// vim: ts=8 sw=2 smarttab - -#ifndef CEPH_LIBRBD_WATCHER_UTILS_H -#define CEPH_LIBRBD_WATCHER_UTILS_H - -#include "include/buffer_fwd.h" -#include "include/encoding.h" -#include "include/Context.h" -#include "librbd/Watcher.h" - -namespace ceph { class Formatter; } - -namespace librbd { -namespace watcher { -namespace util { - -template -struct HandlePayloadVisitor : public boost::static_visitor { - Watcher *watcher; - uint64_t notify_id; - uint64_t handle; - - HandlePayloadVisitor(Watcher *watcher_, uint64_t notify_id_, - uint64_t handle_) - : watcher(watcher_), notify_id(notify_id_), handle(handle_) - { - } - - template - inline void operator()(const P &payload) const { - typename Watcher::C_NotifyAck *ctx = - new typename Watcher::C_NotifyAck(watcher, notify_id, handle); - if (watcher->handle_payload(payload, ctx)) { - ctx->complete(0); - } - } -}; - -class EncodePayloadVisitor : public boost::static_visitor { -public: - explicit EncodePayloadVisitor(bufferlist &bl) : m_bl(bl) {} - - template - inline void operator()(const P &payload) const { - ::encode(static_cast(P::NOTIFY_OP), m_bl); - payload.encode(m_bl); - } - -private: - bufferlist &m_bl; -}; - -class DecodePayloadVisitor : public boost::static_visitor { -public: - DecodePayloadVisitor(__u8 version, bufferlist::iterator &iter) - : m_version(version), m_iter(iter) {} - - template - inline void operator()(P &payload) const { - payload.decode(m_version, m_iter); - } - -private: - __u8 m_version; - bufferlist::iterator &m_iter; -}; - -} // namespace util -} // namespace watcher -} // namespace librbd - -#endif // CEPH_LIBRBD_WATCHER_UTILS_H