1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_LIBRBD_OPERATION_SNAPSHOT_PROTECT_REQUEST_H
5 #define CEPH_LIBRBD_OPERATION_SNAPSHOT_PROTECT_REQUEST_H
7 #include "librbd/operation/Request.h"
18 template <typename ImageCtxT = ImageCtx>
19 class SnapshotProtectRequest : public Request<ImageCtxT> {
22 * Snap Protect goes through the following state machine:
41 SnapshotProtectRequest(ImageCtxT &image_ctx, Context *on_finish,
42 const cls::rbd::SnapshotNamespace &snap_namespace,
43 const std::string &snap_name);
46 void send_op() override;
47 bool should_complete(int r) override;
49 journal::Event create_event(uint64_t op_tid) const override {
50 return journal::SnapProtectEvent(op_tid, m_snap_namespace, m_snap_name);
54 cls::rbd::SnapshotNamespace m_snap_namespace;
55 std::string m_snap_name;
58 void send_protect_snap();
60 int verify_and_send_protect_snap();
63 } // namespace operation
66 extern template class librbd::operation::SnapshotProtectRequest<librbd::ImageCtx>;
68 #endif // CEPH_LIBRBD_OPERATION_SNAPSHOT_PROTECT_REQUEST_H