From: Yehuda Sadeh Date: Fri, 9 Mar 2012 00:58:00 +0000 (-0800) Subject: rgw: add stubs for dencoder test X-Git-Tag: v0.44~39^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2277fb4536e11460376e7ddca8eb8d7fa3ac8279;p=ceph.git rgw: add stubs for dencoder test still need to add some content to the dump methods Signed-off-by: Yehuda Sadeh --- diff --git a/src/Makefile.am b/src/Makefile.am index 21ddf28ac852..b6febc9fd1da 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -291,6 +291,7 @@ librgw_la_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} librgw_la_LIBADD = librados.la librgw_la_LDFLAGS = -version-info 1:0:0 $(PTHREAD_LIBS) -lm $(CRYPTO_LIBS) $(EXTRALIBS) -lexpat -lcurl lib_LTLIBRARIES += librgw.la + endif # librbd @@ -362,6 +363,9 @@ rgw_multiparser_SOURCES = $(my_libradosgw_src) rgw/rgw_multiparser.cc rgw_multiparser_CXXFLAGS = ${CRYPTO_CXXFLAGS} ${AM_CXXFLAGS} rgw_multiparser_LDADD = $(my_radosgw_ldadd) bin_DEBUGPROGRAMS += rgw_multiparser + +ceph_dencoder_LDADD += $(my_radosgw_ldadd) + endif testcrypto_SOURCES = testcrypto.cc diff --git a/src/rgw/rgw_access.cc b/src/rgw/rgw_access.cc index 17b385c49d32..64eb3defeb32 100644 --- a/src/rgw/rgw_access.cc +++ b/src/rgw/rgw_access.cc @@ -11,6 +11,24 @@ static RGWCache cached_rados_provider; static RGWFS fs_provider; static RGWRados rados_provider; +void RGWObjManifestPart::generate_test_instances(std::list& o) +{ + o.push_back(new RGWObjManifestPart); +} + +void RGWObjManifestPart::dump(Formatter *f) const +{ +} + +void RGWObjManifest::generate_test_instances(std::list& o) +{ + o.push_back(new RGWObjManifest); +} + +void RGWObjManifest::dump(Formatter *f) const +{ +} + RGWAccess* RGWAccess::store; RGWAccess::~RGWAccess() diff --git a/src/rgw/rgw_access.h b/src/rgw/rgw_access.h index 4bbf1c831727..62a29b857a78 100644 --- a/src/rgw/rgw_access.h +++ b/src/rgw/rgw_access.h @@ -7,6 +7,7 @@ #include #include +#include "common/Formatter.h" #include "rgw_common.h" struct md_config_t; @@ -46,6 +47,9 @@ struct RGWObjManifestPart { ::decode(size, bl); DECODE_FINISH(bl); } + + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(RGWObjManifestPart); @@ -68,6 +72,9 @@ struct RGWObjManifest { ::decode(objs, bl); DECODE_FINISH(bl); } + + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(RGWObjManifest); diff --git a/src/rgw/rgw_acl.cc b/src/rgw/rgw_acl.cc index c79d3a796999..7d8156ef2201 100644 --- a/src/rgw/rgw_acl.cc +++ b/src/rgw/rgw_acl.cc @@ -15,6 +15,61 @@ using namespace std; +void ACLPermission::generate_test_instances(list& o) +{ + o.push_back(new ACLPermission); +} + +void ACLPermission::dump(Formatter *f) const +{ +} + +void ACLGranteeType::generate_test_instances(list& o) +{ + o.push_back(new ACLGranteeType); +} + +void ACLGranteeType::dump(Formatter *f) const +{ +} + +void ACLGrant::generate_test_instances(list& o) +{ + o.push_back(new ACLGrant); +} + +void ACLGrant::dump(Formatter *f) const +{ +} + +void RGWAccessControlList::generate_test_instances(list& o) +{ + o.push_back(new RGWAccessControlList); +} + +void RGWAccessControlList::dump(Formatter *f) const +{ +} + +void ACLOwner::generate_test_instances(list& o) +{ + o.push_back(new ACLOwner); +} + +void ACLOwner::dump(Formatter *f) const +{ +} + +void RGWAccessControlPolicy::generate_test_instances(list& o) +{ + o.push_back(new RGWAccessControlPolicy); +} + + +void RGWAccessControlPolicy::dump(Formatter *f) const +{ +} + void RGWAccessControlList::_add_grant(ACLGrant *grant) { ACLPermission& perm = grant->get_permission(); diff --git a/src/rgw/rgw_acl.h b/src/rgw/rgw_acl.h index 6a7a0ee93944..cfa401563a34 100644 --- a/src/rgw/rgw_acl.h +++ b/src/rgw/rgw_acl.h @@ -56,6 +56,8 @@ public: ::decode(flags, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(ACLPermission) @@ -80,6 +82,8 @@ public: ::decode(type, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(ACLGranteeType) @@ -154,6 +158,8 @@ public: } DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); ACLGroupTypeEnum uri_to_group(string& uri); @@ -211,6 +217,9 @@ public: } DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); + void add_grant(ACLGrant *grant); multimap& get_grant_map() { return grant_map; } @@ -247,6 +256,8 @@ public: ::decode(display_name, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); void set_id(string& _id) { id = _id; } void set_name(string& name) { display_name = name; } @@ -280,7 +291,9 @@ public: ::decode(owner, bl); ::decode(acl, bl); DECODE_FINISH(bl); - } + } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); void decode_owner(bufferlist::iterator& bl) { // sometimes we only need that, should be faster DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); ::decode(owner, bl); diff --git a/src/rgw/rgw_cache.cc b/src/rgw/rgw_cache.cc index a7ed8acd1a7b..641733d36c86 100644 --- a/src/rgw/rgw_cache.cc +++ b/src/rgw/rgw_cache.cc @@ -7,6 +7,33 @@ using namespace std; +void ObjectMetaInfo::generate_test_instances(list& o) +{ + o.push_back(new ObjectMetaInfo); +} + +void ObjectMetaInfo::dump(Formatter *f) const +{ +} + +void ObjectCacheInfo::generate_test_instances(list& o) +{ + o.push_back(new ObjectCacheInfo); +} + +void ObjectCacheInfo::dump(Formatter *f) const +{ +} + +void RGWCacheNotifyInfo::generate_test_instances(list& o) +{ + o.push_back(new RGWCacheNotifyInfo); +} + +void RGWCacheNotifyInfo::dump(Formatter *f) const +{ +} + int ObjectCache::get(string& name, ObjectCacheInfo& info, uint32_t mask) { Mutex::Locker l(lock); diff --git a/src/rgw/rgw_cache.h b/src/rgw/rgw_cache.h index e3998493d248..78808fb0c03b 100644 --- a/src/rgw/rgw_cache.h +++ b/src/rgw/rgw_cache.h @@ -39,6 +39,8 @@ struct ObjectMetaInfo { mtime = t.sec(); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(ObjectMetaInfo) @@ -73,6 +75,8 @@ struct ObjectCacheInfo { ::decode(rm_xattrs, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(ObjectCacheInfo) @@ -103,6 +107,8 @@ struct RGWCacheNotifyInfo { ::decode(ns, ibl); DECODE_FINISH(ibl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(RGWCacheNotifyInfo) diff --git a/src/rgw/rgw_cls_api.h b/src/rgw/rgw_cls_api.h index 471a52b3b5ae..974570c17a25 100644 --- a/src/rgw/rgw_cls_api.h +++ b/src/rgw/rgw_cls_api.h @@ -6,6 +6,8 @@ #include "include/types.h" #include "include/utime.h" +#include "common/Formatter.h" + #define CEPH_RGW_REMOVE 'r' #define CEPH_RGW_UPDATE 'u' @@ -43,6 +45,8 @@ struct rgw_bucket_pending_info { ::decode(op, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_bucket_pending_info) @@ -82,6 +86,8 @@ struct rgw_bucket_dir_entry_meta { ::decode(content_type, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_bucket_dir_entry_meta) @@ -119,6 +125,8 @@ struct rgw_bucket_dir_entry { } DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_bucket_dir_entry) @@ -141,6 +149,8 @@ struct rgw_bucket_category_stats { ::decode(num_entries, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_bucket_category_stats) @@ -157,6 +167,8 @@ struct rgw_bucket_dir_header { ::decode(stats, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_bucket_dir_header) @@ -176,6 +188,8 @@ struct rgw_bucket_dir { ::decode(m, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_bucket_dir) @@ -204,6 +218,8 @@ struct rgw_cls_obj_prepare_op } DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_obj_prepare_op) @@ -238,6 +254,8 @@ struct rgw_cls_obj_complete_op } DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_obj_complete_op) @@ -258,6 +276,8 @@ struct rgw_cls_list_op ::decode(num_entries, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_list_op) @@ -278,6 +298,8 @@ struct rgw_cls_list_ret ::decode(is_truncated, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_cls_list_ret) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 9b9d3f8307f3..656814da1f85 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -49,6 +49,78 @@ void rgw_perf_stop(CephContext *cct) delete perfcounter; } +void RGWAccessKey::generate_test_instances(list& o) +{ + o.push_back(new RGWAccessKey); +} + +void RGWAccessKey::dump(Formatter *f) const +{ +} + +void RGWSubUser::generate_test_instances(list& o) +{ + o.push_back(new RGWSubUser); +} + +void RGWSubUser::dump(Formatter *f) const +{ +} + +void RGWUserInfo::generate_test_instances(list& o) +{ + o.push_back(new RGWUserInfo); +} + +void RGWUserInfo::dump(Formatter *f) const +{ +} + +void rgw_bucket::generate_test_instances(list& o) +{ + o.push_back(new rgw_bucket); +} + +void rgw_bucket::dump(Formatter *f) const +{ +} + +void RGWBucketInfo::generate_test_instances(list& o) +{ + o.push_back(new RGWBucketInfo); +} + +void RGWBucketInfo::dump(Formatter *f) const +{ +} + +void RGWBucketEnt::generate_test_instances(list& o) +{ + o.push_back(new RGWBucketEnt); +} + +void RGWBucketEnt::dump(Formatter *f) const +{ +} + +void RGWUploadPartInfo::generate_test_instances(list& o) +{ + o.push_back(new RGWUploadPartInfo); +} + +void RGWUploadPartInfo::dump(Formatter *f) const +{ +} + +void rgw_obj::generate_test_instances(list& o) +{ + o.push_back(new rgw_obj); +} + +void rgw_obj::dump(Formatter *f) const +{ +} + using namespace ceph::crypto; diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index f6d5cb18d2ef..28f20060a143 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -293,6 +293,8 @@ struct RGWAccessKey { ::decode(subuser, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(RGWAccessKey); @@ -314,6 +316,8 @@ struct RGWSubUser { ::decode(perm_mask, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(RGWSubUser); @@ -400,6 +404,8 @@ struct RGWUserInfo } DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); void clear() { user_id.clear(); @@ -453,6 +459,8 @@ struct rgw_bucket { } DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_bucket) @@ -491,6 +499,8 @@ struct RGWBucketInfo ::decode(flags, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); RGWBucketInfo() : flags(0) {} }; @@ -638,6 +648,8 @@ struct RGWBucketEnt { size_rounded = s; DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); void clear() { bucket.clear(); size = 0; @@ -670,6 +682,8 @@ struct RGWUploadPartInfo { ::decode(modified, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(RGWUploadPartInfo) @@ -852,6 +866,8 @@ public: ::decode(bucket, bl); DECODE_FINISH(bl); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); bool operator==(const rgw_obj& o) const { return (object.compare(o.object) == 0) && diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc index 7fb4f7e832a2..57f13226ded5 100644 --- a/src/rgw/rgw_log.cc +++ b/src/rgw/rgw_log.cc @@ -7,6 +7,24 @@ #define DOUT_SUBSYS rgw +void rgw_log_entry::generate_test_instances(list& o) +{ + o.push_back(new rgw_log_entry); +} + +void rgw_log_entry::dump(Formatter *f) const +{ +} + +void rgw_intent_log_entry::generate_test_instances(list& o) +{ + o.push_back(new rgw_intent_log_entry); +} + +void rgw_intent_log_entry::dump(Formatter *f) const +{ +} + static rgw_bucket log_bucket(RGW_LOG_POOL_NAME); static void set_param_str(struct req_state *s, const char *name, string& str) diff --git a/src/rgw/rgw_log.h b/src/rgw/rgw_log.h index e0e8defaa4a8..1f3890df48ba 100644 --- a/src/rgw/rgw_log.h +++ b/src/rgw/rgw_log.h @@ -81,6 +81,8 @@ struct rgw_log_entry { bucket_id = -1; DECODE_FINISH(p); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_log_entry) @@ -104,6 +106,8 @@ struct rgw_intent_log_entry { ::decode(intent, p); DECODE_FINISH(p); } + void dump(Formatter *f) const; + static void generate_test_instances(list& o); }; WRITE_CLASS_ENCODER(rgw_intent_log_entry) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 67f115415c15..47e593abd189 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -45,6 +45,98 @@ static rgw_bucket pi_buckets_rados = RGW_ROOT_BUCKET; static RGWObjCategory shadow_category = RGW_OBJ_CATEGORY_SHADOW; static RGWObjCategory main_category = RGW_OBJ_CATEGORY_MAIN; +void rgw_bucket_pending_info::generate_test_instances(list& o) +{ + o.push_back(new rgw_bucket_pending_info); +} + +void rgw_bucket_pending_info::dump(Formatter *f) const +{ +} + +void rgw_bucket_dir_entry_meta::generate_test_instances(list& o) +{ + o.push_back(new rgw_bucket_dir_entry_meta); +} + +void rgw_bucket_dir_entry_meta::dump(Formatter *f) const +{ +} + +void rgw_bucket_dir_entry::generate_test_instances(list& o) +{ + o.push_back(new rgw_bucket_dir_entry); +} + +void rgw_bucket_dir_entry::dump(Formatter *f) const +{ +} + +void rgw_bucket_category_stats::generate_test_instances(list& o) +{ + o.push_back(new rgw_bucket_category_stats); +} + +void rgw_bucket_category_stats::dump(Formatter *f) const +{ +} + +void rgw_bucket_dir_header::generate_test_instances(list& o) +{ + o.push_back(new rgw_bucket_dir_header); +} + +void rgw_bucket_dir_header::dump(Formatter *f) const +{ +} + +void rgw_bucket_dir::generate_test_instances(list& o) +{ + o.push_back(new rgw_bucket_dir); +} + +void rgw_bucket_dir::dump(Formatter *f) const +{ +} + +void rgw_cls_obj_prepare_op::generate_test_instances(list& o) +{ + o.push_back(new rgw_cls_obj_prepare_op); +} + +void rgw_cls_obj_prepare_op::dump(Formatter *f) const +{ +} + +void rgw_cls_obj_complete_op::generate_test_instances(list& o) +{ + o.push_back(new rgw_cls_obj_complete_op); +} + +void rgw_cls_obj_complete_op::dump(Formatter *f) const +{ +} + +void rgw_cls_list_op::generate_test_instances(list& o) +{ + o.push_back(new rgw_cls_list_op); +} + +void rgw_cls_list_op::dump(Formatter *f) const +{ +} + +void rgw_cls_list_ret::generate_test_instances(list& o) +{ + o.push_back(new rgw_cls_list_ret); +} + +void rgw_cls_list_ret::dump(Formatter *f) const +{ +} + + + class RGWWatcher : public librados::WatchCtx { RGWRados *rados; public: diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index f8fd5932d046..af9f2bc0cbeb 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -81,6 +81,49 @@ TYPE(MonCaps) TYPE(DBObjectMap::_Header) TYPE(DBObjectMap::State) +#include "rgw/rgw_access.h" +TYPE(RGWObjManifestPart); +TYPE(RGWObjManifest); + +#include "rgw/rgw_acl.h" +TYPE(ACLPermission) +TYPE(ACLGranteeType) +TYPE(ACLGrant) +TYPE(RGWAccessControlList) +TYPE(ACLOwner) +TYPE(RGWAccessControlPolicy) + +#include "rgw/rgw_cache.h" +TYPE(ObjectMetaInfo) +TYPE(ObjectCacheInfo) +TYPE(RGWCacheNotifyInfo) + +#include "rgw/rgw_cls_api.h" +TYPE(rgw_bucket_pending_info) +TYPE(rgw_bucket_dir_entry_meta) +TYPE(rgw_bucket_dir_entry) +TYPE(rgw_bucket_category_stats) +TYPE(rgw_bucket_dir_header) +TYPE(rgw_bucket_dir) +TYPE(rgw_cls_obj_prepare_op) +TYPE(rgw_cls_obj_complete_op) +TYPE(rgw_cls_list_op) +TYPE(rgw_cls_list_ret) + +#include "rgw/rgw_common.h" +TYPE(RGWAccessKey); +TYPE(RGWSubUser); +TYPE(RGWUserInfo) +TYPE(rgw_bucket) +TYPE(RGWBucketInfo) +TYPE(RGWBucketEnt) +TYPE(RGWUploadPartInfo) +TYPE(rgw_obj) + +#include "rgw/rgw_log.h" +TYPE(rgw_log_entry) +TYPE(rgw_intent_log_entry) + // --- messages --- #include "messages/MAuth.h" MESSAGE(MAuth)