| 55 | using ::embedx::graph_op::LocalGSOpResource; |
| 56 | |
| 57 | bool 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 | |
| 94 | bool DistGraphServer::InitRpcServer(const GraphConfig& config) { |
| 95 | vec_str_t ip_ports; |
nothing calls this directly
no test coverage detected