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_METADATA_COPY_REQUEST_H
5 #define RBD_MIRROR_IMAGE_SYNC_METADATA_COPY_REQUEST_H
7 #include "include/int_types.h"
8 #include "include/buffer.h"
9 #include "include/rados/librados.hpp"
10 #include "librbd/ImageCtx.h"
18 namespace image_sync
{
20 template <typename ImageCtxT
= librbd::ImageCtx
>
21 class MetadataCopyRequest
{
23 static MetadataCopyRequest
* create(ImageCtxT
*local_image_ctx
,
24 ImageCtxT
*remote_image_ctx
,
26 return new MetadataCopyRequest(local_image_ctx
, remote_image_ctx
,
30 MetadataCopyRequest(ImageCtxT
*local_image_ctx
, ImageCtxT
*remote_image_ctx
,
32 : m_local_image_ctx(local_image_ctx
), m_remote_image_ctx(remote_image_ctx
),
33 m_on_finish(on_finish
) {
45 * LIST_REMOTE_METADATA <-----\
46 * | | (repeat if additional
48 * SET_LOCAL_METADATA --------/
55 typedef std::map
<std::string
, bufferlist
> Metadata
;
57 ImageCtxT
*m_local_image_ctx
;
58 ImageCtxT
*m_remote_image_ctx
;
63 std::string m_last_metadata_key
;
64 bool m_more_metadata
= false;
66 void list_remote_metadata();
67 void handle_list_remote_data(int r
);
69 void set_local_metadata(const Metadata
& metadata
);
70 void handle_set_local_metadata(int r
);
76 } // namespace image_sync
80 extern template class rbd::mirror::image_sync::MetadataCopyRequest
<librbd::ImageCtx
>;
82 #endif // RBD_MIRROR_IMAGE_SYNC_METADATA_COPY_REQUEST_H