1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef RBD_MIRROR_IMAGE_SYNC_SNAPSHOT_CREATE_REQUEST_H
5 #define RBD_MIRROR_IMAGE_SYNC_SNAPSHOT_CREATE_REQUEST_H
7 #include "include/int_types.h"
8 #include "include/rados/librados.hpp"
9 #include "common/snap_types.h"
10 #include "librbd/ImageCtx.h"
11 #include "librbd/Types.h"
12 #include "librbd/journal/TypeTraits.h"
22 namespace image_sync
{
24 template <typename ImageCtxT
= librbd::ImageCtx
>
25 class SnapshotCreateRequest
{
27 static SnapshotCreateRequest
* create(ImageCtxT
*local_image_ctx
,
28 const std::string
&snap_name
,
29 const cls::rbd::SnapshotNamespace
&snap_namespace
,
31 const librbd::ParentSpec
&parent_spec
,
32 uint64_t parent_overlap
,
34 return new SnapshotCreateRequest(local_image_ctx
, snap_name
, snap_namespace
, size
,
35 parent_spec
, parent_overlap
, on_finish
);
38 SnapshotCreateRequest(ImageCtxT
*local_image_ctx
,
39 const std::string
&snap_name
,
40 const cls::rbd::SnapshotNamespace
&snap_namespace
,
42 const librbd::ParentSpec
&parent_spec
,
43 uint64_t parent_overlap
, Context
*on_finish
);
53 * v (skip if not needed)
56 * v (skip if not needed)
59 * v (skip if not needed)
65 * v (skip if not needed)
74 ImageCtxT
*m_local_image_ctx
;
75 std::string m_snap_name
;
76 cls::rbd::SnapshotNamespace m_snap_namespace
;
78 librbd::ParentSpec m_parent_spec
;
79 uint64_t m_parent_overlap
;
83 void handle_set_size(int r
);
85 void send_remove_parent();
86 void handle_remove_parent(int r
);
88 void send_set_parent();
89 void handle_set_parent(int r
);
91 void send_snap_create();
92 void handle_snap_create(int r
);
94 void send_create_object_map();
95 void handle_create_object_map(int r
);
97 Context
*start_local_op(int *r
);
102 } // namespace image_sync
103 } // namespace mirror
106 extern template class rbd::mirror::image_sync::SnapshotCreateRequest
<librbd::ImageCtx
>;
108 #endif // RBD_MIRROR_IMAGE_SYNC_SNAPSHOT_CREATE_REQUEST_H