MCPcopy Create free account
hub / github.com/apache/brpc / MutableMeta

Method MutableMeta

src/butil/recordio.cc:87–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87butil::IOBuf* Record::MutableMeta(const char* name_cstr, bool null_on_found) {
88 const butil::StringPiece name = name_cstr;
89 for (size_t i = 0; i < _metas.size(); ++i) {
90 if (_metas[i].name == name) {
91 return null_on_found ? NULL : _metas[i].data.get();
92 }
93 }
94 if (name.size() > MAX_NAME_SIZE) {
95 LOG(ERROR) << "Too long name=" << name;
96 return NULL;
97 } else if (name.empty()) {
98 LOG(ERROR) << "Empty name";
99 return NULL;
100 }
101 NamedMeta p;
102 name.CopyToString(&p.name);
103 p.data = std::make_shared<butil::IOBuf>();
104 _metas.push_back(p);
105 return p.data.get();
106}
107
108butil::IOBuf* Record::MutableMeta(const std::string& name, bool null_on_found) {
109 for (size_t i = 0; i < _metas.size(); ++i) {

Callers 2

TESTFunction · 0.80
CutRecordMethod · 0.80

Calls 5

CopyToStringMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by 1

TESTFunction · 0.64