case FN_OBJECT_ATTR:
{
- map<string,bufferptr> aset;
+ map<string,bufferptr,less<>> aset;
fs->store->getattrs(ch, oid, aset);
unsigned skip = offset;
for (auto a : aset) {
* @returns 0 on success, negative error code on failure.
*/
virtual int getattrs(CollectionHandle &c, const ghobject_t& oid,
- std::map<std::string,ceph::buffer::ptr>& aset) = 0;
+ std::map<std::string,ceph::buffer::ptr, std::less<>>& aset) = 0;
/**
* getattrs -- get all of the xattrs of an object
* @returns 0 on success, negative error code on failure.
*/
int getattrs(CollectionHandle &c, const ghobject_t& oid,
- std::map<std::string,ceph::buffer::list>& aset) {
- std::map<std::string,ceph::buffer::ptr> bmap;
+ std::map<std::string,ceph::buffer::list,std::less<>>& aset) {
+ std::map<std::string,ceph::buffer::ptr,std::less<>> bmap;
int r = getattrs(c, oid, bmap);
for (auto i = bmap.begin(); i != bmap.end(); ++i) {
aset[i->first].append(i->second);
t = new Transaction;
t->setattr(c, o1, "key", bl);
- map<string,bufferptr> m;
+ map<string,bufferptr,less<>> m;
m["a"] = buffer::copy("this", 4);
m["b"] = buffer::copy("that", 4);
t->setattrs(c, o1, m);
data.ops = data.ops + 1;
}
/// Set multiple xattrs of an object
- void setattrs(const coll_t& cid, const ghobject_t& oid, const std::map<std::string,ceph::buffer::ptr>& attrset) {
+ void setattrs(const coll_t& cid,
+ const ghobject_t& oid,
+ const std::map<std::string,ceph::buffer::ptr,std::less<>>& attrset) {
using ceph::encode;
Op* _op = _get_next_op();
_op->op = OP_SETATTRS;
data.ops = data.ops + 1;
}
/// Set multiple xattrs of an object
- void setattrs(const coll_t& cid, const ghobject_t& oid, const std::map<std::string,ceph::buffer::list>& attrset) {
+ void setattrs(const coll_t& cid,
+ const ghobject_t& oid,
+ const std::map<std::string,ceph::buffer::list,std::less<>>& attrset) {
using ceph::encode;
Op* _op = _get_next_op();
_op->op = OP_SETATTRS;
int BlueStore::getattrs(
CollectionHandle &c_,
const ghobject_t& oid,
- map<string,bufferptr>& aset)
+ map<string,bufferptr,less<>>& aset)
{
Collection *c = static_cast<Collection *>(c_.get());
dout(15) << __func__ << " " << c->cid << " " << oid << dendl;
ceph::buffer::ptr& value) override;
int getattrs(CollectionHandle &c, const ghobject_t& oid,
- std::map<std::string,ceph::buffer::ptr>& aset) override;
+ std::map<std::string,ceph::buffer::ptr, std::less<>>& aset) override;
int list_collections(std::vector<coll_t>& ls) override;
{
char buf[2];
- map<string, bufferptr> aset;
+ map<string, bufferptr, less<>> aset;
r = _fgetattrs(**o, aset);
if (r < 0)
goto out3;
return l;
}
-int FileStore::_fgetattrs(int fd, map<string,bufferptr>& aset)
+int FileStore::_fgetattrs(int fd, map<string,bufferptr,less<>>& aset)
{
// get attr list
char names1[100];
return 0;
}
-int FileStore::_fsetattrs(int fd, map<string, bufferptr> &aset)
+int FileStore::_fsetattrs(int fd, map<string, bufferptr, less<>> &aset)
{
for (map<string, bufferptr>::iterator p = aset.begin();
p != aset.end();
}
}
-int FileStore::getattrs(CollectionHandle& ch, const ghobject_t& oid, map<string,bufferptr>& aset)
+int FileStore::getattrs(CollectionHandle& ch,
+ const ghobject_t& oid,
+ std::map<std::string,bufferptr,std::less<>>& aset)
{
tracepoint(objectstore, getattrs_enter, ch->cid.c_str());
const coll_t& cid = !_need_temp_object_collection(ch->cid, oid) ? ch->cid : ch->cid.get_temp();
{
map<string, bufferlist> omap_set;
set<string> omap_remove;
- map<string, bufferptr> inline_set;
- map<string, bufferptr> inline_to_set;
+ map<string, bufferptr, less<>> inline_set;
+ map<string, bufferptr, less<>> inline_to_set;
FDRef fd;
int spill_out = -1;
bool incomplete_inline = false;
{
dout(15) << __FUNC__ << ": " << cid << "/" << oid << dendl;
- map<string,bufferptr> aset;
+ map<string,bufferptr,less<>> aset;
FDRef fd;
set<string> omap_attrs;
Index index;
int _remove(const coll_t& cid, const ghobject_t& oid, const SequencerPosition &spos);
int _fgetattr(int fd, const char *name, ceph::bufferptr& bp);
- int _fgetattrs(int fd, std::map<std::string, ceph::bufferptr>& aset);
- int _fsetattrs(int fd, std::map<std::string, ceph::bufferptr> &aset);
+ int _fgetattrs(int fd, std::map<std::string, ceph::bufferptr,std::less<>>& aset);
+ int _fsetattrs(int fd, std::map<std::string, ceph::bufferptr,std::less<>>& aset);
void do_force_sync();
void start_sync(Context *onsafe);
using ObjectStore::getattr;
using ObjectStore::getattrs;
int getattr(CollectionHandle& c, const ghobject_t& oid, const char *name, ceph::bufferptr &bp) override;
- int getattrs(CollectionHandle& c, const ghobject_t& oid, std::map<std::string,ceph::bufferptr>& aset) override;
+ int getattrs(CollectionHandle& c, const ghobject_t& oid, std::map<std::string,ceph::bufferptr,std::less<>>& aset) override;
int _setattrs(const coll_t& cid, const ghobject_t& oid, std::map<std::string,ceph::bufferptr>& aset,
const SequencerPosition &spos);
int KStore::getattrs(
CollectionHandle& ch,
const ghobject_t& oid,
- map<string,bufferptr>& aset)
+ map<string,bufferptr,less<>>& aset)
{
dout(15) << __func__ << " " << ch->cid << " " << oid << dendl;
Collection *c = static_cast<Collection*>(ch.get());
using ObjectStore::getattr;
int getattr(CollectionHandle& c, const ghobject_t& oid, const char *name, ceph::buffer::ptr& value) override;
using ObjectStore::getattrs;
- int getattrs(CollectionHandle& c, const ghobject_t& oid, std::map<std::string,ceph::buffer::ptr>& aset) override;
+ int getattrs(CollectionHandle& c,
+ const ghobject_t& oid,
+ std::map<std::string,ceph::buffer::ptr,std::less<>>& aset) override;
int list_collections(std::vector<coll_t>& ls) override;
bool collection_exists(const coll_t& c) override;
struct kstore_onode_t {
uint64_t nid; ///< numeric id (locally unique)
uint64_t size; ///< object size
- std::map<std::string, ceph::buffer::ptr> attrs; ///< attrs
+ std::map<std::string, ceph::buffer::ptr, std::less<>> attrs; ///< attrs
uint64_t omap_head; ///< id for omap root node
uint32_t stripe_size; ///< stripe size
}
int MemStore::getattrs(CollectionHandle &c_, const ghobject_t& oid,
- std::map<std::string,ceph::buffer::ptr>& aset)
+ std::map<std::string,ceph::buffer::ptr,std::less<>>& aset)
{
Collection *c = static_cast<Collection*>(c_.get());
dout(10) << __func__ << " " << c->cid << " " << oid << dendl;
struct Object : public RefCountedObject {
ceph::mutex xattr_mutex{ceph::make_mutex("MemStore::Object::xattr_mutex")};
ceph::mutex omap_mutex{ceph::make_mutex("MemStore::Object::omap_mutex")};
- std::map<std::string,ceph::buffer::ptr> xattr;
+ std::map<std::string,ceph::buffer::ptr,std::less<>> xattr;
ceph::buffer::list omap_header;
std::map<std::string,ceph::buffer::list> omap;
int getattr(CollectionHandle &c, const ghobject_t& oid, const char *name,
ceph::buffer::ptr& value) override;
int getattrs(CollectionHandle &c, const ghobject_t& oid,
- std::map<std::string,ceph::buffer::ptr>& aset) override;
+ std::map<std::string,ceph::buffer::ptr,std::less<>>& aset) override;
int list_collections(std::vector<coll_t>& ls) override;
void ECBackend::handle_recovery_read_complete(
const hobject_t &hoid,
boost::tuple<uint64_t, uint64_t, map<pg_shard_t, bufferlist> > &to_read,
- std::optional<map<string, bufferlist> > attrs,
+ std::optional<map<string, bufferlist, less<>> > attrs,
RecoveryMessages *m)
{
dout(10) << __func__ << ": returned " << hoid << " "
}
// Need to remove ECUtil::get_hinfo_key() since it should not leak out
// of the backend (see bug #12983)
- map<string, bufferlist> sanitized_attrs(op.xattrs);
+ map<string, bufferlist, less<>> sanitized_attrs(op.xattrs);
sanitized_attrs.erase(ECUtil::get_hinfo_key());
op.obc = get_parent()->get_obc(hoid, sanitized_attrs);
ceph_assert(op.obc);
dout(20) << __func__ << " to_read skipping" << dendl;
continue;
}
- rop.complete[i->first].attrs = map<string, bufferlist>();
+ rop.complete[i->first].attrs.emplace();
(*(rop.complete[i->first].attrs)).swap(i->second);
}
for (auto i = op.errors.begin();
}
ECUtil::HashInfoRef ECBackend::get_hash_info(
- const hobject_t &hoid, bool checks, const map<string,bufferptr> *attrs)
+ const hobject_t &hoid, bool checks, const map<string,bufferptr,less<>> *attrs)
{
dout(10) << __func__ << ": Getting attr on " << hoid << dendl;
ECUtil::HashInfoRef ref = unstable_hashinfo_registry.lookup(hoid);
int ECBackend::objects_get_attrs(
const hobject_t &hoid,
- map<string, bufferlist> *out)
+ map<string, bufferlist, less<>> *out)
{
int r = store->getattrs(
ch,
// must be filled if state == WRITING
std::map<int, ceph::buffer::list> returned_data;
- std::map<std::string, ceph::buffer::list> xattrs;
+ std::map<std::string, ceph::buffer::list, std::less<>> xattrs;
ECUtil::HashInfoRef hinfo;
ObjectContextRef obc;
std::set<pg_shard_t> waiting_on_pushes;
void handle_recovery_read_complete(
const hobject_t &hoid,
boost::tuple<uint64_t, uint64_t, std::map<pg_shard_t, ceph::buffer::list> > &to_read,
- std::optional<std::map<std::string, ceph::buffer::list> > attrs,
+ std::optional<std::map<std::string, ceph::buffer::list, std::less<>> > attrs,
RecoveryMessages *m);
void handle_recovery_push(
const PushOp &op,
struct read_result_t {
int r;
std::map<pg_shard_t, int> errors;
- std::optional<std::map<std::string, ceph::buffer::list> > attrs;
+ std::optional<std::map<std::string, ceph::buffer::list, std::less<>> > attrs;
std::list<
boost::tuple<
uint64_t, uint64_t, std::map<pg_shard_t, ceph::buffer::list> > > returned;
/// If modified, ensure that the ref is held until the update is applied
SharedPtrRegistry<hobject_t, ECUtil::HashInfo> unstable_hashinfo_registry;
ECUtil::HashInfoRef get_hash_info(const hobject_t &hoid, bool checks = true,
- const std::map<std::string, ceph::buffer::ptr> *attr = NULL);
+ const std::map<std::string, ceph::buffer::ptr, std::less<>> *attr = NULL);
public:
ECBackend(
int objects_get_attrs(
const hobject_t &hoid,
- std::map<std::string, ceph::buffer::list> *out) override;
+ std::map<std::string, ceph::buffer::list, std::less<>> *out) override;
void rollback_append(
const hobject_t &hoid,
pg_shard_t from;
ceph_tid_t tid;
std::map<hobject_t, std::list<std::pair<uint64_t, ceph::buffer::list> >> buffers_read;
- std::map<hobject_t, std::map<std::string, ceph::buffer::list>> attrs_read;
+ std::map<hobject_t, std::map<std::string, ceph::buffer::list, std::less<>>> attrs_read;
std::map<hobject_t, int> errors;
void encode(ceph::buffer::list &bl) const;
void decode(ceph::buffer::list::const_iterator &bl);
ceph_assert(op.omap_updates.empty());
if (!op.attr_updates.empty()) {
- map<string, bufferlist> to_set;
+ map<string, bufferlist, less<>> to_set;
for (auto &&j: op.attr_updates) {
if (j.second) {
to_set[j.first] = *(j.second);
int PGBackend::objects_get_attrs(
const hobject_t &hoid,
- map<string, bufferlist> *out)
+ map<string, bufferlist, less<>> *out)
{
return store->getattrs(
ch,
const hobject_t &hoid,
map<string, std::optional<bufferlist> > &old_attrs,
ObjectStore::Transaction *t) {
- map<string, bufferlist> to_set;
+ map<string, bufferlist, less<>> to_set;
ceph_assert(!hoid.is_temp());
for (map<string, std::optional<bufferlist> >::iterator i = old_attrs.begin();
i != old_attrs.end();
virtual ObjectContextRef get_obc(
const hobject_t &hoid,
- const std::map<std::string, ceph::buffer::list> &attrs) = 0;
+ const std::map<std::string, ceph::buffer::list, std::less<>> &attrs) = 0;
virtual bool try_lock_for_read(
const hobject_t &hoid,
virtual int objects_get_attrs(
const hobject_t &hoid,
- std::map<std::string, ceph::buffer::list> *out);
+ std::map<std::string, ceph::buffer::list, std::less<>> *out);
virtual int objects_read_sync(
const hobject_t &hoid,
/// Attr ops
void setattrs(
const hobject_t &hoid, ///< [in] object to write
- std::map<std::string, ceph::buffer::list> &attrs ///< [in] attrs, may be cleared
+ std::map<std::string, ceph::buffer::list, std::less<>> &attrs ///< [in] attrs, may be cleared
) {
auto &op = get_object_op_for_modify(hoid);
- for (auto &&i: attrs) {
- auto& d = op.attr_updates[i.first];
- d = i.second;
+ for (auto &[key, val]: attrs) {
+ auto& d = op.attr_updates[key];
+ d = val;
d->rebuild();
}
}
head_obc->obs.oi.prior_version = head_obc->obs.oi.version;
head_obc->obs.oi.version = ctx->at_version;
- map <string, bufferlist> attrs;
+ map <string, bufferlist, less<>> attrs;
bl.clear();
encode(snapset, bl);
attrs[SS_ATTR] = std::move(bl);
++ctx->num_read;
{
tracepoint(osd, do_osd_op_pre_getxattrs, soid.oid.name.c_str(), soid.snap.val);
- map<string, bufferlist> out;
+ map<string, bufferlist,less<>> out;
result = getattrs_maybe_cache(
ctx->obc,
&out);
oi.user_version = target_version;
ctx->user_at_version = target_version;
/* rm_attrs */
- map<string,bufferlist> rmattrs;
+ map<string,bufferlist,less<>> rmattrs;
result = getattrs_maybe_cache(ctx->obc, &rmattrs);
if (result < 0) {
dout(10) << __func__ << " error: " << cpp_strerror(result) << dendl;
}
// object_info_t
- map <string, bufferlist> attrs;
+ map <string, bufferlist, less<>> attrs;
bufferlist bv(sizeof(ctx->new_obs.oi));
encode(ctx->new_obs.oi, bv,
get_osdmap()->get_features(CEPH_ENTITY_TYPE_OSD, nullptr));
reply_obj.truncate_size = oi.truncate_size;
// attrs
- map<string,bufferlist>& out_attrs = reply_obj.attrs;
+ map<string,bufferlist,less<>>& out_attrs = reply_obj.attrs;
if (!cursor.attr_complete) {
result = getattrs_maybe_cache(
ctx->obc,
ObjectContextRef PrimaryLogPG::get_object_context(
const hobject_t& soid,
bool can_create,
- const map<string, bufferlist> *attrs)
+ const map<string, bufferlist, less<>> *attrs)
{
auto it_objects = recovery_state.get_pg_log().get_log().objects.find(soid);
ceph_assert(
SnapSetContext *PrimaryLogPG::get_snapset_context(
const hobject_t& oid,
bool can_create,
- const map<string, bufferlist> *attrs,
+ const map<string, bufferlist, less<>> *attrs,
bool oid_existed)
{
std::lock_guard l(snapset_contexts_lock);
0, bl.length());
ctx->clean_regions.mark_data_region_dirty(0, bl.length());
}
- map <string, bufferlist> attrs;
- attrs[OI_ATTR] = std::move(boi);
- attrs[SS_ATTR] = std::move(bss);
+ map<string, bufferlist, std::less<>> attrs = {
+ {OI_ATTR, std::move(boi)},
+ {SS_ATTR, std::move(bss)}
+ };
setattrs_maybe_cache(ctx->obc, ctx->op_t.get(), attrs);
ctx->log.push_back(
pg_log_entry_t(
void PrimaryLogPG::setattrs_maybe_cache(
ObjectContextRef obc,
PGTransaction *t,
- map<string, bufferlist> &attrs)
+ map<string, bufferlist, less<>> &attrs)
{
t->setattrs(obc->obs.oi.soid, attrs);
}
int PrimaryLogPG::getattrs_maybe_cache(
ObjectContextRef obc,
- map<string, bufferlist> *out)
+ map<string, bufferlist, less<>> *out)
{
int r = 0;
ceph_assert(out);
} else {
r = pgbackend->objects_get_attrs(obc->obs.oi.soid, out);
}
- map<string, bufferlist> tmp;
- for (map<string, bufferlist>::iterator i = out->begin();
- i != out->end();
- ++i) {
- if (i->first.size() > 1 && i->first[0] == '_')
- tmp[i->first.substr(1, i->first.size())] = std::move(i->second);
+ map<string, bufferlist, less<>> tmp;
+ for (auto& [key, val]: *out) {
+ if (key.size() > 1 && key[0] == '_') {
+ tmp[key.substr(1, key.size())] = std::move(val);
+ }
}
tmp.swap(*out);
return r;
uint32_t data_digest, omap_digest;
mempool::osd_pglog::vector<std::pair<osd_reqid_t, version_t> > reqids; // [(reqid, user_version)]
mempool::osd_pglog::map<uint32_t, int> reqid_return_codes; // std::map reqids by index to error code
- std::map<std::string, ceph::buffer::list> attrs; // xattrs
+ std::map<std::string, ceph::buffer::list, std::less<>> attrs; // xattrs
uint64_t truncate_seq;
uint64_t truncate_size;
bool is_data_digest() {
ceph_tid_t objecter_tid2;
object_copy_cursor_t cursor;
- std::map<std::string,ceph::buffer::list> attrs;
+ std::map<std::string,ceph::buffer::list,std::less<>> attrs;
ceph::buffer::list data;
ceph::buffer::list omap_header;
ceph::buffer::list omap_data;
ObjectContextRef get_obc(
const hobject_t &hoid,
- const std::map<std::string, ceph::buffer::list> &attrs) override {
+ const std::map<std::string, ceph::buffer::list, std::less<>> &attrs) override {
return get_object_context(hoid, true, &attrs);
}
ObjectContextRef get_object_context(
const hobject_t& soid,
bool can_create,
- const std::map<std::string, ceph::buffer::list> *attrs = 0
+ const std::map<std::string, ceph::buffer::list, std::less<>> *attrs = 0
);
void context_registry_on_change();
SnapSetContext *get_snapset_context(
const hobject_t& oid,
bool can_create,
- const std::map<std::string, ceph::buffer::list> *attrs = 0,
+ const std::map<std::string, ceph::buffer::list, std::less<>> *attrs = 0,
bool oid_existed = true //indicate this oid whether exsited in backend
);
void register_snapset_context(SnapSetContext *ssc) {
void setattrs_maybe_cache(
ObjectContextRef obc,
PGTransaction *t,
- std::map<std::string, ceph::buffer::list> &attrs);
+ std::map<std::string, ceph::buffer::list, std::less<>> &attrs);
void rmattr_maybe_cache(
ObjectContextRef obc,
PGTransaction *t,
ceph::buffer::list *val);
int getattrs_maybe_cache(
ObjectContextRef obc,
- std::map<std::string, ceph::buffer::list> *out);
+ std::map<std::string, ceph::buffer::list, std::less<>> *out);
public:
void set_dynamic_perf_stats_queries(
}
if (!op.attr_updates.empty()) {
- map<string, bufferlist> attrs;
+ map<string, bufferlist, less<>> attrs;
for (auto &&p: op.attr_updates) {
if (p.second)
attrs[p.first] = *(p.second);
const interval_set<uint64_t> &intervals_included,
bufferlist data_included,
bufferlist omap_header,
- const map<string, bufferlist> &attrs,
+ const map<string, bufferlist, less<>> &attrs,
const map<string, bufferlist> &omap_entries,
ObjectStore::Transaction *t)
{
const interval_set<uint64_t> &intervals_included,
ceph::buffer::list data_included,
ceph::buffer::list omap_header,
- const std::map<std::string, ceph::buffer::list> &attrs,
+ const std::map<std::string, ceph::buffer::list, std::less<>> &attrs,
const std::map<std::string, ceph::buffer::list> &omap_entries,
ObjectStore::Transaction *t);
void submit_push_complete(const ObjectRecoveryInfo &recovery_info,
std::map<std::pair<uint64_t, entity_name_t>, WatchRef> watchers;
// attr cache
- std::map<std::string, ceph::buffer::list> attr_cache;
+ std::map<std::string, ceph::buffer::list, std::less<>> attr_cache;
RWState rwstate;
std::list<OpRequestRef> waiters; ///< ops waiting on state change
utime_t mtime;
uint32_t data_digest, omap_digest;
uint32_t flags;
- std::map<std::string, ceph::buffer::list> attrs;
+ std::map<std::string, ceph::buffer::list, std::less<>> attrs;
ceph::buffer::list data;
ceph::buffer::list omap_header;
ceph::buffer::list omap_data;
interval_set<uint64_t> data_included;
ceph::buffer::list omap_header;
std::map<std::string, ceph::buffer::list> omap_entries;
- std::map<std::string, ceph::buffer::list> attrset;
+ std::map<std::string, ceph::buffer::list, std::less<>> attrset;
ObjectRecoveryInfo recovery_info;
ObjectRecoveryProgress before_progress;
*/
struct ScrubMap {
struct object {
- std::map<std::string, ceph::buffer::ptr> attrs;
+ std::map<std::string, ceph::buffer::ptr, std::less<>> attrs;
uint64_t size;
__u32 omap_digest; ///< omap crc32c
__u32 digest; ///< data crc32c
object_copy_cursor_t *cursor;
uint64_t *out_size;
ceph::real_time *out_mtime;
- std::map<std::string,ceph::buffer::list> *out_attrs;
+ std::map<std::string,ceph::buffer::list,std::less<>> *out_attrs;
ceph::buffer::list *out_data, *out_omap_header, *out_omap_data;
std::vector<snapid_t> *out_snaps;
snapid_t *out_snap_seq;
C_ObjectOperation_copyget(object_copy_cursor_t *c,
uint64_t *s,
ceph::real_time *m,
- std::map<std::string,ceph::buffer::list> *a,
+ std::map<std::string,ceph::buffer::list,std::less<>> *a,
ceph::buffer::list *d, ceph::buffer::list *oh,
ceph::buffer::list *o,
std::vector<snapid_t> *osnaps,
uint64_t max,
uint64_t *out_size,
ceph::real_time *out_mtime,
- std::map<std::string,ceph::buffer::list> *out_attrs,
+ std::map<std::string,ceph::buffer::list,std::less<>> *out_attrs,
ceph::buffer::list *out_data,
ceph::buffer::list *out_omap_header,
ceph::buffer::list *out_omap_data,
bl.push_back(buffer::copy(reinterpret_cast<char*>(u->xfer_buf),
u->xfer_buflen ) );
- map<string,bufferptr> attrset;
+ map<string,bufferptr,less<>> attrset;
map<string, bufferlist> omaps;
// enqueue a write transaction on the collection's handle
ObjectStore::Transaction t;
}
}
- if (attrset.size()) {
+ if (!attrset.empty()) {
t.setattrs(coll.cid, object.oid, attrset);
}
t.write(coll.cid, object.oid, u->offset, u->xfer_buflen, bl, flags);
}
-bool FileStoreDiff::diff_attrs(std::map<std::string,bufferptr>& b,
- std::map<std::string,bufferptr>& a)
+bool FileStoreDiff::diff_attrs(std::map<std::string,bufferptr,std::less<>>& b,
+ std::map<std::string,bufferptr,std::less<>>& a)
{
bool ret = false;
- std::map<std::string, bufferptr>::iterator b_it = b.begin();
- std::map<std::string, bufferptr>::iterator a_it = a.begin();
+ auto b_it = b.begin();
+ auto a_it = a.begin();
for (; b_it != b.end(); ++b_it, ++a_it) {
if (b_it->first != a_it->first) {
cout << "diff_attrs name mismatch (verify: " << b_it->first
ret = true;
}
- std::map<std::string, bufferptr> a_obj_attrs_map, b_obj_attrs_map;
+ std::map<std::string, bufferptr, std::less<>> a_obj_attrs_map, b_obj_attrs_map;
err = a_store->getattrs(a_ch, a_obj, a_obj_attrs_map);
if (err < 0) {
cout << "diff_objects getattrs on A object " << coll << "/" << a_obj
bool diff_objects(FileStore *a_store, FileStore *b_store, coll_t coll);
bool diff_objects_stat(struct stat& a, struct stat& b);
- bool diff_attrs(std::map<std::string,bufferptr>& b,
- std::map<std::string,bufferptr>& a);
+ bool diff_attrs(std::map<std::string,bufferptr,std::less<>>& b,
+ std::map<std::string,bufferptr,std::less<>>& a);
public:
FileStoreDiff(FileStore *a, FileStore *b);
bl.append(bp);
ASSERT_TRUE(bl_eq(val, bl));
- map<string,bufferptr> bm;
+ map<string,bufferptr,less<>> bm;
r = store->getattrs(ch, hoid, bm);
ASSERT_EQ(0, r);
boost::uniform_int<> u3(0, 100);
uint64_t size = u0(*rng);
uint64_t name_len;
- map<string, bufferlist> attrs;
+ map<string, bufferlist, less<>> attrs;
set<string> keys;
for (map<string, bufferlist>::iterator it = contents[obj].attrs.begin();
it != contents[obj].attrs.end(); ++it)
available_objects.erase(obj);
ObjectStore::Transaction t;
- map<string, bufferlist> attrs;
+ map<string, bufferlist, less<>> attrs;
set<string> keys;
while (entries--) {
} while (contents[obj].attrs.empty());
expected = contents[obj].attrs;
}
- map<string, bufferlist> attrs;
+ map<string, bufferlist, less<>> attrs;
int r = store->getattrs(ch, obj, attrs);
ASSERT_TRUE(r == 0);
ASSERT_TRUE(attrs.size() == expected.size());
ASSERT_EQ(r, 0);
}
- map<string, bufferptr> aset;
+ map<string, bufferptr, less<>> aset;
store->getattrs(ch, hoid, aset);
ASSERT_EQ(aset.size(), attrs.size());
for (map<string, bufferptr>::iterator i = aset.begin();
};
struct attr_section {
- map<string,bufferlist> data;
- explicit attr_section(const map<string,bufferlist> &data) : data(data) { }
- explicit attr_section(map<string, bufferptr> &data_)
+ map<string,bufferlist,less<>> data;
+ explicit attr_section(const map<string,bufferlist,less<>> &data) : data(data) { }
+ explicit attr_section(map<string, bufferptr, less<>> &data_)
{
for (std::map<std::string, bufferptr>::iterator i = data_.begin();
i != data_.end(); ++i) {
}
//Handle attrs for this object
- map<string,bufferptr> aset;
+ map<string,bufferptr,less<>> aset;
ret = store->getattrs(ch, obj, aset);
if (ret) return ret;
attr_section as(aset);
int do_list_attrs(ObjectStore *store, coll_t coll, ghobject_t &ghobj)
{
auto ch = store->open_collection(coll);
- map<string,bufferptr> aset;
+ map<string,bufferptr,less<>> aset;
int r = store->getattrs(ch, ghobj, aset);
if (r < 0) {
cerr << "getattrs: " << cpp_strerror(r) << std::endl;
ObjectStore::Transaction t;
t.touch(cid, oid);
- map<string,bufferptr> attrs;
+ map<string,bufferptr,less<>> attrs;
src->getattrs(ch, oid, attrs);
if (!attrs.empty()) {
t.setattrs(cid, oid, attrs);
// Compose TYPE_ATTRS chunk
// ========================
std::map<std::string, bufferlist> raw_xattrs;
- std::map<std::string, bufferlist> xattrs;
+ std::map<std::string, bufferlist,less<>> xattrs;
r = io_ctx->getxattrs(oid, raw_xattrs);
if (r < 0) {
cerr << "error getting xattr set " << oid << ": " << cpp_strerror(r)