bufferlist filter_bl;
std::string filter_name = "hello.hello";
- ::encode(filter_name, filter_bl);
- ::encode("_theattr", filter_bl);
- ::encode(target_str, filter_bl);
+ encode(filter_name, filter_bl);
+ encode("_theattr", filter_bl);
+ encode(target_str, filter_bl);
NObjectIterator iter(ioctx.nobjects_begin(filter_bl));
bool foundit = false;
bufferlist::iterator iter = bl.begin();
try {
- ::decode(*i, iter);
+ decode(*i, iter);
} catch (buffer::error& err) {
std::cout << "failed to decode buffer" << std::endl;
return -EIO;
void add_log(librados::ObjectWriteOperation *op, utime_t& timestamp, string& section, string&name, int i)
{
bufferlist bl;
- ::encode(i, bl);
+ encode(i, bl);
cls_log_add(*op, timestamp, section, name, bl);
}
/* write some data into object */
string written = "Hello World";
bufferlist inbl;
- ::encode(written, inbl);
+ encode(written, inbl);
ASSERT_EQ(0, clslua_exec(test_script, &inbl, "write"));
/* have Lua read out of the object */
/* compare what Lua read to what we wrote */
string read;
- ::decode(read, outbl);
+ decode(read, outbl);
ASSERT_EQ(read, written);
}
TEST_F(ClsLua, MapSetVal) {
/* build some input value */
bufferlist orig_val;
- ::encode("this is the original value yay", orig_val);
+ encode("this is the original value yay", orig_val);
/* have the lua script stuff the data into a map value */
ASSERT_EQ(0, clslua_exec(test_script, &orig_val, "map_set_val"));
ASSERT_EQ(0, ioctx.omap_get_vals_by_keys(oid, out_keys, &out_map));
bufferlist out_bl = out_map["foo"];
string out_val;
- ::decode(out_val, out_bl);
+ decode(out_val, out_bl);
ASSERT_EQ(out_val, "this is the original value yay");
}
void add_log(librados::ObjectWriteOperation *op, const string& client_id, const string& op_id, string& obj, uint32_t state)
{
bufferlist bl;
- ::encode(state, bl);
+ encode(state, bl);
utime_t ts = ceph_clock_now();
}
explicit ObjectContents(bufferlist::iterator &bp) {
- ::decode(_size, bp);
- ::decode(seeds, bp);
- ::decode(written, bp);
- ::decode(_exists, bp);
+ decode(_size, bp);
+ decode(seeds, bp);
+ decode(written, bp);
+ decode(_exists, bp);
}
void clone_range(ObjectContents &other,
}
void encode(bufferlist &bl) const {
- ::encode(_size, bl);
- ::encode(seeds, bl);
- ::encode(written, bl);
- ::encode(_exists, bl);
+ using ceph::encode;
+ encode(_size, bl);
+ encode(seeds, bl);
+ encode(written, bl);
+ encode(_exists, bl);
}
};
double actual = (double)hit / (double)test;
bufferlist bl;
- ::encode(bf, bl);
+ encode(bf, bl);
double byte_per_insert = (double)bl.length() / (double)max;
double actual = (double)hit / (double)test;
bufferlist bl;
- ::encode(bf, bl);
+ encode(bf, bl);
double byte_per_insert = (double)bl.length() / (double)max;
double actual = (double)hit / (double)test;
bufferlist bl;
- ::encode(bf, bl);
+ encode(bf, bl);
double byte_per_insert = (double)bl.length() / (double)max;
unsigned est_after = bf.approx_unique_element_count();
for (int j=0; j<max; j++) {
ls.back()->insert(10000 * (i+1) + j);
}
- ::encode(*ls.front(), bl);
+ encode(*ls.front(), bl);
}
int hit = 0;
friend void decode(ConstructorCounter &s, bufferlist::iterator& p)
{
- ::decode(s.data, p);
+ decode(s.data, p);
}
friend void encode(const ConstructorCounter &s, bufferlist& p)
{
- ::encode(s.data, p);
+ encode(s.data, p);
}
friend ostream& operator<<(ostream &oss, const ConstructorCounter &cc)
bufferlist::iterator p = bl.begin();
p.seek(seek);
try {
- using ::decode;
using ceph::decode;
decode(*m_object, p);
}
: DencoderBase<T>(stray_ok, nondeterministic) {}
void encode(bufferlist& out, uint64_t features) override {
out.clear();
- using ::encode;
using ceph::encode;
encode(*this->m_object, out);
}
DencoderImplFeaturefulNoCopy(bool stray_ok, bool nondeterministic)
: DencoderBase<T>(stray_ok, nondeterministic) {}
void encode(bufferlist& out, uint64_t features) override {
- using ceph::encode;
- using ::encode;
out.clear();
- using ::encode;
using ceph::encode;
encode(*(this->m_object), out, features);
}
#define TEST_CEPH_TIME_H
#include <list>
+
+#include "include/encoding.h"
#include "common/ceph_time.h"
+#include "common/Formatter.h"
// wrapper for ceph::real_time that implements the dencoder interface
class real_time_wrapper {
real_time_wrapper(const ceph::real_time& t) : t(t) {}
void encode(bufferlist& bl) const {
- ::encode(t, bl);
+ using ceph::encode;
+ encode(t, bl);
}
void decode(bufferlist::iterator &p) {
- ::decode(t, p);
+ using ceph::decode;
+ decode(t, p);
}
void dump(Formatter* f) {
auto epoch_time = ceph::real_clock::to_time_t(t);
uint64_t stray_bytes = 0x1122334455667788;
bufferlist full_bl;
- ::encode(stray_bytes, full_bl);
+ encode(stray_bytes, full_bl);
encode(entry, full_bl);
uint32_t bytes_needed;
bufferlist bad_bl;
bad_bl.substr_of(full_bl, 0, full_bl.length() - 4);
- ::encode(full_bl.crc32c(1), bad_bl);
+ encode(full_bl.crc32c(1), bad_bl);
uint32_t bytes_needed;
ASSERT_FALSE(journal::Entry::is_readable(bad_bl.begin(), &bytes_needed));
bufferlist bl;
encode(entry1, bl);
- ::encode(this->create_payload("corruption"), bl);
+ encode(this->create_payload("corruption"), bl);
encode(entry2, bl);
ASSERT_EQ(0, this->append(this->get_object_name(oid), bl));
op1.read(0, sizeof(buf), &bl, NULL);
op1.set_op_flags2(LIBRADOS_OP_FLAG_FADVISE_DONTNEED|LIBRADOS_OP_FLAG_FADVISE_RANDOM);
bufferlist init_value_bl;
- ::encode(static_cast<int32_t>(-1), init_value_bl);
+ encode(static_cast<int32_t>(-1), init_value_bl);
bufferlist csum_bl;
op1.checksum(LIBRADOS_CHECKSUM_TYPE_CRC32C, init_value_bl,
0, 0, 0, &csum_bl, nullptr);
auto csum_bl_it = csum_bl.begin();
uint32_t csum_count;
uint32_t csum;
- ::decode(csum_count, csum_bl_it);
+ decode(csum_count, csum_bl_it);
ASSERT_EQ(1U, csum_count);
- ::decode(csum, csum_bl_it);
+ decode(csum, csum_bl_it);
ASSERT_EQ(bl.crc32c(-1), csum);
ioctx.remove("test_obj");
destroy_one_pool_pp(pool_name, cluster);
bl.append(buf, sizeof(buf));
ASSERT_EQ(0, ioctx.write("foo", bl, sizeof(buf), 0));
bufferlist init_value_bl;
- ::encode(static_cast<uint32_t>(-1), init_value_bl);
+ encode(static_cast<uint32_t>(-1), init_value_bl);
bufferlist csum_bl;
ASSERT_EQ(0, ioctx.checksum("foo", LIBRADOS_CHECKSUM_TYPE_CRC32C,
init_value_bl, sizeof(buf), 0, 0, &csum_bl));
auto csum_bl_it = csum_bl.begin();
uint32_t csum_count;
- ::decode(csum_count, csum_bl_it);
+ decode(csum_count, csum_bl_it);
ASSERT_EQ(1U, csum_count);
uint32_t csum;
- ::decode(csum, csum_bl_it);
+ decode(csum, csum_bl_it);
ASSERT_EQ(bl.crc32c(-1), csum);
}
bufferlist filter_bl;
std::string filter_name = "plain";
- ::encode(filter_name, filter_bl);
- ::encode("_theattr", filter_bl);
- ::encode(target_str, filter_bl);
+ encode(filter_name, filter_bl);
+ encode("_theattr", filter_bl);
+ encode(target_str, filter_bl);
NObjectIterator iter(ioctx.nobjects_begin(filter_bl));
bool foundit = false;
bufferlist filter_bl;
std::string filter_name = "plain";
- ::encode(filter_name, filter_bl);
- ::encode("_theattr", filter_bl);
- ::encode(target_str, filter_bl);
+ encode(filter_name, filter_bl);
+ encode("_theattr", filter_bl);
+ encode(target_str, filter_bl);
ObjectCursor c = ioctx.object_list_begin();
ObjectCursor end = ioctx.object_list_end();
bufferlist::iterator p = bl.begin();
bufferlist header;
map<string, bufferlist> m;
- ::decode(header, p);
- ::decode(m, p);
+ decode(header, p);
+ decode(m, p);
map<string, bufferlist>::iterator i = m.find(key);
if (i == m.end())
return "";
std::string retstring;
- ::decode(retstring, i->second);
+ decode(retstring, i->second);
return retstring;
}
__u8 c = CEPH_OSD_TMAP_SET;
bufferlist tmbl;
- ::encode(c, tmbl);
- ::encode(key, tmbl);
+ encode(c, tmbl);
+ encode(key, tmbl);
bufferlist blbl;
- ::encode(val, blbl);
- ::encode(blbl, tmbl);
+ encode(val, blbl);
+ encode(blbl, tmbl);
int ret = ioctx.tmap_update(obj, tmbl);
if (ret) {
ostringstream oss;
__u8 c = CEPH_OSD_TMAP_RM;
bufferlist tmbl;
- ::encode(c, tmbl);
- ::encode(key, tmbl);
+ encode(c, tmbl);
+ encode(key, tmbl);
int ret = ioctx.tmap_update(obj, tmbl);
if (ret) {
ostringstream oss;
bufferlist emptybl;
bufferlist tmbl;
- ::encode(c, tmbl);
- ::encode(my_tmap, tmbl);
- ::encode(emptybl, tmbl);
+ encode(c, tmbl);
+ encode(my_tmap, tmbl);
+ encode(emptybl, tmbl);
ASSERT_EQ(0, ioctx.tmap_update("foo", tmbl));
}
bufferlist emptybl;
bufferlist tmbl;
- ::encode(c, tmbl);
- ::encode(my_tmap, tmbl);
- ::encode(emptybl, tmbl);
+ encode(c, tmbl);
+ encode(my_tmap, tmbl);
+ encode(emptybl, tmbl);
ASSERT_EQ(0, ioctx.tmap_update("foo", tmbl));
}
{
__u8 c = CEPH_OSD_TMAP_SET;
bufferlist tmbl;
- ::encode(c, tmbl);
- ::encode("a", tmbl);
+ encode(c, tmbl);
+ encode("a", tmbl);
bufferlist blbl;
- ::encode("old", blbl);
- ::encode(blbl, tmbl);
+ encode("old", blbl);
+ encode(blbl, tmbl);
- ::encode(c, tmbl);
- ::encode("b", tmbl);
- ::encode(blbl, tmbl);
+ encode(c, tmbl);
+ encode("b", tmbl);
+ encode(blbl, tmbl);
- ::encode(c, tmbl);
- ::encode("c", tmbl);
- ::encode(blbl, tmbl);
+ encode(c, tmbl);
+ encode("c", tmbl);
+ encode(blbl, tmbl);
ASSERT_EQ(0, ioctx.tmap_update("foo", tmbl));
}
{
__u8 c = CEPH_OSD_TMAP_SET;
bufferlist tmbl;
- ::encode(c, tmbl);
- ::encode("b", tmbl);
+ encode(c, tmbl);
+ encode("b", tmbl);
bufferlist blbl;
- ::encode("new", blbl);
- ::encode(blbl, tmbl);
+ encode("new", blbl);
+ encode(blbl, tmbl);
- ::encode(c, tmbl);
- ::encode("a", tmbl);
- ::encode(blbl, tmbl);
+ encode(c, tmbl);
+ encode("a", tmbl);
+ encode(blbl, tmbl);
- ::encode(c, tmbl);
- ::encode("c", tmbl);
- ::encode(blbl, tmbl);
+ encode(c, tmbl);
+ encode("c", tmbl);
+ encode(blbl, tmbl);
ASSERT_EQ(0, ioctx.tmap_update("foo", tmbl));
}
// create unsorted tmap
string h("header");
bufferlist bl;
- ::encode(h, bl);
+ encode(h, bl);
uint32_t n = 3;
- ::encode(n, bl);
- ::encode(string("b"), bl);
- ::encode(string("bval"), bl);
- ::encode(string("a"), bl);
- ::encode(string("aval"), bl);
- ::encode(string("c"), bl);
- ::encode(string("cval"), bl);
+ encode(n, bl);
+ encode(string("b"), bl);
+ encode(string("bval"), bl);
+ encode(string("a"), bl);
+ encode(string("aval"), bl);
+ encode(string("c"), bl);
+ encode(string("cval"), bl);
bufferlist orig = bl; // tmap_put steals bl content
ASSERT_EQ(0, ioctx.tmap_put("foo", bl));
omap["3"].append("c");
{
bufferlist bl;
- ::encode(hdr, bl);
- ::encode(omap, bl);
+ encode(hdr, bl);
+ encode(omap, bl);
ASSERT_EQ(0, ioctx.tmap_put("foo", bl));
}
bl.append(buf2, res);
bufferlist::iterator iter = bl.begin();
uint64_t all_features;
- ::decode(all_features, iter);
+ decode(all_features, iter);
// make sure *some* features are specified; don't care which ones
ASSERT_NE(all_features, (unsigned)0);
}
ASSERT_EQ(0, r);
bufferlist::iterator iter = out.begin();
uint64_t all_features;
- ::decode(all_features, iter);
+ decode(all_features, iter);
// make sure *some* features are specified; don't care which ones
ASSERT_NE(all_features, (unsigned)0);
}
typename TestFixture::init_value_t init_value = -1;
bufferlist init_value_bl;
- ::encode(init_value, init_value_bl);
+ encode(init_value, init_value_bl);
std::vector<bufferlist> checksum_bls(csum_count);
std::vector<int> checksum_rvals(csum_count);
auto bl_it = checksum_bls[i].begin();
uint32_t count;
- ::decode(count, bl_it);
+ decode(count, bl_it);
ASSERT_EQ(1U, count);
typename TestFixture::value_t value;
- ::decode(value, bl_it);
+ decode(value, bl_it);
bufferlist content_sub_bl;
content_sub_bl.substr_of(this->content_bl, i * chunk_size, chunk_size);
typename TestFixture::init_value_t init_value = -1;
bufferlist init_value_bl;
- ::encode(init_value, init_value_bl);
+ encode(init_value, init_value_bl);
bufferlist checksum_bl;
int checksum_rval;
auto bl_it = checksum_bl.begin();
uint32_t count;
- ::decode(count, bl_it);
+ decode(count, bl_it);
ASSERT_EQ(csum_count, count);
std::vector<typename TestFixture::value_t> expected_values(csum_count);
for (uint32_t i = 0; i < csum_count; ++i) {
typename TestFixture::value_t value;
- ::decode(value, bl_it);
+ decode(value, bl_it);
ASSERT_EQ(expected_values[i], value);
}
}
if (hbl.length()) {
bufferlist::iterator p = hbl.begin();
HitSet hs;
- ::decode(hs, p);
+ decode(hs, p);
if (hs.contains(oid)) {
cout << "ok, hit_set contains " << oid << std::endl;
break;
try {
bufferlist::iterator p = bl.begin();
- ::decode(hitsets[i], p);
+ decode(hitsets[i], p);
}
catch (buffer::error& e) {
std::cout << "failed to decode hit set; bl len is " << bl.length() << "\n";
if (hbl.length()) {
bufferlist::iterator p = hbl.begin();
HitSet hs;
- ::decode(hs, p);
+ decode(hs, p);
if (hs.contains(oid)) {
cout << "ok, hit_set contains " << oid << std::endl;
break;
//std::cout << std::endl;
bufferlist::iterator p = bl.begin();
- ::decode(hitsets[i], p);
+ decode(hitsets[i], p);
// cope with racing splits by refreshing pg_num
if (i == num_pg - 1)
std::map<std::pair<uint64_t,uint64_t>, bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
bufferlist::iterator reply_p = reply.begin();
- ::decode(reply_map, reply_p);
- ::decode(missed_map, reply_p);
+ decode(reply_map, reply_p);
+ decode(missed_map, reply_p);
ASSERT_EQ(1u, reply_map.size());
ASSERT_EQ(0u, missed_map.size());
ASSERT_EQ(1u, notify_cookies.size());
std::map<std::pair<uint64_t,uint64_t>, bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
bufferlist::iterator reply_p = reply.begin();
- ::decode(reply_map, reply_p);
- ::decode(missed_map, reply_p);
+ decode(reply_map, reply_p);
+ decode(missed_map, reply_p);
ASSERT_EQ(1u, reply_map.size());
ASSERT_EQ(0u, missed_map.size());
ASSERT_EQ(1u, notify_cookies.size());
std::map<std::pair<uint64_t,uint64_t>, bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
bufferlist::iterator reply_p = reply.begin();
- ::decode(reply_map, reply_p);
- ::decode(missed_map, reply_p);
+ decode(reply_map, reply_p);
+ decode(missed_map, reply_p);
ASSERT_EQ(1u, reply_map.size());
ASSERT_EQ(0u, missed_map.size());
ASSERT_EQ(1u, notify_cookies.size());
bufferlist::iterator p = bl_reply.begin();
std::map<std::pair<uint64_t,uint64_t>,bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
- ::decode(reply_map, p);
- ::decode(missed_map, p);
+ decode(reply_map, p);
+ decode(missed_map, p);
ASSERT_EQ(1u, notify_cookies.size());
ASSERT_EQ(1u, notify_cookies.count(handle));
ASSERT_EQ(1u, reply_map.size());
bufferlist::iterator p = bl_reply.begin();
std::map<std::pair<uint64_t,uint64_t>,bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
- ::decode(reply_map, p);
- ::decode(missed_map, p);
+ decode(reply_map, p);
+ decode(missed_map, p);
ASSERT_EQ(1u, notify_cookies.size());
ASSERT_EQ(1u, notify_cookies.count(handle));
ASSERT_EQ(1u, reply_map.size());
bufferlist::iterator p = bl_reply.begin();
std::map<std::pair<uint64_t,uint64_t>,bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
- ::decode(reply_map, p);
- ::decode(missed_map, p);
+ decode(reply_map, p);
+ decode(missed_map, p);
ASSERT_EQ(1u, notify_cookies.size());
ASSERT_EQ(1u, notify_cookies.count(handle));
ASSERT_EQ(1u, reply_map.size());
std::map<std::pair<uint64_t,uint64_t>, bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
bufferlist::iterator reply_p = reply.begin();
- ::decode(reply_map, reply_p);
- ::decode(missed_map, reply_p);
+ decode(reply_map, reply_p);
+ decode(missed_map, reply_p);
ASSERT_EQ(2u, reply_map.size());
ASSERT_EQ(5u, reply_map.begin()->second.length());
ASSERT_EQ(0u, missed_map.size());
std::map<std::pair<uint64_t,uint64_t>, bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
bufferlist::iterator reply_p = reply.begin();
- ::decode(reply_map, reply_p);
- ::decode(missed_map, reply_p);
+ decode(reply_map, reply_p);
+ decode(missed_map, reply_p);
ASSERT_EQ(0u, reply_map.size());
ASSERT_EQ(1u, missed_map.size());
}
bufferlist::iterator p = bl_reply.begin();
std::map<std::pair<uint64_t,uint64_t>,bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
- ::decode(reply_map, p);
- ::decode(missed_map, p);
+ decode(reply_map, p);
+ decode(missed_map, p);
ASSERT_EQ(1u, notify_cookies.size());
ASSERT_EQ(1u, notify_cookies.count(handle));
ASSERT_EQ(1u, reply_map.size());
std::map<std::pair<uint64_t,uint64_t>, bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
bufferlist::iterator reply_p = reply.begin();
- ::decode(reply_map, reply_p);
- ::decode(missed_map, reply_p);
+ decode(reply_map, reply_p);
+ decode(missed_map, reply_p);
ASSERT_EQ(0u, reply_map.size());
ASSERT_EQ(0u, missed_map.size());
}
std::map<std::pair<uint64_t,uint64_t>, bufferlist> reply_map;
std::set<std::pair<uint64_t,uint64_t> > missed_map;
bufferlist::iterator reply_p = reply.begin();
- ::decode(reply_map, reply_p);
- ::decode(missed_map, reply_p);
+ decode(reply_map, reply_p);
+ decode(missed_map, reply_p);
ASSERT_EQ(1u, reply_map.size());
ASSERT_EQ(0u, missed_map.size());
ASSERT_EQ(1u, notify_cookies.count(handle));
return r;
}
bufferlist::iterator iter = inbl.begin();
- ::decode(tmap_header, iter);
- ::decode(tmap, iter);
+ decode(tmap_header, iter);
+ decode(tmap, iter);
}
__u8 c;
std::string key;
bufferlist value;
bufferlist::iterator iter = cmdbl.begin();
- ::decode(c, iter);
- ::decode(key, iter);
+ decode(c, iter);
+ decode(key, iter);
switch (c) {
case CEPH_OSD_TMAP_SET:
- ::decode(value, iter);
+ decode(value, iter);
tmap[key] = value;
break;
case CEPH_OSD_TMAP_RM:
}
bufferlist out;
- ::encode(tmap_header, out);
- ::encode(tmap, out);
+ encode(tmap_header, out);
+ encode(tmap, out);
r = write_full(oid, out, m_snapc);
return r;
}
<< ": completing" << dendl;
if (notify_handle->pbl != NULL) {
- ::encode(notify_handle->notify_responses, *notify_handle->pbl);
- ::encode(notify_handle->pending_watcher_ids, *notify_handle->pbl);
+ encode(notify_handle->notify_responses, *notify_handle->pbl);
+ encode(notify_handle->pending_watcher_ids, *notify_handle->pbl);
}
notify_handle->rados_client->get_aio_finisher()->queue(
const std::map<std::string, bufferlist>& metadata,
int r) {
bufferlist out_bl;
- ::encode(metadata, out_bl);
+ encode(metadata, out_bl);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("metadata_list"), _, _, _))
const std::map<std::string, bufferlist>& metadata,
int r) {
bufferlist in_bl;
- ::encode(metadata, in_bl);
+ encode(metadata, in_bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
exec(mock_image_ctx.header_oid, _, StrEq("rbd"), StrEq("metadata_set"),
void expect_mirror_mode_get(MockTestImageCtx &mock_image_ctx,
cls::rbd::MirrorMode mirror_mode, int r) {
bufferlist out_bl;
- ::encode(static_cast<uint32_t>(mirror_mode), out_bl);
+ encode(static_cast<uint32_t>(mirror_mode), out_bl);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(RBD_MIRRORING, _, StrEq("rbd"), StrEq("mirror_mode_get"),
cls::rbd::TrashImageSpec trash_image_spec;
bufferlist::iterator bl_it = in_bl.begin();
- ::decode(id, bl_it);
+ decode(id, bl_it);
decode(trash_image_spec, bl_it);
EXPECT_EQ(id, image_id);
const std::string& name, const std::string& id,
int r) {
bufferlist in_bl;
- ::encode(name, in_bl);
- ::encode(id, in_bl);
+ encode(name, in_bl);
+ encode(id, in_bl);
EXPECT_CALL(get_mock_io_ctx(mock_image_ctx.md_ctx),
exec(StrEq("rbd_directory"), _, StrEq("rbd"), StrEq("dir_remove_image"),
stringstream ss;
f->flush(ss);
- ::encode(ss.str(), bl);
+ encode(ss.str(), bl);
m->set_payload(bl);
return m;
Payload pl;
auto p = m->get_data().begin();
- ::decode(pl, p);
+ decode(pl, p);
if (pl.who == Payload::PING) {
lderr(g_ceph_context) << __func__ << " conn=" << m->get_connection() << pl << dendl;
reply_message(m, pl);
void reply_message(const Message *m, Payload& pl) {
pl.who = Payload::PONG;
bufferlist bl;
- ::encode(pl, bl);
+ encode(pl, bl);
MPing *rm = new MPing();
rm->set_data(bl);
m->get_connection()->send_message(rm);
Message *m = new MPing();
Payload pl{Payload::PING, index++, data};
bufferlist bl;
- ::encode(pl, bl);
+ encode(pl, bl);
m->set_data(bl);
if (!con->get_messenger()->get_default_policy().lossy) {
Mutex::Locker l(lock);
void DeterministicOpSequence::note_txn(ObjectStore::Transaction *t)
{
bufferlist bl;
- ::encode(txn, bl);
+ encode(txn, bl);
t->truncate(txn_coll, ghobject_t(txn_object), 0);
t->write(txn_coll, ghobject_t(txn_object), 0, bl.length(), bl);
dout(10) << __func__ << " " << txn << dendl;
note_txn(&t);
t.create_collection(cid, 32);
bufferlist hint;
- ::encode(pg_num, hint);
- ::encode(num_objs, hint);
+ encode(pg_num, hint);
+ encode(num_objs, hint);
t.collection_hint(cid, ObjectStore::Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS, hint);
dout(0) << "Give collection: " << cid << " a hint, pg_num is: " << pg_num << ", num_objs is: "
<< num_objs << dendl;
restart_seq = 0;
if (!got.empty()) {
bufferlist::iterator bp = got.begin()->second.begin();
- ::decode(restart_seq, bp);
+ decode(restart_seq, bp);
}
++restart_seq;
KeyValueDB::Transaction t = db->get_transaction();
got.clear();
- ::encode(restart_seq, got["STATUS"]);
+ encode(restart_seq, got["STATUS"]);
t->set("STATUS", got);
db->submit_transaction(t);
return 0;
}
};
void encode(const ObjStatus &obj, bufferlist &bl) {
- ::encode(obj.last_applied, bl);
- ::encode(obj.last_committed, bl);
- ::encode(obj.restart_seq, bl);
+ encode(obj.last_applied, bl);
+ encode(obj.last_committed, bl);
+ encode(obj.restart_seq, bl);
}
void decode(ObjStatus &obj, bufferlist::iterator &bl) {
- ::decode(obj.last_applied, bl);
- ::decode(obj.last_committed, bl);
- ::decode(obj.restart_seq, bl);
+ decode(obj.last_applied, bl);
+ decode(obj.last_committed, bl);
+ decode(obj.restart_seq, bl);
}
ObjStatus retval;
if (!got.empty()) {
bufferlist::iterator bp = got.begin()->second.begin();
- ::decode(retval, bp);
+ decode(retval, bp);
}
return retval;
}
KeyValueDB::Transaction t)
{
map<string, bufferlist> to_set;
- ::encode(status, to_set["META"]);
+ encode(status, to_set["META"]);
t->set(obj_to_meta_prefix(obj), to_set);
}
bufferlist bl = iter->value();
bufferlist::iterator bp = bl.begin();
pair<uint64_t, bufferlist> val;
- ::decode(val, bp);
+ decode(val, bp);
assert(seq_to_key(val.first) == iter->key());
bp = val.second.begin();
return ObjectContents(bp);
return ObjectContents();
pair<uint64_t, bufferlist> val;
bufferlist::iterator bp = got.begin()->second.begin();
- ::decode(val, bp);
+ decode(val, bp);
bp = val.second.begin();
assert(val.first == version);
return ObjectContents(bp);
pair<uint64_t, bufferlist> val;
bufferlist bl = iter->value();
bufferlist::iterator bp = bl.begin();
- ::decode(val, bp);
+ decode(val, bp);
bounds.second = val.first + 1;
}
pair<uint64_t, bufferlist> val;
bufferlist bl = iter->value();
bufferlist::iterator bp = bl.begin();
- ::decode(val, bp);
+ decode(val, bp);
most_recent = val.first;
}
bufferlist buf_content;
content.encode(buf_content);
map<string, bufferlist> to_set;
- ::encode(make_pair(most_recent + 1, buf_content),
+ encode(make_pair(most_recent + 1, buf_content),
to_set[seq_to_key(most_recent + 1)]);
t->set(obj_to_prefix(obj), to_set);
db->submit_transaction(t);
bufferlist hint;
uint32_t pg_num = colls;
uint64_t num_objs = uint64_t(objs / colls);
- ::encode(pg_num, hint);
- ::encode(num_objs, hint);
+ encode(pg_num, hint);
+ encode(num_objs, hint);
t->collection_hint(entry->m_coll, ObjectStore::Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS, hint);
dout(5) << "give collection hint, number of objects per collection: " << num_objs << dendl;
t->touch(coll_t::meta(), entry->m_meta_obj);
store->fiemap(cid, oid, 0, 100000, bl);
map<uint64_t,uint64_t> m, e;
bufferlist::iterator p = bl.begin();
- ::decode(m, p);
+ decode(m, p);
cout << " got " << m << std::endl;
e[0] = 100000;
EXPECT_TRUE(m == e || m.empty());
store->fiemap(cid, oid, 0, SKIP_STEP * (MAX_EXTENTS - 1) + 3, bl);
map<uint64_t,uint64_t> m, e;
bufferlist::iterator p = bl.begin();
- ::decode(m, p);
+ decode(m, p);
cout << " got " << m << std::endl;
ASSERT_TRUE(!m.empty());
ASSERT_GE(m[0], 3u);
store->fiemap(cid, oid, SKIP_STEP, SKIP_STEP * (MAX_EXTENTS - 2) + 3, bl);
map<uint64_t,uint64_t> m, e;
auto p = bl.begin();
- ::decode(m, p);
+ decode(m, p);
cout << " got " << m << std::endl;
ASSERT_TRUE(!m.empty());
// kstore always returns [0, object_size] regardless of offset and length
t.create_collection(cid, 5);
cerr << "create collection" << std::endl;
bufferlist hint;
- ::encode(pg_num, hint);
- ::encode(expected_num_objs, hint);
+ encode(pg_num, hint);
+ encode(expected_num_objs, hint);
t.collection_hint(cid, ObjectStore::Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS, hint);
cerr << "collection hint" << std::endl;
r = apply_transaction(store, &osr, std::move(t));
int32_t txn = 0;
if (bl.length()) {
bufferlist::iterator p = bl.begin();
- ::decode(txn, p);
+ decode(txn, p);
}
store->umount();
void ContDesc::encode(bufferlist &bl) const
{
ENCODE_START(1, 1, bl);
- ::encode(objnum, bl);
- ::encode(cursnap, bl);
- ::encode(seqnum, bl);
- ::encode(prefix, bl);
- ::encode(oid, bl);
+ encode(objnum, bl);
+ encode(cursnap, bl);
+ encode(seqnum, bl);
+ encode(prefix, bl);
+ encode(oid, bl);
ENCODE_FINISH(bl);
}
void ContDesc::decode(bufferlist::iterator &bl)
{
DECODE_START(1, bl);
- ::decode(objnum, bl);
- ::decode(cursnap, bl);
- ::decode(seqnum, bl);
- ::decode(prefix, bl);
- ::decode(oid, bl);
+ decode(objnum, bl);
+ decode(cursnap, bl);
+ decode(seqnum, bl);
+ decode(prefix, bl);
+ decode(oid, bl);
DECODE_FINISH(bl);
}
}
bufferlist contbl;
- ::encode(cont, contbl);
+ encode(cont, contbl);
pair<TestOp*, TestOp::CallbackInfo*> *cb_arg =
new pair<TestOp*, TestOp::CallbackInfo*>(
this,
}
bufferlist contbl;
- ::encode(cont, contbl);
+ encode(cont, contbl);
pair<TestOp*, TestOp::CallbackInfo*> *cb_arg =
new pair<TestOp*, TestOp::CallbackInfo*>(
this,
&results[index],
&retvals[index]);
bufferlist init_value_bl;
- ::encode(static_cast<uint32_t>(-1), init_value_bl);
+ encode(static_cast<uint32_t>(-1), init_value_bl);
read_op.checksum(LIBRADOS_CHECKSUM_TYPE_CRC32C, init_value_bl, 0, len,
0, &checksums[index], &checksum_retvals[index]);
} else {
if (old_value.has_contents()) {
ContDesc to_check;
bufferlist::iterator p = headerbl.begin();
- ::decode(to_check, p);
+ decode(to_check, p);
if (to_check != old_value.most_recent()) {
cerr << num << ": oid " << oid << " found incorrect object contents " << to_check
<< ", expected " << old_value.most_recent() << std::endl;
try {
auto bl_it = checksums[i].begin();
uint32_t csum_count;
- ::decode(csum_count, bl_it);
- ::decode(checksum, bl_it);
+ decode(csum_count, bl_it);
+ decode(checksum, bl_it);
} catch (const buffer::error &err) {
checksum_retvals[i] = -EBADMSG;
}
&retvals[index]);
if (index != 0) {
bufferlist init_value_bl;
- ::encode(static_cast<uint32_t>(-1), init_value_bl);
+ encode(static_cast<uint32_t>(-1), init_value_bl);
read_op.checksum(LIBRADOS_CHECKSUM_TYPE_CRC32C, init_value_bl, offset, length,
0, &checksums[index], &checksum_retvals[index]);
}
try {
auto bl_it = checksums[1].begin();
uint32_t csum_count;
- ::decode(csum_count, bl_it);
- ::decode(checksum[1], bl_it);
+ decode(csum_count, bl_it);
+ decode(checksum[1], bl_it);
} catch (const buffer::error &err) {
checksum_retvals[1] = -EBADMSG;
}
if (r == 0) {
HitSet hitset;
bufferlist::iterator p = bl.begin();
- ::decode(hitset, p);
+ decode(hitset, p);
cout << num << ": got hitset of type " << hitset.get_type_name()
<< " size " << bl.length()
<< std::endl;
object_info_t existing_info;
existing_info.version = eversion_t(6, 2);
bufferlist enc_oi;
- ::encode(existing_info, enc_oi, 0);
+ encode(existing_info, enc_oi, 0);
ObjectStore::Transaction t2;
t2.touch(test_coll, ghobject_t(existing_oid));
t2.setattr(test_coll, ghobject_t(existing_oid), OI_ATTR, enc_oi);
int a = 1, b = 2, c = 3, d = 4;
void encode(bufferlist &bl) const {
ENCODE_START(1, 1, bl);
- ::encode(a, bl);
- ::encode(b, bl);
- ::encode(c, bl);
- ::encode(d, bl);
+ encode(a, bl);
+ encode(b, bl);
+ encode(c, bl);
+ encode(d, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator &bl) {
DECODE_START(1, bl);
- ::decode(a, bl);
- ::decode(b, bl);
- ::decode(c, bl);
- ::decode(d, bl);
+ decode(a, bl);
+ decode(b, bl);
+ decode(c, bl);
+ decode(d, bl);
DECODE_FINISH(bl);
}
};
for (int i = 0; i < count; i++) {
bufferlist b;
DummyBlock dummy_block;
- ::encode(dummy_block, b);
+ encode(dummy_block, b);
bufferlist::iterator iter = b.begin();
- ::decode(dummy_block, iter);
+ decode(dummy_block, iter);
}
uint64_t stop = Cycles::rdtsc();
return Cycles::to_seconds(stop - start)/count;
for (int i = 0; i < count; i++) {
bufferlist b;
DummyBlock dummy_block;
- ::encode(dummy_block, b);
+ encode(dummy_block, b);
uint64_t start = Cycles::rdtsc();
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
- ::encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
+ encode(dummy_block, b);
total += Cycles::rdtsc() - start;
}
return Cycles::to_seconds(total)/(count*10);
std::map<std::string, cls::rbd::TrashImageSpec>&& images,
int r) {
bufferlist bl;
- ::encode(last_image_id, bl);
- ::encode(static_cast<size_t>(1024), bl);
+ encode(last_image_id, bl);
+ encode(static_cast<size_t>(1024), bl);
bufferlist out_bl;
- ::encode(images, out_bl);
+ encode(images, out_bl);
EXPECT_CALL(get_mock_io_ctx(io_ctx),
exec(RBD_TRASH, _, StrEq("rbd"), StrEq("trash_list"),
void encode(bufferlist& bl) const {
ENCODE_START(8, 3, bl);
- ::encode(name, bl);
- ::encode(data_pool, bl);
- ::encode(marker, bl);
- ::encode(bucket_id, bl);
- ::encode(index_pool, bl);
- ::encode(data_extra_pool, bl);
- ::encode(tenant, bl);
+ encode(name, bl);
+ encode(data_pool, bl);
+ encode(marker, bl);
+ encode(bucket_id, bl);
+ encode(index_pool, bl);
+ encode(data_extra_pool, bl);
+ encode(tenant, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
DECODE_START_LEGACY_COMPAT_LEN(8, 3, 3, bl);
- ::decode(name, bl);
- ::decode(data_pool, bl);
+ decode(name, bl);
+ decode(data_pool, bl);
if (struct_v >= 2) {
- ::decode(marker, bl);
+ decode(marker, bl);
if (struct_v <= 3) {
uint64_t id;
- ::decode(id, bl);
+ decode(id, bl);
char buf[16];
snprintf(buf, sizeof(buf), "%llu", (long long)id);
bucket_id = buf;
} else {
- ::decode(bucket_id, bl);
+ decode(bucket_id, bl);
}
}
if (struct_v >= 5) {
- ::decode(index_pool, bl);
+ decode(index_pool, bl);
} else {
index_pool = data_pool;
}
if (struct_v >= 7) {
- ::decode(data_extra_pool, bl);
+ decode(data_extra_pool, bl);
}
if (struct_v >= 8) {
- ::decode(tenant, bl);
+ decode(tenant, bl);
}
DECODE_FINISH(bl);
}
void encode(bufferlist& bl) const {
ENCODE_START(5, 3, bl);
- ::encode(bucket.name, bl);
- ::encode(loc, bl);
- ::encode(ns, bl);
- ::encode(object, bl);
- ::encode(bucket, bl);
- ::encode(instance, bl);
+ encode(bucket.name, bl);
+ encode(loc, bl);
+ encode(ns, bl);
+ encode(object, bl);
+ encode(bucket, bl);
+ encode(instance, bl);
if (!ns.empty() || !instance.empty()) {
- ::encode(orig_obj, bl);
+ encode(orig_obj, bl);
}
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
DECODE_START_LEGACY_COMPAT_LEN(5, 3, 3, bl);
- ::decode(bucket.name, bl);
- ::decode(loc, bl);
- ::decode(ns, bl);
- ::decode(object, bl);
+ decode(bucket.name, bl);
+ decode(loc, bl);
+ decode(ns, bl);
+ decode(object, bl);
if (struct_v >= 2)
- ::decode(bucket, bl);
+ decode(bucket, bl);
if (struct_v >= 4)
- ::decode(instance, bl);
+ decode(instance, bl);
if (ns.empty() && instance.empty()) {
if (object[0] != '_') {
orig_obj = object;
}
} else {
if (struct_v >= 5) {
- ::decode(orig_obj, bl);
+ decode(orig_obj, bl);
} else {
ssize_t pos = object.find('_', 1);
if (pos < 0) {
void encode(bufferlist& bl) const {
ENCODE_START(2, 2, bl);
- ::encode(loc, bl);
- ::encode(loc_ofs, bl);
- ::encode(size, bl);
+ encode(loc, bl);
+ encode(loc_ofs, bl);
+ encode(size, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
DECODE_START_LEGACY_COMPAT_LEN_32(2, 2, 2, bl);
- ::decode(loc, bl);
- ::decode(loc_ofs, bl);
- ::decode(size, bl);
+ decode(loc, bl);
+ decode(loc_ofs, bl);
+ decode(size, bl);
DECODE_FINISH(bl);
}
void encode(bufferlist& bl) const {
ENCODE_START(2, 2, bl);
- ::encode(obj_size, bl);
- ::encode(objs, bl);
+ encode(obj_size, bl);
+ encode(objs, bl);
ENCODE_FINISH(bl);
}
void decode(bufferlist::iterator& bl) {
DECODE_START_LEGACY_COMPAT_LEN_32(6, 2, 2, bl);
- ::decode(obj_size, bl);
- ::decode(objs, bl);
+ decode(obj_size, bl);
+ decode(objs, bl);
DECODE_FINISH(bl);
}
bufferlist bl;
- ::encode(old_manifest , bl);
+ encode(old_manifest , bl);
RGWObjManifest manifest;
try {
auto iter = bl.begin();
- ::decode(manifest, iter);
+ decode(manifest, iter);
} catch (buffer::error& err) {
ASSERT_TRUE(false);
}
encode_json("obj1", obj1, formatter);
bufferlist bl;
- ::encode(obj1, bl);
+ encode(obj1, bl);
rgw_obj obj2;
- ::decode(obj2, bl);
+ decode(obj2, bl);
check_parsed_correctly(obj2, name, ns, instance);
encode_json("obj2", obj2, formatter);
rgw_obj obj3(o);
bufferlist bl3;
- ::encode(obj3, bl3);
- ::decode(obj3, bl3);
+ encode(obj3, bl3);
+ decode(obj3, bl3);
encode_json("obj3", obj3, formatter);
if (!instance.empty()) {
bufferlist bl;
- ::encode(old, bl);
+ encode(old, bl);
rgw_obj new_obj;
rgw_raw_obj raw_obj;
try {
bufferlist::iterator iter = bl.begin();
- ::decode(new_obj, iter);
+ decode(new_obj, iter);
iter = bl.begin();
- ::decode(raw_obj, iter);
+ decode(raw_obj, iter);
} catch (buffer::error& err) {
ASSERT_TRUE(false);
}
rgw_obj new_obj2;
rgw_raw_obj raw_obj2;
- ::encode(new_obj, bl);
+ encode(new_obj, bl);
dump(f, "raw_obj", raw_obj);
dump(f, "new_obj", new_obj);
try {
bufferlist::iterator iter = bl.begin();
- ::decode(new_obj2, iter);
+ decode(new_obj2, iter);
/*
can't decode raw obj here, because we didn't encode an old versioned
*/
bl.clear();
- ::encode(raw_obj, bl);
+ encode(raw_obj, bl);
iter = bl.begin();
- ::decode(raw_obj2, iter);
+ decode(raw_obj2, iter);
} catch (buffer::error& err) {
ASSERT_TRUE(false);
}
template<typename T>
void test_encode_decode(T v) {
bufferlist bl;
- ::encode(v, bl);
+ encode(v, bl);
bufferlist::iterator p = bl.begin();
T out;
- ::decode(out, p);
+ decode(out, p);
ASSERT_EQ(v, out);
}
template<typename T>
void test_encode_decode_featured(T v) {
bufferlist bl;
- ::encode(v, bl, 123);
+ encode(v, bl, 123);
bufferlist::iterator p = bl.begin();
T out;
- ::decode(out, p);
+ decode(out, p);
ASSERT_EQ(v, out);
}
denc_counter_t single, single2;
{
bufferlist bl;
- ::encode(single, bl);
- ::decode(single2, bl);
+ encode(single, bl);
+ decode(single2, bl);
}
ASSERT_EQ(counts.num_bound_encode, 1);
ASSERT_EQ(counts.num_encode, 1);
struct legacy_t {
int32_t a = 1;
void encode(bufferlist& bl) const {
- ::encode(a, bl);
+ using ceph::encode;
+ encode(a, bl);
}
void decode(bufferlist::iterator& p) {
- ::decode(a, p);
+ using ceph::decode;
+ decode(a, p);
}
legacy_t() {}
legacy_t(int32_t i) : a(i) {}
v.resize(100);
{
bufferlist bl;
- ::encode(v, bl);
- ::decode(v2, bl);
+ encode(v, bl);
+ decode(v2, bl);
}
ASSERT_EQ(counts.num_bound_encode, 100);
ASSERT_EQ(counts.num_encode, 100);
v.resize(100);
{
bufferlist bl;
- ::encode(v, bl);
- ::decode(v2, bl);
+ encode(v, bl);
+ decode(v2, bl);
}
ASSERT_EQ(counts.num_bound_encode, 1);
ASSERT_EQ(counts.num_encode, 100);
}
{
bufferlist bl;
- ::encode(l, bl);
- ::decode(l2, bl);
+ encode(l, bl);
+ decode(l2, bl);
}
ASSERT_EQ(counts.num_bound_encode, 1);
ASSERT_EQ(counts.num_encode, 100);
foo_t a;
test_denc(a);
bufferlist bl;
- ::encode(a, bl);
+ encode(a, bl);
bl.hexdump(cout);
}
{
auto a = bl.get_contiguous_appender(1000);
denc(p, a);
- ::encode(p, bl);
+ encode(p, bl);
}
pair<int32_t,legacy_t> lp;
- ::encode(lp, bl);
+ encode(lp, bl);
}
template<template<class, class> class C>
}
void decode(buffer::list::iterator& p) {
n_decode++;
- ::decode(value, p);
+ using ceph::decode;
+ decode(value, p);
}
static void reset() {
n_denc = n_decode = 0;
v.push_back(Legacy());
}
bufferlist bl(n * sizeof(uint8_t));
- ::encode(v, bl);
+ using ceph::encode;
+ encode(v, bl);
bufferlist segmented;
auto p = bl.begin();
// denc() is shared by encode() and decode(), so reset() right before
// decode()
Legacy::reset();
- ::decode(v, p);
+ decode(v, p);
ASSERT_EQ(N_COPIES, v.size());
ASSERT_EQ(N_COPIES, Legacy::n_denc);
ASSERT_EQ(0u, Legacy::n_decode);
auto p = segmented.begin();
vector<Legacy> v;
Legacy::reset();
- ::decode(v, p);
+ decode(v, p);
ASSERT_EQ(N_COPIES, v.size());
ASSERT_EQ(N_COPIES, Legacy::n_denc);
ASSERT_EQ(0u, Legacy::n_decode);
ASSERT_LT(segmented.length() - p.get_off(), CEPH_PAGE_SIZE);
vector<Legacy> v;
Legacy::reset();
- ::decode(v, p);
+ decode(v, p);
ASSERT_EQ(Legacy::n_denc, 100u);
ASSERT_EQ(0u, Legacy::n_decode);
}
ASSERT_GT(segmented.length() - p.get_off(), CEPH_PAGE_SIZE);
vector<Legacy> v;
Legacy::reset();
- ::decode(v, p);
+ decode(v, p);
ASSERT_EQ(0u, Legacy::n_denc);
ASSERT_EQ(CEPH_PAGE_SIZE * 2, Legacy::n_decode);
}
set<string> truth_keys;
string blah("asdf");
bufferlist bl;
- ::encode(blah, bl);
+ encode(blah, bl);
truth[string("asdf")] = bl;
truth_keys.insert(truth.begin()->first);
{