diff options
author | Kefu Chai <kchai@redhat.com> | 2020-11-21 10:26:37 +0100 |
---|---|---|
committer | Kefu Chai <kchai@redhat.com> | 2020-12-06 05:13:42 +0100 |
commit | 1684f60f7e984017627a91ac84920cc51244cf20 (patch) | |
tree | bdb439d4a3e77d75775ed1b60634dd3106b5a3c5 /src/compressor | |
parent | Merge pull request #38442 from badone/wip-bump-fmt-package-min-version (diff) | |
download | ceph-1684f60f7e984017627a91ac84920cc51244cf20.tar.xz ceph-1684f60f7e984017627a91ac84920cc51244cf20.zip |
compressor: put Compressor into TOPNSPC namespace
we want to add the support for on-the-wire compression to msgr v2, and
this feature will be shared by classic osd and crimson. but
Compressor.cc is also used by bluestore which is linked against by
crimson also. Compressor depends on CephContext which has two different
implementation in two namespaces for classic osd and crison.
so to avoid violating ODR, we should also put Compressor into two
different namespaces so it can be shared by alienstore and crimson in
the same executable.
Signed-off-by: Kefu Chai <kchai@redhat.com>
Diffstat (limited to 'src/compressor')
-rw-r--r-- | src/compressor/CompressionPlugin.h | 11 | ||||
-rw-r--r-- | src/compressor/Compressor.cc | 4 | ||||
-rw-r--r-- | src/compressor/Compressor.h | 3 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/compressor/CompressionPlugin.h b/src/compressor/CompressionPlugin.h index 5e0ed777b85..2a21f2fef27 100644 --- a/src/compressor/CompressionPlugin.h +++ b/src/compressor/CompressionPlugin.h @@ -22,22 +22,23 @@ #include <iostream> #include "common/PluginRegistry.h" +#include "include/common_fwd.h" #include "Compressor.h" namespace ceph { class CompressionPlugin : public Plugin { public: - CompressorRef compressor; + TOPNSPC::CompressorRef compressor; - explicit CompressionPlugin(CephContext *cct) : Plugin(cct), - compressor(0) + explicit CompressionPlugin(CephContext *cct) + : Plugin(cct) {} ~CompressionPlugin() override {} - virtual int factory(CompressorRef *cs, - std::ostream *ss) = 0; + virtual int factory(TOPNSPC::CompressorRef *cs, + std::ostream *ss) = 0; virtual const char* name() {return "CompressionPlugin";} }; diff --git a/src/compressor/Compressor.cc b/src/compressor/Compressor.cc index e6faae164f1..4cd3406d7a9 100644 --- a/src/compressor/Compressor.cc +++ b/src/compressor/Compressor.cc @@ -24,6 +24,8 @@ #include "common/debug.h" #include "common/dout.h" +namespace TOPNSPC { + const char* Compressor::get_comp_alg_name(int a) { auto p = std::find_if(std::cbegin(compression_algorithms), std::cend(compression_algorithms), @@ -100,3 +102,5 @@ CompressorRef Compressor::create(CephContext *cct, int alg) std::string type_name = get_comp_alg_name(alg); return create(cct, type_name); } + +} // namespace TOPNSPC diff --git a/src/compressor/Compressor.h b/src/compressor/Compressor.h index 6a4eb277668..d615e866b55 100644 --- a/src/compressor/Compressor.h +++ b/src/compressor/Compressor.h @@ -27,6 +27,8 @@ #include "QatAccel.h" #endif +namespace TOPNSPC { + class Compressor; typedef std::shared_ptr<Compressor> CompressorRef; @@ -103,4 +105,5 @@ protected: }; +} // namespace TOPNSPC #endif |