diff options
author | Kefu Chai <kchai@redhat.com> | 2018-09-03 11:15:16 +0200 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2018-09-06 16:03:33 +0200 |
commit | 5368e7e0e5a0900961b0ad0652b4e21a91c83d13 (patch) | |
tree | 3c8cfd989580a89ce73f444b6cdaf7c832628fa7 /src/common/ceph_context.cc | |
parent | Merge pull request #23846 from liewegas/wip-mgr-config-fixes (diff) | |
download | ceph-5368e7e0e5a0900961b0ad0652b4e21a91c83d13.tar.xz ceph-5368e7e0e5a0900961b0ad0652b4e21a91c83d13.zip |
common: specialize for WITH_SEASTAR
* define a specialized version CephContext for WITH_SEASTAR. this
CephContext exposes the minimal set of interface for ceph::mon::Client
* do not include unused stuff defined in common_init.cc, as it
introduces more compile-time dependencies we need to prepare to
appease the compiler.
* implement g_conf() for WITH_SEASTAR, so it returns
ceph::common::local_conf() if WITH_SEASTAR is defined.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/common/ceph_context.cc')
-rw-r--r-- | src/common/ceph_context.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/common/ceph_context.cc b/src/common/ceph_context.cc index e311eae3880..41d1f47bf11 100644 --- a/src/common/ceph_context.cc +++ b/src/common/ceph_context.cc @@ -44,6 +44,40 @@ using ceph::bufferlist; using ceph::HeartbeatMap; +#ifdef WITH_SEASTAR +CephContext::CephContext() + : _conf{ceph::common::local_conf()}, + _crypto_random{std::make_unique<CryptoRandom>()} +{} + +// define the dtor in .cc as CryptoRandom is an incomplete type in the header +CephContext::~CephContext() +{} + +CryptoRandom* CephContext::random() const +{ + return _crypto_random.get(); +} + +CephContext* CephContext::get() +{ + ++nref; + return this; +} + +void CephContext::put() +{ + if (--nref == 0) { + delete this; + } +} + +PerfCountersCollection* CephContext::get_perfcounters_collection() +{ + throw std::runtime_error("not yet implemented"); +} + +#else // WITH_SEASTAR namespace { class LockdepObs : public md_config_obs_t { @@ -848,3 +882,4 @@ void CephContext::notify_post_fork() for (auto &&t : _fork_watchers) t->handle_post_fork(); } +#endif // WITH_SEASTAR |