11 #include <unordered_map>
14 #include "ScanEdgeIter.h"
15 #include "common/datatypes/HostAddr.h"
16 #include "common/graph/Response.h"
17 #include "common/thrift/ThriftTypes.h"
18 #include "nebula/mclient/MetaClient.h"
19 #include "nebula/sclient/SConfig.h"
20 #include "nebula/sclient/ScanEdgeIter.h"
21 #include "nebula/sclient/ScanVertexIter.h"
24 class IOThreadPoolExecutor;
33 template <
class ClientType>
34 class ThriftClientManager;
41 class MetaServiceAsyncClient;
49 class GraphStorageServiceAsyncClient;
51 class ScanEdgeRequest;
57 #define DEFAULT_LIMIT std::numeric_limits<int64_t>::max()
58 #define DEFAULT_START_TIME 0
59 #define DEFAULT_END_TIME std::numeric_limits<int64_t>::max()
66 explicit StorageClient(
const std::vector<std::string>& metaAddrs,
72 std::vector<PartitionID> getParts(
const std::string& spaceName);
77 std::vector<std::string> propNames,
78 int64_t limit = DEFAULT_LIMIT,
79 int64_t startTime = DEFAULT_START_TIME,
80 int64_t endTime = DEFAULT_END_TIME,
81 std::string filter =
"",
82 bool onlyLatestVersion =
false,
83 bool enableReadFromFollower =
true,
84 bool needAuth =
false,
85 const std::string& username =
"",
86 const std::string& password =
"");
89 std::string spaceName,
92 std::unordered_map<std::string, std::vector<std::string>> tagProps,
93 int64_t limit = DEFAULT_LIMIT,
94 int64_t startTime = DEFAULT_START_TIME,
95 int64_t endTime = DEFAULT_END_TIME,
96 std::string filter =
"",
97 bool onlyLatestVersion =
false,
98 bool enableReadFromFollower =
true,
99 bool needAuth =
false,
100 const std::string& username =
"",
101 const std::string& password =
"");
104 return mClient_.get();
108 std::pair<::nebula::ErrorCode, storage::cpp2::ScanResponse> doScanEdge(
109 const storage::cpp2::ScanEdgeRequest& req);
111 std::pair<::nebula::ErrorCode, storage::cpp2::ScanResponse> doScanVertex(
112 const storage::cpp2::ScanVertexRequest& req);
114 template <
typename Request,
typename RemoteFunc,
typename Response>
115 void getResponse(std::pair<HostAddr, Request>&& request,
116 RemoteFunc&& remoteFunc,
119 std::unique_ptr<MetaClient> mClient_;
121 std::shared_ptr<folly::IOThreadPoolExecutor> ioExecutor_;
122 std::shared_ptr<thrift::ThriftClientManager<storage::cpp2::GraphStorageServiceAsyncClient>>