MCPcopy Create free account
hub / github.com/Tencent/embedx / InitGraphServer

Method InitGraphServer

src/graph/server/dist_graph_server.cc:57–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55using ::embedx::graph_op::LocalGSOpResource;
56
57bool DistGraphServer::InitGraphServer(const GraphConfig& config) {
58 resource_.reset(new graph_op::LocalGSOpResource);
59
60 resource_->set_graph_config(config);
61
62 // data
63 auto graph = InMemoryGraph::Create(config);
64 if (!graph) {
65 return false;
66 }
67 resource_->set_graph(std::move(graph));
68
69 auto sampler_source = NewGraphSamplerSource(resource_->graph());
70 if (!sampler_source) {
71 return false;
72 }
73 resource_->set_sampler_source(std::move(sampler_source));
74
75 auto negative_sampler_builder = NewSamplerBuilder(
76 resource_->sampler_source(), SamplerBuilderEnum::NEGATIVE_SAMPLER,
77 config.negative_sampler_type(), config.thread_num());
78 if (!negative_sampler_builder) {
79 return false;
80 }
81 resource_->set_negative_sampler_builder(std::move(negative_sampler_builder));
82
83 auto neighbor_sampler_builder = NewSamplerBuilder(
84 resource_->sampler_source(), SamplerBuilderEnum::NEIGHBOR_SAMPLER,
85 config.neighbor_sampler_type(), config.thread_num());
86 if (!neighbor_sampler_builder) {
87 return false;
88 }
89 resource_->set_neighbor_sampler_builder(std::move(neighbor_sampler_builder));
90
91 return LocalGSOpFactory::GetInstance()->Init(resource_.get());
92}
93
94bool DistGraphServer::InitRpcServer(const GraphConfig& config) {
95 vec_str_t ip_ports;

Callers

nothing calls this directly

Calls 13

NewGraphSamplerSourceFunction · 0.85
NewSamplerBuilderFunction · 0.85
set_graph_configMethod · 0.80
set_graphMethod · 0.80
graphMethod · 0.80
neighbor_sampler_typeMethod · 0.80
set_sampler_sourceMethod · 0.45
sampler_sourceMethod · 0.45
negative_sampler_typeMethod · 0.45
thread_numMethod · 0.45

Tested by

no test coverage detected