MCPcopy Create free account
hub / github.com/ceph/ceph / parse

Method parse

src/msg/msg_types.cc:18–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include "include/types.h"
17
18bool entity_name_t::parse(std::string_view s)
19{
20 const char* start = s.data();
21 if (s.find("mon.") == 0) {
22 _type = TYPE_MON;
23 start += 4;
24 } else if (s.find("osd.") == 0) {
25 _type = TYPE_OSD;
26 start += 4;
27 } else if (s.find("mds.") == 0) {
28 _type = TYPE_MDS;
29 start += 4;
30 } else if (s.find("client.") == 0) {
31 _type = TYPE_CLIENT;
32 start += 7;
33 } else if (s.find("mgr.") == 0) {
34 _type = TYPE_MGR;
35 start += 4;
36 } else {
37 return false;
38 }
39 if (isspace(*start))
40 return false;
41 char *end = nullptr;
42 _num = strtoll(start, &end, 10);
43 if (end == nullptr || end == start) {
44 return false;
45 } else {
46 return end == s.data() + s.size();
47 }
48}
49
50void entity_name_t::dump(ceph::Formatter *f) const
51{

Callers

nothing calls this directly

Calls 9

is_ipv6Method · 0.80
entity_addr_tClass · 0.70
parseFunction · 0.50
dataMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected