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

Method Init

src/graph/client/dist_graph_client_impl.cc:55–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53class DistGraphClientImpl : public GraphClientImplBase<DistGraphClientTypes> {
54 public:
55 bool Init(const GraphConfig& config) {
56 resource_.reset(new graph_op::DistGSOpResource);
57
58 std::vector<deepx_core::TcpEndpoint> endpoints =
59 deepx_core::MakeTcpEndpoints(config.ip_ports());
60 auto rpc_connector = NewRpcConnector();
61 if (!rpc_connector->Connect(endpoints)) {
62 return false;
63 }
64 resource_->set_rpc_connector(std::move(rpc_connector));
65
66 int shard_num = (int)endpoints.size();
67 if (shard_num <= 0) {
68 DXERROR("Number of shard: %d must be greater than 0.", shard_num);
69 return false;
70 }
71 DXINFO("Number of shard is: %d.", shard_num);
72
73 // op factory init
74 factory_ = graph_op::DistGSOpFactory::GetInstance();
75 if (!factory_->Init(resource_.get(), shard_num)) {
76 return false;
77 }
78
79 return PostInitCacheStorage(resource_.get()) &&
80 PostInitServerDistribution(shard_num, resource_.get());
81 }
82};
83
84std::unique_ptr<GraphClientImpl> NewDistGraphClientImpl(

Callers 1

NewDistGraphClientImplFunction · 0.45

Calls 5

NewRpcConnectorFunction · 0.85
PostInitCacheStorageFunction · 0.85
ConnectMethod · 0.80
set_rpc_connectorMethod · 0.80

Tested by

no test coverage detected