Skip to content

Commit

Permalink
rgw: move rgw_cache.h types to namespace rgw::cache
Browse files Browse the repository at this point in the history
Use c++2017 notation mostly.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
  • Loading branch information
mattbenjamin committed Jan 20, 2018
1 parent e8899b2 commit 59d0740
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/rgw/rgw_cache.cc
Expand Up @@ -7,6 +7,7 @@

#define dout_subsys ceph_subsys_rgw

namespace rgw::cache {

int ObjectCache::get(std::string& name, ObjectCacheInfo& info, uint32_t mask,
rgw_cache_entry_info* cache_info)
Expand Down Expand Up @@ -314,3 +315,5 @@ void ObjectCache::chain_cache(RGWChainedCache *cache) {
RWLock::WLocker l(lock);
chained_cache.push_back(cache);
}

} /* namespace rgw::cache */
4 changes: 4 additions & 0 deletions src/rgw/rgw_cache.h
Expand Up @@ -13,6 +13,8 @@
#include "include/assert.h"
#include "common/RWLock.h"

namespace rgw::cache {

enum {
UPDATE_OBJ,
REMOVE_OBJ,
Expand Down Expand Up @@ -615,4 +617,6 @@ int RGWCache<T>::watch_cb(uint64_t notify_id,
return 0;
}

} /* namespace rgw::cache */

#endif
6 changes: 5 additions & 1 deletion src/rgw/rgw_dencoder.cc
Expand Up @@ -347,8 +347,10 @@ void RGWAccessControlPolicy::generate_test_instances(list<RGWAccessControlPolicy
o.push_back(new RGWAccessControlPolicy(NULL));
}

namespace rgw::cache {

void ObjectMetaInfo::generate_test_instances(list<ObjectMetaInfo*>& o)
void ObjectMetaInfo::generate_test_instances(
list<ObjectMetaInfo*>& o)
{
ObjectMetaInfo *m = new ObjectMetaInfo;
m->size = 1024 * 1024;
Expand Down Expand Up @@ -382,6 +384,8 @@ void RGWCacheNotifyInfo::generate_test_instances(list<RGWCacheNotifyInfo*>& o)
o.push_back(new RGWCacheNotifyInfo);
}

} /* namespace rgw::cache */

void RGWAccessKey::generate_test_instances(list<RGWAccessKey*>& o)
{
RGWAccessKey *k = new RGWAccessKey;
Expand Down
4 changes: 4 additions & 0 deletions src/rgw/rgw_json_enc.cc
Expand Up @@ -215,6 +215,8 @@ void RGWAccessControlPolicy::dump(Formatter *f) const
encode_json("owner", owner, f);
}

namespace rgw::cache {

void ObjectMetaInfo::dump(Formatter *f) const
{
encode_json("size", size, f);
Expand All @@ -241,6 +243,8 @@ void RGWCacheNotifyInfo::dump(Formatter *f) const
encode_json("ns", ns, f);
}

} /* namespace rgw::cache */

void RGWAccessKey::dump(Formatter *f) const
{
encode_json("access_key", id, f);
Expand Down
18 changes: 11 additions & 7 deletions src/rgw/rgw_rados.cc
Expand Up @@ -13829,17 +13829,21 @@ uint64_t RGWRados::next_bucket_id()
return ++max_bucket_id;
}

RGWRados *RGWStoreManager::init_storage_provider(CephContext *cct, bool use_gc_thread, bool use_lc_thread, bool quota_threads, bool run_sync_thread, bool run_reshard_thread)
RGWRados *RGWStoreManager::init_storage_provider(
CephContext *cct, bool use_gc_thread, bool use_lc_thread,
bool quota_threads, bool run_sync_thread, bool run_reshard_thread)
{
int use_cache = cct->_conf->rgw_cache_enabled;
RGWRados *store = NULL;
if (!use_cache) {
store = new RGWRados;
const auto use_cache = cct->_conf->get_val<bool>("rgw_cache_enabled");
RGWRados* store{nullptr};

if (use_cache) {
store = new rgw::cache::RGWCache<RGWRados>;
} else {
store = new RGWCache<RGWRados>;
store = new RGWRados;
}

if (store->initialize(cct, use_gc_thread, use_lc_thread, quota_threads, run_sync_thread, run_reshard_thread) < 0) {
if (store->initialize(cct, use_gc_thread, use_lc_thread, quota_threads,
run_sync_thread, run_reshard_thread) < 0) {
delete store;
return NULL;
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/encoding/types.h
Expand Up @@ -307,9 +307,9 @@ TYPE(ACLOwner)
TYPE(RGWAccessControlPolicy)

#include "rgw/rgw_cache.h"
TYPE(ObjectMetaInfo)
TYPE(ObjectCacheInfo)
TYPE(RGWCacheNotifyInfo)
TYPE(rgw::cache::ObjectMetaInfo)
TYPE(rgw::cache::ObjectCacheInfo)
TYPE(rgw::cache::RGWCacheNotifyInfo)

#include "rgw/rgw_lc.h"
TYPE(RGWLifecycleConfiguration)
Expand Down

0 comments on commit 59d0740

Please sign in to comment.