lgraph_rpc_client
-
namespace fma_common
-
namespace lgraph_rpc
-
namespace lgraph
-
class RpcClient
- #include <lgraph_rpc_client.h>
Public Functions
-
RpcClient(const std::string &url, const std::string &user, const std::string &password)
RpcClient Login.
- 参数
url – Login address.
user – The username.
password – The password.
-
~RpcClient()
-
int64_t Restore(const std::vector<BackupLogEntry> &requests)
-
bool LoadProcedure(std::string &result, const std::string &source_file, const std::string &procedure_type, const std::string &procedure_name, const std::string &code_type, const std::string &procedure_description, bool read_only, const std::string &graph = "default")
Load a user-defined procedure
- 参数
result – [out] The result.
source_file – [in] the source_file contain procedure code.
procedure_type – [in] the procedure type, currently supported CPP and PY.
procedure_name – [in] procedure name.
code_type – [in] code type, currently supported PY, SO, CPP, ZIP.
procedure_description – [in] procedure description.
read_only – [in] procedure is read only or not.
graph – [in] (Optional) the graph to query.
- 返回
True if it succeeds, false if it fails.
-
bool CallProcedure(std::string &result, const std::string &procedure_type, const std::string &procedure_name, const std::string ¶m, double procedure_time_out = 0.0, bool in_process = false, const std::string &graph = "default", bool json_format = true)
Execute a user-defined procedure
- 参数
result – [out] The result.
procedure_type – [in] the procedure type, currently supported CPP and PY.
procedure_name – [in] procedure name.
param – [in] the execution parameters.
procedure_time_out – [in] (Optional) Maximum execution time, overruns will be interrupted.
in_process – [in] (Optional) support in future.
graph – [in] (Optional) the graph to query.
json_format – [in] (Optional) Returns the format, true is json, Otherwise, binary format.
- 返回
True if it succeeds, false if it fails.
-
bool ListProcedures(std::string &result, const std::string &procedure_type, const std::string &graph = "default")
List user-defined procedures
- 参数
result – [out] The result.
procedure_type – [in] (Optional) the procedure type, “” for all procedures, CPP and PY for special type.
graph – [in] (Optional) the graph to query.
- 返回
True if it succeeds, false if it fails.
-
bool DeleteProcedure(std::string &result, const std::string &procedure_type, const std::string &procedure_name, const std::string &graph = "default")
Execute a user-defined procedure
- 参数
result – [out] The result.
procedure_type – [in] the procedure type, currently supported CPP and PY.
procedure_name – [in] procedure name.
graph – [in] (Optional) the graph to query.
- 返回
True if it succeeds, false if it fails.
-
bool ImportSchemaFromFile(std::string &result, const std::string &schema_file, const std::string &graph = "default", bool json_format = true, double timeout = 0)
Import vertex or edge schema from file
- 参数
result – [out] The result.
schema_file – [in] the schema_file contain schema.
graph – [in] (Optional) the graph to query.
json_format – [in] (Optional) Returns the format, true is json,Otherwise, binary format.
timeout – [in] (Optional) Maximum execution time, overruns will be interrupted.
- 返回
True if it succeeds, false if it fails.
-
bool ImportDataFromFile(std::string &result, const std::string &conf_file, const std::string &delimiter, bool continue_on_error = false, int thread_nums = 8, int skip_packages = 0, const std::string &graph = "default", bool json_format = true, double timeout = 0)
Import vertex or edge data from file
- 参数
result – [out] The result.
conf_file – [in] data file contain format description and data.
delimiter – [in] data separator.
continue_on_error – [in] (Optional) whether to continue when importing data fails.
thread_nums – [in] (Optional) maximum number of threads.
skip_packages – [in] (Optional) skip packages number.
graph – [in] (Optional) the graph to query.
json_format – [in] (Optional) Returns the format, true is json,Otherwise, binary format.
timeout – [in] (Optional) Maximum execution time, overruns will be interrupted.
- 返回
True if it succeeds, false if it fails.
-
bool ImportSchemaFromContent(std::string &result, const std::string &schema, const std::string &graph = "default", bool json_format = true, double timeout = 0)
Import vertex or edge schema from content string
- 参数
result – [out] The result.
schema – [in] the schema to be imported.
graph – [in] (Optional) the graph to query.
json_format – [in] (Optional) Returns the format, true is json,Otherwise, binary format.
timeout – [in] (Optional) Maximum execution time, overruns will be interrupted.
- 返回
True if it succeeds, false if it fails.
-
bool ImportDataFromContent(std::string &result, const std::string &desc, const std::string &data, const std::string &delimiter, bool continue_on_error = false, int thread_nums = 8, const std::string &graph = "default", bool json_format = true, double timeout = 0)
Import vertex or edge data from content string
- 参数
result – [out] The result.
desc – [in] data format description.
data – [in] the data to be imported.
delimiter – [in] data separator.
continue_on_error – [in] (Optional) whether to continue when importing data fails.
thread_nums – [in] (Optional) maximum number of threads.
graph – [in] (Optional) the graph to query.
json_format – [in] (Optional) Returns the format, true is json,Otherwise, binary format.
timeout – [in] (Optional) Maximum execution time, overruns will be interrupted.
- 返回
True if it succeeds, false if it fails.
-
bool CallCypher(std::string &result, const std::string &cypher, const std::string &graph = "default", bool json_format = true, double timeout = 0)
Execute a cypher query
- 参数
result – [out] The result.
cypher – [in] inquire statement.
graph – [in] (Optional) the graph to query.
json_format – [in] (Optional) Returns the format, true is json,Otherwise, binary format.
timeout – [in] (Optional) Maximum execution time, overruns will be interrupted.
- 返回
True if it succeeds, false if it fails.
-
std::string GetUrl()
Get the url of client.
- 返回
the url of client.
-
void Logout()
Private Functions
-
LGraphResponse HandleRequest(LGraphRequest *req)
-
bool HandleCypherRequest(LGraphResponse *res, const std::string &query, const std::string &graph, bool json_format, double timeout)
-
std::string CypherResponseExtractor(CypherResponse cypher)
Private Members
-
std::string url
-
std::string user
-
std::string password
-
std::string token
-
int64_t server_version
-
std::shared_ptr<lgraph_rpc::m_channel> channel
-
std::shared_ptr<lgraph_rpc::m_controller> cntl
-
std::shared_ptr<lgraph_rpc::m_channel_options> options
-
fma_common::Logger &logger_
-
RpcClient(const std::string &url, const std::string &user, const std::string &password)
-
class RpcClient