]>
git.proxmox.com Git - ceph.git/blob - ceph/src/tools/rbd_mirror/Mirror.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_RBD_MIRROR_H
5 #define CEPH_RBD_MIRROR_H
7 #include "common/ceph_context.h"
8 #include "common/Mutex.h"
9 #include "include/rados/librados.hpp"
10 #include "ClusterWatcher.h"
11 #include "PoolReplayer.h"
12 #include "ImageDeleter.h"
20 namespace librbd
{ struct ImageCtx
; }
25 template <typename
> struct Threads
;
26 class MirrorAdminSocketHook
;
29 * Contains the main loop and overall state for rbd-mirror.
31 * Sets up mirroring, and coordinates between noticing config
32 * changes and applying them.
36 Mirror(CephContext
*cct
, const std::vector
<const char*> &args
);
37 Mirror(const Mirror
&) = delete;
38 Mirror
& operator=(const Mirror
&) = delete;
43 void handle_signal(int signum
);
45 void print_status(Formatter
*f
, stringstream
*ss
);
50 void release_leader();
53 typedef ClusterWatcher::PoolPeers PoolPeers
;
54 typedef std::pair
<int64_t, peer_t
> PoolPeer
;
56 void update_pool_replayers(const PoolPeers
&pool_peers
);
59 std::vector
<const char*> m_args
;
60 Threads
<librbd::ImageCtx
> *m_threads
= nullptr;
65 // monitor local cluster for config changes in peers
66 std::unique_ptr
<ClusterWatcher
> m_local_cluster_watcher
;
67 std::shared_ptr
<ImageDeleter
> m_image_deleter
;
68 std::map
<PoolPeer
, std::unique_ptr
<PoolReplayer
> > m_pool_replayers
;
69 std::atomic
<bool> m_stopping
= { false };
70 bool m_manual_stop
= false;
71 MirrorAdminSocketHook
*m_asok_hook
;
77 #endif // CEPH_RBD_MIRROR_H