MCPcopy Create free account
hub / github.com/alibaba/euler / Load

Method Load

euler/client/graph_config.cc:31–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31bool GraphConfig::Load(const std::string& filename) {
32 FILE* fp = fopen(filename.c_str(), "rb");
33 if (fp == NULL) {
34 EULER_LOG(INFO) << "Open graph config file: " << filename << "failed!";
35 return false;
36 }
37 char* line = NULL;
38 size_t n = 0;
39 ssize_t nread = 0;
40 while ((nread = getline(&line, &n, fp)) > 0) {
41 line[nread] = '\0';
42 std::vector<std::string> vec = Split(line, '=');
43 if (vec.size() != 2) {
44 continue;
45 }
46 Slice s0 = vec[0], s1 = vec[1];
47 Trim(&s0); Trim(&s1);
48 Add(s0.ToString(), s1.ToString());
49 }
50 free(line);
51 fclose(fp);
52 return true;
53}
54
55bool GraphConfig::Get(const std::string& key, std::string* value) const {
56 auto it = config_.find(key);

Callers

nothing calls this directly

Calls 5

SplitFunction · 0.85
TrimFunction · 0.85
AddClass · 0.50
sizeMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected