]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_tag.h
update download target update for octopus release
[ceph.git] / ceph / src / rgw / rgw_tag.h
CommitLineData
11fdf7f2
TL
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
224ce89b
WB
4#ifndef RGW_TAG_H
5#define RGW_TAG_H
6
7#include <string>
8#include <include/types.h>
9#include <boost/container/flat_map.hpp>
10
11#include "rgw_common.h"
12
13class RGWObjTags
14{
15 protected:
16 using tag_map_t = boost::container::flat_map <std::string, std::string>;
17 tag_map_t tag_map;
18 public:
19 RGWObjTags() {}
20 ~RGWObjTags() {}
21
22 void encode(bufferlist& bl) const {
23 ENCODE_START(1,1,bl);
11fdf7f2 24 encode(tag_map, bl);
224ce89b
WB
25 ENCODE_FINISH(bl);
26 }
27
11fdf7f2 28 void decode(bufferlist::const_iterator &bl) {
224ce89b 29 DECODE_START_LEGACY_COMPAT_LEN(1, 1, 1, bl);
11fdf7f2 30 decode(tag_map,bl);
224ce89b
WB
31 DECODE_FINISH(bl);
32 }
33
34 void dump(Formatter *f) const;
35 bool add_tag(const std::string& key, const std::string& val="");
11fdf7f2 36 bool emplace_tag(std::string&& key, std::string&& val);
224ce89b
WB
37 int check_and_add_tag(const std::string& key, const std::string& val="");
38 size_t count() const {return tag_map.size();}
39 int set_from_string(const std::string& input);
11fdf7f2
TL
40 void clear() { tag_map.clear(); }
41 bool empty() const noexcept { return tag_map.empty(); }
224ce89b
WB
42 const tag_map_t& get_tags() const {return tag_map;}
43};
44WRITE_CLASS_ENCODER(RGWObjTags)
45
46#endif /* RGW_TAG_H */