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_SERVICE_DAEMON_H
5 #define CEPH_RBD_MIRROR_SERVICE_DAEMON_H
7 #include "common/Mutex.h"
8 #include "tools/rbd_mirror/types.h"
9 #include "tools/rbd_mirror/service_daemon/Types.h"
15 namespace librbd
{ struct ImageCtx
; }
20 template <typename
> struct Threads
;
22 template <typename ImageCtxT
= librbd::ImageCtx
>
25 ServiceDaemon(CephContext
*cct
, RadosRef rados
, Threads
<ImageCtxT
>* threads
);
30 void add_pool(int64_t pool_id
, const std::string
& pool_name
);
31 void remove_pool(int64_t pool_id
);
33 uint64_t add_or_update_callout(int64_t pool_id
, uint64_t callout_id
,
34 service_daemon::CalloutLevel callout_level
,
35 const std::string
& text
);
36 void remove_callout(int64_t pool_id
, uint64_t callout_id
);
38 void add_or_update_attribute(int64_t pool_id
, const std::string
& key
,
39 const service_daemon::AttributeValue
& value
);
40 void remove_attribute(int64_t pool_id
, const std::string
& key
);
44 service_daemon::CalloutLevel level
;
47 Callout() : level(service_daemon::CALLOUT_LEVEL_INFO
) {
49 Callout(service_daemon::CalloutLevel level
, const std::string
& text
)
50 : level(level
), text(text
) {
53 typedef std::map
<uint64_t, Callout
> Callouts
;
54 typedef std::map
<std::string
, service_daemon::AttributeValue
> Attributes
;
59 Attributes attributes
;
61 Pool(const std::string
& name
) : name(name
) {
65 typedef std::map
<int64_t, Pool
> Pools
;
69 Threads
<ImageCtxT
>* m_threads
;
73 uint64_t m_callout_id
= service_daemon::CALLOUT_ID_NONE
;
75 Context
* m_timer_ctx
= nullptr;
77 void schedule_update_status();
84 extern template class rbd::mirror::ServiceDaemon
<librbd::ImageCtx
>;
86 #endif // CEPH_RBD_MIRROR_SERVICE_DAEMON_H