Merge pull request #27780 from theanalyst/cls-timeindex-denc

cls: add timeindex types to ceph-dencoder

Reviewed-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2019-07-29 11:37:15 -04:00 committed by GitHub
commit 2c242ed58f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 57 additions and 1 deletions

View File

@ -148,7 +148,9 @@ set_target_properties(cls_timeindex PROPERTIES
CXX_VISIBILITY_PRESET hidden)
install(TARGETS cls_timeindex DESTINATION ${cls_dir})
set(cls_timeindex_client_srcs timeindex/cls_timeindex_client.cc)
set(cls_timeindex_client_srcs
timeindex/cls_timeindex_types.cc
timeindex/cls_timeindex_client.cc)
add_library(cls_timeindex_client STATIC ${cls_timeindex_client_srcs})

View File

@ -0,0 +1,21 @@
#include "cls_timeindex_types.h"
#include "common/Formatter.h"
void cls_timeindex_entry::dump(Formatter *f) const
{
f->dump_stream("key_ts") << key_ts;
f->dump_string("key_ext", key_ext);
f->dump_string("value", value.to_str());
}
void cls_timeindex_entry::generate_test_instances(list<cls_timeindex_entry*>& o)
{
cls_timeindex_entry *i = new cls_timeindex_entry;
i->key_ts = utime_t(0,0);
i->key_ext = "foo";
bufferlist bl;
bl.append("bar");
i->value = bl;
o.push_back(i);
o.push_back(new cls_timeindex_entry);
}

View File

@ -37,6 +37,9 @@ struct cls_timeindex_entry {
decode(value, bl);
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
static void generate_test_instances(list<cls_timeindex_entry*>& o);
};
WRITE_CLASS_ENCODER(cls_timeindex_entry)

View File

@ -562,3 +562,14 @@ void rgw_data_sync_status::generate_test_instances(list<rgw_data_sync_status*>&
{
o.push_back(new rgw_data_sync_status);
}
void objexp_hint_entry::generate_test_instances(list<objexp_hint_entry*>& o)
{
auto it = new objexp_hint_entry;
it->tenant = "tenant1";
it->bucket_name = "bucket1";
it->bucket_id = "1234";
it->obj_key = rgw_obj_key("obj");
o.push_back(it);
o.push_back(new objexp_hint_entry);
}

View File

@ -1748,3 +1748,15 @@ void RGWCompressionInfo::dump(Formatter *f) const
f->dump_unsigned("orig_size", orig_size);
::encode_json("blocks", blocks, f);
}
void objexp_hint_entry::dump(Formatter *f) const
{
f->open_object_section("objexp_hint_entry");
encode_json("tenant", tenant, f);
encode_json("bucket_name", bucket_name, f);
encode_json("bucket_id", bucket_id, f);
encode_json("rgw_obj_key", obj_key, f);
utime_t ut(exp_time);
encode_json("exp_time", ut, f);
f->close_section();
}

View File

@ -1023,6 +1023,9 @@ struct objexp_hint_entry {
}
DECODE_FINISH(bl);
}
void dump(Formatter *f) const;
static void generate_test_instances(list<objexp_hint_entry*>& o);
};
WRITE_CLASS_ENCODER(objexp_hint_entry)

View File

@ -84,6 +84,9 @@ TYPE(cls_refcount_read_op)
TYPE(cls_refcount_read_ret)
TYPE(obj_refcount)
#include "cls/timeindex/cls_timeindex_types.h"
TYPE(cls_timeindex_entry)
#include "journal/Entry.h"
TYPE(journal::Entry)

View File

@ -4,6 +4,7 @@
TYPE(RGWOLHInfo)
TYPE(RGWObjManifestPart)
TYPE(RGWObjManifest)
TYPE(objexp_hint_entry)
#include "rgw/rgw_zone.h"
TYPE(RGWZoneParams)