]>
git.proxmox.com Git - ceph.git/blob - ceph/src/librbd/Operations.h
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_OPERATIONS_H
5 #define CEPH_LIBRBD_OPERATIONS_H
7 #include "cls/rbd/cls_rbd_types.h"
8 #include "include/int_types.h"
9 #include "librbd/operation/ObjectMapIterate.h"
12 #include <boost/function.hpp>
19 class ProgressContext
;
21 template <typename ImageCtxT
= ImageCtx
>
24 Operations(ImageCtxT
&image_ctx
);
26 int flatten(ProgressContext
&prog_ctx
);
27 void execute_flatten(ProgressContext
&prog_ctx
, Context
*on_finish
);
29 int rebuild_object_map(ProgressContext
&prog_ctx
);
30 void execute_rebuild_object_map(ProgressContext
&prog_ctx
,
33 int check_object_map(ProgressContext
&prog_ctx
);
34 void check_object_map(ProgressContext
&prog_ctx
, Context
*on_finish
);
36 void object_map_iterate(ProgressContext
&prog_ctx
,
37 operation::ObjectIterateWork
<ImageCtxT
> handle_mismatch
,
40 int rename(const char *dstname
);
41 void execute_rename(const std::string
&dest_name
, Context
*on_finish
);
43 int resize(uint64_t size
, bool allow_shrink
, ProgressContext
& prog_ctx
);
44 void execute_resize(uint64_t size
, bool allow_shrink
, ProgressContext
&prog_ctx
,
45 Context
*on_finish
, uint64_t journal_op_tid
);
47 int snap_create(const cls::rbd::SnapshotNamespace
&snap_namespace
,
48 const char *snap_name
);
49 void snap_create(const cls::rbd::SnapshotNamespace
&snap_namespace
,
50 const char *snap_name
,
52 void execute_snap_create(const cls::rbd::SnapshotNamespace
&snap_namespace
,
53 const std::string
&snap_name
,
55 uint64_t journal_op_tid
, bool skip_object_map
);
57 int snap_rollback(const cls::rbd::SnapshotNamespace
& snap_namespace
,
58 const char *snap_name
,
59 ProgressContext
& prog_ctx
);
60 void execute_snap_rollback(const cls::rbd::SnapshotNamespace
& snap_namespace
,
61 const std::string
&snap_name
,
62 ProgressContext
& prog_ctx
, Context
*on_finish
);
64 int snap_remove(const cls::rbd::SnapshotNamespace
& snap_namespace
,
65 const char *snap_name
);
66 void snap_remove(const cls::rbd::SnapshotNamespace
& snap_namespace
,
67 const char *snap_name
,
69 void execute_snap_remove(const cls::rbd::SnapshotNamespace
& snap_namespace
,
70 const std::string
&snap_name
,
73 int snap_rename(const char *srcname
, const char *dstname
);
74 void execute_snap_rename(const uint64_t src_snap_id
,
75 const std::string
&dest_snap_name
,
78 int snap_protect(const cls::rbd::SnapshotNamespace
& snap_namespace
,
79 const char *snap_name
);
80 void execute_snap_protect(const cls::rbd::SnapshotNamespace
& snap_namespace
,
81 const std::string
&snap_name
,
84 int snap_unprotect(const cls::rbd::SnapshotNamespace
& snap_namespace
,
85 const char *snap_name
);
86 void execute_snap_unprotect(const cls::rbd::SnapshotNamespace
& snap_namespace
,
87 const std::string
&snap_name
,
90 int snap_set_limit(uint64_t limit
);
91 void execute_snap_set_limit(uint64_t limit
, Context
*on_finish
);
93 int update_features(uint64_t features
, bool enabled
);
94 void execute_update_features(uint64_t features
, bool enabled
,
95 Context
*on_finish
, uint64_t journal_op_tid
);
97 int metadata_set(const std::string
&key
, const std::string
&value
);
98 void execute_metadata_set(const std::string
&key
, const std::string
&value
,
101 int metadata_remove(const std::string
&key
);
102 void execute_metadata_remove(const std::string
&key
, Context
*on_finish
);
104 int prepare_image_update();
107 ImageCtxT
&m_image_ctx
;
108 std::atomic
<int> m_async_request_seq
;
110 int invoke_async_request(const std::string
& request_type
,
111 bool permit_snapshot
,
112 const boost::function
<void(Context
*)>& local
,
113 const boost::function
<void(Context
*)>& remote
);
116 } // namespace librbd
118 extern template class librbd::Operations
<librbd::ImageCtx
>;
120 #endif // CEPH_LIBRBD_OPERATIONS_H