浏览代码

代码调整

erlArango_v1
SisMaker 5 年前
父节点
当前提交
9f2257d9df
共有 32 个文件被更改,包括 322 次插入318 次删除
  1. +2
    -10
      include/agHttpCli.hrl
  2. +6
    -6
      include/erlArango.hrl
  3. +14
    -14
      src/arangoApi/agAdminMonitor.erl
  4. +5
    -5
      src/arangoApi/agAnalyzers.erl
  5. +19
    -19
      src/arangoApi/agAqlMod.erl
  6. +6
    -6
      src/arangoApi/agAsyncResultHandling.erl
  7. +3
    -3
      src/arangoApi/agBulkImportExport.erl
  8. +5
    -5
      src/arangoApi/agCluster.erl
  9. +30
    -30
      src/arangoApi/agCollections.erl
  10. +5
    -5
      src/arangoApi/agDbMgr.erl
  11. +21
    -21
      src/arangoApi/agDocuments.erl
  12. +1
    -1
      src/arangoApi/agEdges.erl
  13. +1
    -1
      src/arangoApi/agEndPoints.erl
  14. +23
    -23
      src/arangoApi/agFoxxServices.erl
  15. +36
    -36
      src/arangoApi/agGeneralGraphs.erl
  16. +6
    -6
      src/arangoApi/agHotBackup.erl
  17. +10
    -10
      src/arangoApi/agIndexes.erl
  18. +13
    -13
      src/arangoApi/agMiscFun.erl
  19. +2
    -2
      src/arangoApi/agRepairJobs.erl
  20. +30
    -30
      src/arangoApi/agReplication.erl
  21. +5
    -5
      src/arangoApi/agTasks.erl
  22. +6
    -6
      src/arangoApi/agTransactions.erl
  23. +13
    -13
      src/arangoApi/agUserMgr.erl
  24. +8
    -8
      src/arangoApi/agViews.erl
  25. +0
    -1
      src/httpCli/agAgencyPoolMgrIns.erl
  26. +2
    -2
      src/httpCli/agAgencyUtils.erl
  27. +15
    -12
      src/httpCli/agHttpCli.erl
  28. +4
    -6
      src/httpCli/agHttpProtocol.erl
  29. +14
    -1
      src/httpCli/agMiscUtils.erl
  30. +7
    -8
      src/httpCli/agSslAgencyIns.erl
  31. +7
    -9
      src/httpCli/agTcpAgencyIns.erl
  32. +3
    -1
      src/user_default.erl

+ 2
- 10
include/agHttpCli.hrl 查看文件

@ -36,18 +36,11 @@
, isSystem = false :: boolean() , isSystem = false :: boolean()
}). }).
-record(miAgHttpCliRet, {
-record(miRequestRet, {
requestId :: requestId(), requestId :: requestId(),
reply :: term() reply :: term()
}). }).
-record(requestRet, {
statusCode :: undefined | 100..505,
contentLength :: undefined | non_neg_integer() | chunked,
headers :: undefined | [binary()],
body :: undefined | binary()
}).
-record(recvState, { -record(recvState, {
stage = header :: header | body | done, %% tcp可能会有多个包 stage = header :: header | body | done, %% tcp可能会有多个包
contentLength :: undefined | non_neg_integer() | chunked, contentLength :: undefined | non_neg_integer() | chunked,
@ -107,8 +100,7 @@
}). }).
-type miRequest() :: #miRequest{}. -type miRequest() :: #miRequest{}.
-type miAgHttpCliRet() :: #miAgHttpCliRet{}.
-type requestRet() :: #requestRet{}.
-type miRequestRet() :: #miRequestRet{}.
-type recvState() :: #recvState{}. -type recvState() :: #recvState{}.
-type srvState() :: #srvState{}. -type srvState() :: #srvState{}.
-type cliState() :: #cliState{}. -type cliState() :: #cliState{}.

+ 6
- 6
include/erlArango.hrl 查看文件

@ -1,6 +1,6 @@
-define(Get, <<"GET">>).
-define(Put, <<"PUT">>).
-define(Post, <<"POST">>).
-define(Head, <<"HEAD">>).
-define(Patch, <<"PATCH">>).
-define(Delete, <<"DELETE">>).
-define(AgGet, <<"GET ">>).
-define(AgPut, <<"PUT ">>).
-define(AgPost, <<"POST ">>).
-define(AgHead, <<"HEAD ">>).
-define(AgPatch, <<"PATCH ">>).
-define(AgDelete, <<"DELETE ">>).

+ 14
- 14
src/arangoApi/agAdminMonitor.erl 查看文件

@ -31,12 +31,12 @@
% 400up或level指定了无效值 % 400up或level指定了无效值
% 500 % 500
getAdminLog(PoolNameOrSocket) -> getAdminLog(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/log">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/log">>, [], undefined).
getAdminLog(PoolNameOrSocket, QueryPars) -> getAdminLog(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_admin/log", QueryBinary/binary>>, Path = <<"/_admin/log", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% GET /_admin/log/level % GET /_admin/log/level
@ -45,7 +45,7 @@ getAdminLog(PoolNameOrSocket, QueryPars) ->
% 200 % 200
% 500 % 500
getAdminLogLevel(PoolNameOrSocket) -> getAdminLogLevel(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/log/level">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/log/level">>, [], undefined).
% %
% PUT /_admin/log/level % PUT /_admin/log/level
@ -107,7 +107,7 @@ getAdminLogLevel(PoolNameOrSocket) ->
% 500 % 500
modifyAdminLogLevel(PoolNameOrSocket, MapData) -> modifyAdminLogLevel(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_admin/log/level">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/log/level">>, [], BodyStr).
% %
% GET /_admin/statistics % GET /_admin/statistics
@ -177,7 +177,7 @@ modifyAdminLogLevel(PoolNameOrSocket, MapData) ->
% 线 % 线
% 线 % 线
getAdminStatistics(PoolNameOrSocket) -> getAdminStatistics(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/statistics">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/statistics">>, [], undefined).
% %
% %
@ -211,7 +211,7 @@ getAdminStatistics(PoolNameOrSocket) ->
% codeHTTP状态码 % codeHTTP状态码
% false % false
getAdminStatisticsDesc(PoolNameOrSocket) -> getAdminStatisticsDesc(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/statistics-description">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/statistics-description">>, [], undefined).
% %
% GET /_admin/metrics % GET /_admin/metrics
@ -222,7 +222,7 @@ getAdminStatisticsDesc(PoolNameOrSocket) ->
% 200 % 200
% 404使--server.export-metrics-api false API API % 404使--server.export-metrics-api false API API
getAdminMetrics(PoolNameOrSocket) -> getAdminMetrics(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/metrics">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/metrics">>, [], undefined).
% %
@ -234,7 +234,7 @@ getAdminMetrics(PoolNameOrSocket) ->
% %
% 200API将返回HTTP 200 % 200API将返回HTTP 200
getAdminServerMode(PoolNameOrSocket) -> getAdminServerMode(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/server/mode">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/mode">>, [], undefined).
% ID % ID
% ID % ID
@ -244,7 +244,7 @@ getAdminServerMode(PoolNameOrSocket) ->
% 200 % 200
% 500 % 500
getAdminServerId(PoolNameOrSocket) -> getAdminServerId(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/server/id">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/id">>, [], undefined).
% %
% GET /_admin/server/role % GET /_admin/server/role
@ -261,7 +261,7 @@ getAdminServerId(PoolNameOrSocket) ->
% errorNum % errorNum
% [ SINGLEPRIMARYSECONDARYAGENTUNDEFINED ] % [ SINGLEPRIMARYSECONDARYAGENTUNDEFINED ]
getAdminServerRole(PoolNameOrSocket) -> getAdminServerRole(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/server/role">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/role">>, [], undefined).
% %
@ -272,7 +272,7 @@ getAdminServerRole(PoolNameOrSocket) ->
% 200API将返回HTTP 200 % 200API将返回HTTP 200
% 503HTTP 503 % 503HTTP 503
getAdminServerAvailability(PoolNameOrSocket) -> getAdminServerAvailability(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/server/availability">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/availability">>, [], undefined).
% DBserver % DBserver
% %
@ -285,7 +285,7 @@ getAdminServerAvailability(PoolNameOrSocket) ->
% 403 % 403
getAdminClusterStatistics(PoolNameOrSocket, DBserver) -> getAdminClusterStatistics(PoolNameOrSocket, DBserver) ->
Path = <<"/_admin/clusterStatistics?DBserver=", (agMiscUtils:toBinary(DBserver))/binary>>, Path = <<"/_admin/clusterStatistics?DBserver=", (agMiscUtils:toBinary(DBserver))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% Permalink % Permalink
% %
@ -316,7 +316,7 @@ getAdminClusterStatistics(PoolNameOrSocket, DBserver) ->
% %
% 200 % 200
getAdminClusterHealth(PoolNameOrSocket) -> getAdminClusterHealth(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/cluster/health">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/cluster/health">>, [], undefined).
% %
% POST /_admin/routing/reload % POST /_admin/routing/reload
@ -324,4 +324,4 @@ getAdminClusterHealth(PoolNameOrSocket) ->
% %
% 200 % 200
reloadAdminRouting(PoolNameOrSocket) -> reloadAdminRouting(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/routing/reload">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/routing/reload">>, [], undefined).

+ 5
- 5
src/arangoApi/agAnalyzers.erl 查看文件

@ -25,7 +25,7 @@
% 403使 % 403使
newAnalyzer(PoolNameOrSocket, MapData) -> newAnalyzer(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/analyzer">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/analyzer">>, [], BodyStr).
% %
% GET /_api/analyzer/{analyzer-name} % GET /_api/analyzer/{analyzer-name}
@ -41,7 +41,7 @@ newAnalyzer(PoolNameOrSocket, MapData) ->
% 404 % 404
getAnalyzer(PoolNameOrSocket, AnalyzerName) -> getAnalyzer(PoolNameOrSocket, AnalyzerName) ->
Path = <<"/_api/analyzer/", AnalyzerName/binary>>, Path = <<"/_api/analyzer/", AnalyzerName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% GET /_api/analyzer % GET /_api/analyzer
@ -53,7 +53,7 @@ getAnalyzer(PoolNameOrSocket, AnalyzerName) ->
% %
% 200 % 200
getAnalyzerList(PoolNameOrSocket) -> getAnalyzerList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/analyzer">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/analyzer">>, [], undefined).
% %
% DELETE /_api/analyzer/{analyzer-name} % DELETE /_api/analyzer/{analyzer-name}
@ -74,7 +74,7 @@ getAnalyzerList(PoolNameOrSocket) ->
delAnalyzer(PoolNameOrSocket, AnalyzerName) -> delAnalyzer(PoolNameOrSocket, AnalyzerName) ->
Path = <<"/_api/analyzer/", AnalyzerName/binary>>, Path = <<"/_api/analyzer/", AnalyzerName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delAnalyzer(PoolNameOrSocket, AnalyzerName, IsForce) -> delAnalyzer(PoolNameOrSocket, AnalyzerName, IsForce) ->
Path = Path =
@ -84,4 +84,4 @@ delAnalyzer(PoolNameOrSocket, AnalyzerName, IsForce) ->
_ -> _ ->
<<"/_api/analyzer/", AnalyzerName/binary>> <<"/_api/analyzer/", AnalyzerName/binary>>
end, end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).

+ 19
- 19
src/arangoApi/agAqlMod.erl 查看文件

@ -69,7 +69,7 @@
% 405使HTTP方法HTTP 405 % 405使HTTP方法HTTP 405
newAqlCursor(PoolNameOrSocket, MapData) -> newAqlCursor(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/cursor">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/cursor">>, [], BodyStr).
% %
@ -88,7 +88,7 @@ newAqlCursor(PoolNameOrSocket, MapData) ->
% 404使HTTP 404 % 404使HTTP 404
nextAqlCursor(PoolNameOrSocket, CursorId) -> nextAqlCursor(PoolNameOrSocket, CursorId) ->
Path = <<"/_api/cursor/", (agMiscUtils:toBinary(CursorId))/binary>>, Path = <<"/_api/cursor/", (agMiscUtils:toBinary(CursorId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
% DELETE /_api/cursor/{cursor-identifier} % DELETE /_api/cursor/{cursor-identifier}
@ -102,7 +102,7 @@ nextAqlCursor(PoolNameOrSocket, CursorId) ->
% 404404使 % 404404使
delAqlCursor(PoolNameOrSocket, CursorId) -> delAqlCursor(PoolNameOrSocket, CursorId) ->
Path = <<"/_api/cursor/", (agMiscUtils:toBinary(CursorId))/binary>>, Path = <<"/_api/cursor/", (agMiscUtils:toBinary(CursorId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL查询的HTTP接口 % AQL查询的HTTP接口
% %
@ -137,7 +137,7 @@ delAqlCursor(PoolNameOrSocket, CursorId) ->
% 404访HTTP 404 % 404访HTTP 404
explainAqlQuery(PoolNameOrSocket, MapData) -> explainAqlQuery(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/explain">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/explain">>, [], BodyStr).
% AQL查询并返回有关它的信息 % AQL查询并返回有关它的信息
@ -150,7 +150,7 @@ explainAqlQuery(PoolNameOrSocket, MapData) ->
% 400HTTP 400JSON对象中的错误详细信息 % 400HTTP 400JSON对象中的错误详细信息
parseAqlQuery(PoolNameOrSocket, MapData) -> parseAqlQuery(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/query">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/query">>, [], BodyStr).
% %
% ArangoDB具有HTTP接口AQL查询列表和慢速AQL查询列表使APIHTTP请求的数据库中启用查询跟踪 % ArangoDB具有HTTP接口AQL查询列表和慢速AQL查询列表使APIHTTP请求的数据库中启用查询跟踪
@ -168,7 +168,7 @@ parseAqlQuery(PoolNameOrSocket, MapData) ->
% 200 % 200
% 400HTTP 400 % 400HTTP 400
getAqlQueryProperties(PoolNameOrSocket) -> getAqlQueryProperties(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/query/properties">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/query/properties">>, [], undefined).
% AQL查询跟踪的配置 % AQL查询跟踪的配置
@ -187,7 +187,7 @@ getAqlQueryProperties(PoolNameOrSocket) ->
% 400HTTP 400 % 400HTTP 400
changeAqlQueryProperties(PoolNameOrSocket, MapData) -> changeAqlQueryProperties(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/query/properties">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/query/properties">>, [], BodyStr).
% AQL查询的列表 % AQL查询的列表
@ -204,7 +204,7 @@ changeAqlQueryProperties(PoolNameOrSocket, MapData) ->
% 200 % 200
% 400HTTP 400 % 400HTTP 400
getAqlQueryCurrent(PoolNameOrSocket) -> getAqlQueryCurrent(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/query/current">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query/current">>, [], undefined).
% AQL查询的列表 % AQL查询的列表
@ -222,7 +222,7 @@ getAqlQueryCurrent(PoolNameOrSocket) ->
% 200 % 200
% 400HTTP 400 % 400HTTP 400
getAqlQuerySlow(PoolNameOrSocket) -> getAqlQuerySlow(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/query/slow">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query/slow">>, [], undefined).
% AQL查询列表 % AQL查询列表
@ -232,7 +232,7 @@ getAqlQuerySlow(PoolNameOrSocket) ->
% 200HTTP 200 % 200HTTP 200
% 400使HTTP 400 % 400使HTTP 400
delAqlQuerySlow(PoolNameOrSocket) -> delAqlQuerySlow(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, <<"/_api/query/slow">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_api/query/slow">>, [], undefined).
% AQL查询 % AQL查询
@ -246,7 +246,7 @@ delAqlQuerySlow(PoolNameOrSocket) ->
% 404ID的查询时HTTP 404 % 404ID的查询时HTTP 404
killAqlQuery(PoolNameOrSocket, QueryId) -> killAqlQuery(PoolNameOrSocket, QueryId) ->
Path = <<"/_api/query/", (agMiscUtils:toBinary(QueryId))/binary>>, Path = <<"/_api/query/", (agMiscUtils:toBinary(QueryId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL查询结果缓存的HTTP接口 % AQL查询结果缓存的HTTP接口
% AQL查询结果缓存的API方法 % AQL查询结果缓存的API方法
@ -268,7 +268,7 @@ killAqlQuery(PoolNameOrSocket, QueryId) ->
% 200 % 200
% 400HTTP 400 % 400HTTP 400
getAqlQueryCaches(PoolNameOrSocket) -> getAqlQueryCaches(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/query-cache/entries">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/entries">>, [], undefined).
% AQL查询结果缓存 % AQL查询结果缓存
@ -278,7 +278,7 @@ getAqlQueryCaches(PoolNameOrSocket) ->
% 200HTTP 200 % 200HTTP 200
% 400使HTTP 400 % 400使HTTP 400
clearAqlQueryCaches(PoolNameOrSocket) -> clearAqlQueryCaches(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, <<"/_api/query-cache">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_api/query-cache">>, [], undefined).
% AQL查询结果缓存的全局配置 % AQL查询结果缓存的全局配置
@ -293,7 +293,7 @@ clearAqlQueryCaches(PoolNameOrSocket) ->
% 200 % 200
% 400HTTP 400 % 400HTTP 400
getAqlQueryCacheProperties(PoolNameOrSocket) -> getAqlQueryCacheProperties(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/query-cache/properties">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/properties">>, [], undefined).
% AQL查询结果缓存的配置 % AQL查询结果缓存的配置
@ -311,7 +311,7 @@ getAqlQueryCacheProperties(PoolNameOrSocket) ->
% 400HTTP 400 % 400HTTP 400
changeAqlQueryCacheProperties(PoolNameOrSocket, MapData) -> changeAqlQueryCacheProperties(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/query-cache/properties">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/properties">>, [], BodyStr).
% AQL用户功能管理的HTTP接口 % AQL用户功能管理的HTTP接口
% AQL用户功能管理 % AQL用户功能管理
@ -346,7 +346,7 @@ changeAqlQueryCacheProperties(PoolNameOrSocket, MapData) ->
% errorMessage % errorMessage
newAqlUserFun(PoolNameOrSocket, MapData) -> newAqlUserFun(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/aqlfunction">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/aqlfunction">>, [], BodyStr).
% AQL用户功能 % AQL用户功能
% DELETE /_api/aqlfunction/{name} % DELETE /_api/aqlfunction/{name}
@ -372,7 +372,7 @@ newAqlUserFun(PoolNameOrSocket, MapData) ->
% errorMessage % errorMessage
delAqlUserFun(PoolNameOrSocket, UserFunName) -> delAqlUserFun(PoolNameOrSocket, UserFunName) ->
Path = <<"/_api/aqlfunction/", (agMiscUtils:toBinary(UserFunName))/binary>>, Path = <<"/_api/aqlfunction/", (agMiscUtils:toBinary(UserFunName))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL用户功能 % AQL用户功能
@ -394,11 +394,11 @@ delAqlUserFun(PoolNameOrSocket, UserFunName) ->
% errorNum % errorNum
% errorMessage % errorMessage
getAqlUserFuns(PoolNameOrSocket) -> getAqlUserFuns(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/aqlfunction">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/aqlfunction">>, [], undefined).
getAqlUserFuns(PoolNameOrSocket, Namespace) -> getAqlUserFuns(PoolNameOrSocket, Namespace) ->
Path = <<"/_api/aqlfunction?namespace=", (agMiscUtils:toBinary(Namespace))/binary>>, Path = <<"/_api/aqlfunction?namespace=", (agMiscUtils:toBinary(Namespace))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).

+ 6
- 6
src/arangoApi/agAsyncResultHandling.erl 查看文件

@ -48,7 +48,7 @@
% 404404x-arango-async-id HTTP标头 % 404404x-arango-async-id HTTP标头
getAsyncJobRet(PoolNameOrSocket, JodId) -> getAsyncJobRet(PoolNameOrSocket, JodId) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>, Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
@ -62,7 +62,7 @@ getAsyncJobRet(PoolNameOrSocket, JodId) ->
% 404404x-arango-async-id HTTP标头 % 404404x-arango-async-id HTTP标头
cancelAsyncJob(PoolNameOrSocket, JodId) -> cancelAsyncJob(PoolNameOrSocket, JodId) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary, "/cancel">>, Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary, "/cancel">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
% DELETE /_api/job/{type}#by-type % DELETE /_api/job/{type}#by-type
@ -86,7 +86,7 @@ delAsyncJobRet(PoolNameOrSocket, TypeOrJodId, Stamp) ->
_ -> _ ->
<<"/_api/job/", (agMiscUtils:toBinary(TypeOrJodId))/binary>> <<"/_api/job/", (agMiscUtils:toBinary(TypeOrJodId))/binary>>
end, end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% %
@ -100,7 +100,7 @@ delAsyncJobRet(PoolNameOrSocket, TypeOrJodId, Stamp) ->
% 404404 % 404404
getAsyncJobStatus(PoolNameOrSocket, JodId) -> getAsyncJobStatus(PoolNameOrSocket, JodId) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>, Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% ID % ID
@ -115,9 +115,9 @@ getAsyncJobStatus(PoolNameOrSocket, JodId) ->
% 400type或值无效 % 400type或值无效
getAsyncJobList(PoolNameOrSocket, Type) -> getAsyncJobList(PoolNameOrSocket, Type) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary>>, Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
getAsyncJobList(PoolNameOrSocket, Type, Count) -> getAsyncJobList(PoolNameOrSocket, Type, Count) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary, "?count=", (agMiscUtils:toBinary(Count))/binary>>, Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary, "?count=", (agMiscUtils:toBinary(Count))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).

+ 3
- 3
src/arangoApi/agBulkImportExport.erl 查看文件

@ -54,7 +54,7 @@ importFormDocument(PoolNameOrSocket, ListOfList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/import", QueryBinary/binary>>, Path = <<"/_api/import", QueryBinary/binary>>,
BodyStr = jiffy:encode(ListOfList), BodyStr = jiffy:encode(ListOfList),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% JSON % JSON
@ -96,7 +96,7 @@ importFormJson(PoolNameOrSocket, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/import", QueryBinary/binary>>, Path = <<"/_api/import", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapDataList), BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% HTTP接口 % HTTP接口
% HTTP请求中向ArangoDB发送单独的操作 % HTTP请求中向ArangoDB发送单独的操作
@ -159,4 +159,4 @@ importFormJson(PoolNameOrSocket, MapDataList, QueryPars) ->
exportDocuments(PoolNameOrSocket, CollName, MapData) -> exportDocuments(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/export?collection=", CollName/binary>>, Path = <<"/_api/export?collection=", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).

+ 5
- 5
src/arangoApi/agCluster.erl 查看文件

@ -23,7 +23,7 @@
% 200 % 200
% 500 % 500
getServerId(PoolNameOrSocket) -> getServerId(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/server/id">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/id">>, [], undefined).
% %
%GET /_admin/server/role %GET /_admin/server/role
@ -40,7 +40,7 @@ getServerId(PoolNameOrSocket) ->
%errorNum %errorNum
%[ SINGLEPRIMARYSECONDARYAGENTUNDEFINED ] %[ SINGLEPRIMARYSECONDARYAGENTUNDEFINED ]
getServerRole(PoolNameOrSocket) -> getServerRole(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/server/role">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/role">>, [], undefined).
% DBserver查询统计 % DBserver查询统计
% %
@ -52,7 +52,7 @@ getServerRole(PoolNameOrSocket) ->
% 400ID % 400ID
% 403 % 403
getClusterStatistics(PoolNameOrSocket) -> getClusterStatistics(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/clusterStatistics">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/clusterStatistics">>, [], undefined).
% %
% %
@ -82,7 +82,7 @@ getClusterStatistics(PoolNameOrSocket) ->
% LastAckedTimeacked以秒为单位 % LastAckedTimeacked以秒为单位
% 200 % 200
getClusterHealth(PoolNameOrSocket) -> getClusterHealth(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/cluster/health">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/cluster/health">>, [], undefined).
% %
% %
@ -95,7 +95,7 @@ getClusterHealth(PoolNameOrSocket) ->
% 501 % 501
% 504 % 504
setClusterMaintenance(PoolNameOrSocket, OnOrOff) -> setClusterMaintenance(PoolNameOrSocket, OnOrOff) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_admin/cluster/maintenance">>, [], OnOrOff).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/cluster/maintenance">>, [], OnOrOff).

+ 30
- 30
src/arangoApi/agCollections.erl 查看文件

@ -75,34 +75,34 @@
% 404HTTP 404 % 404HTTP 404
newColl(PoolNameOrSocket, MapData) -> newColl(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/collection">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/collection">>, [], BodyStr).
newColl(PoolNameOrSocket, MapData, WaitForSyncReplication, ForceReplicationFactor) -> newColl(PoolNameOrSocket, MapData, WaitForSyncReplication, ForceReplicationFactor) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
Path = <<"/_api/collection?waitForSyncReplication=", (agMiscUtils:toBinary(WaitForSyncReplication))/binary, "&forceReplicationFactor=", (agMiscUtils:toBinary(ForceReplicationFactor))/binary>>, Path = <<"/_api/collection?waitForSyncReplication=", (agMiscUtils:toBinary(WaitForSyncReplication))/binary, "&forceReplicationFactor=", (agMiscUtils:toBinary(ForceReplicationFactor))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
% DELETE /_api/collection/{collection-name} % DELETE /_api/collection/{collection-name}
delColl(PoolNameOrSocket, CollName) -> delColl(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary>>, Path = <<"/_api/collection/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delColl(PoolNameOrSocket, CollName, IsSystem) -> delColl(PoolNameOrSocket, CollName, IsSystem) ->
case IsSystem of case IsSystem of
true -> true ->
Path = <<"/_api/collection/", CollName/binary, "?isSystem=true">>, Path = <<"/_api/collection/", CollName/binary, "?isSystem=true">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined);
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined);
_ -> _ ->
Path = <<"/_api/collection/", CollName/binary>>, Path = <<"/_api/collection/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined)
end. end.
% %
% PUT /_api/collection/{collection-name}/truncate % PUT /_api/collection/{collection-name}/truncate
clearColl(PoolNameOrSocket, CollName) -> clearColl(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/truncate">>, Path = <<"/_api/collection/", CollName/binary, "/truncate">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
% GET /_api/collection/{collection-name} % GET /_api/collection/{collection-name}
@ -126,13 +126,13 @@ clearColl(PoolNameOrSocket, CollName) ->
% 404HTTP 404 % 404HTTP 404
collInfo(PoolNameOrSocket, CollName) -> collInfo(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary>>, Path = <<"/_api/collection/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% GET /_api/collection/{collection-name}/properties % GET /_api/collection/{collection-name}/properties
collProperties(PoolNameOrSocket, CollName) -> collProperties(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", (CollName)/binary, "/properties">>, Path = <<"/_api/collection/", (CollName)/binary, "/properties">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% %
@ -140,7 +140,7 @@ collProperties(PoolNameOrSocket, CollName) ->
% GET /_api/collection/{collection-name}/count % GET /_api/collection/{collection-name}/count
collCount(PoolNameOrSocket, CollName) -> collCount(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/count">>, Path = <<"/_api/collection/", CollName/binary, "/count">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% GET /_api/collection/{collection-name}/figures % GET /_api/collection/{collection-name}/figures
@ -154,7 +154,7 @@ collCount(PoolNameOrSocket, CollName) ->
% fileSize值的总和用作磁盘使用率的下限近似值 % fileSize值的总和用作磁盘使用率的下限近似值
collFigures(PoolNameOrSocket, CollName) -> collFigures(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/figures">>, Path = <<"/_api/collection/", CollName/binary, "/figures">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% PUT /_api/collection/{collection-name}/responsibleShard % PUT /_api/collection/{collection-name}/responsibleShard
@ -171,7 +171,7 @@ collFigures(PoolNameOrSocket, CollName) ->
collResponsibleShard(PoolNameOrSocket, CollName, MapData) -> collResponsibleShard(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/collection/", CollName/binary, "/responsibleShard">>, Path = <<"/_api/collection/", CollName/binary, "/responsibleShard">>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], BodyStr).
% ID % ID
% ID % ID
@ -183,16 +183,16 @@ collResponsibleShard(PoolNameOrSocket, CollName, MapData) ->
% details (optional)true % details (optional)true
collShards(PoolNameOrSocket, CollName) -> collShards(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/shards">>, Path = <<"/_api/collection/", CollName/binary, "/shards">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
collShards(PoolNameOrSocket, CollName, IsDetails) -> collShards(PoolNameOrSocket, CollName, IsDetails) ->
case IsDetails of case IsDetails of
true -> true ->
Path = <<"/_api/collection/", CollName/binary, "/shards?details=true">>, Path = <<"/_api/collection/", CollName/binary, "/shards?details=true">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined);
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined);
_ -> _ ->
Path = <<"/_api/collection/", CollName/binary, "/shards">>, Path = <<"/_api/collection/", CollName/binary, "/shards">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined)
end. end.
% ID % ID
@ -201,7 +201,7 @@ collShards(PoolNameOrSocket, CollName, IsDetails) ->
% GET /_api/collection/{collection-name}/revision % GET /_api/collection/{collection-name}/revision
collRevision(PoolNameOrSocket, CollName) -> collRevision(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/revision">>, Path = <<"/_api/collection/", CollName/binary, "/revision">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% %
@ -220,17 +220,17 @@ collRevision(PoolNameOrSocket, CollName) ->
% GET /_api/collection/{collection-name}/checksum % GET /_api/collection/{collection-name}/checksum
collChecksum(PoolNameOrSocket, CollName) -> collChecksum(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/checksum">>, Path = <<"/_api/collection/", CollName/binary, "/checksum">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
collChecksum(PoolNameOrSocket, CollName, IsWithRevisions, IsWithData) -> collChecksum(PoolNameOrSocket, CollName, IsWithRevisions, IsWithData) ->
case IsWithRevisions orelse IsWithData of case IsWithRevisions orelse IsWithData of
false -> false ->
Path = <<"/_api/collection/", CollName/binary, "/checksum">>, Path = <<"/_api/collection/", CollName/binary, "/checksum">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined);
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined);
_ -> _ ->
Path = <<"/_api/collection/", CollName/binary, "/checksum?withRevisions=", (agMiscUtils:toBinary(IsWithRevisions, utf8))/binary, "&withData=", (erlang:atom_to_binary(IsWithRevisions, utf8))/binary>>, Path = <<"/_api/collection/", CollName/binary, "/checksum?withRevisions=", (agMiscUtils:toBinary(IsWithRevisions, utf8))/binary, "&withData=", (erlang:atom_to_binary(IsWithRevisions, utf8))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined)
end. end.
% %
@ -238,15 +238,15 @@ collChecksum(PoolNameOrSocket, CollName, IsWithRevisions, IsWithData) ->
% excludeSystem % excludeSystem
% GET /_api/collection % GET /_api/collection
collList(PoolNameOrSocket) -> collList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/collection">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/collection">>, [], undefined).
collList(PoolNameOrSocket, IsExcludeSystem) -> collList(PoolNameOrSocket, IsExcludeSystem) ->
case IsExcludeSystem of case IsExcludeSystem of
false -> false ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/collection">>, [], undefined);
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/collection">>, [], undefined);
_ -> _ ->
Path = <<"/_api/collection/?excludeSystem=true">>, Path = <<"/_api/collection/?excludeSystem=true">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined)
end. end.
% %
@ -255,17 +255,17 @@ collList(PoolNameOrSocket, IsExcludeSystem) ->
% PUT /_api/collection/{collection-name}/load % PUT /_api/collection/{collection-name}/load
collLoad(PoolNameOrSocket, CollName) -> collLoad(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/load">>, Path = <<"/_api/collection/", CollName/binary, "/load">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
collLoad(PoolNameOrSocket, CollName, IsCount) -> collLoad(PoolNameOrSocket, CollName, IsCount) ->
case IsCount of case IsCount of
false -> false ->
Path = <<"/_api/collection/", CollName/binary, "/load">>, Path = <<"/_api/collection/", CollName/binary, "/load">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], <<"{\"count\":false}">>);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], <<"{\"count\":false}">>);
_ -> _ ->
Path = <<"/_api/collection/", CollName/binary, "/load">>, Path = <<"/_api/collection/", CollName/binary, "/load">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined)
end. end.
% %
@ -282,7 +282,7 @@ collLoad(PoolNameOrSocket, CollName, IsCount) ->
collUnload(PoolNameOrSocket, CollName) -> collUnload(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/unload">>, Path = <<"/_api/collection/", CollName/binary, "/unload">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
% PUT /_api/collection/{collection-name}/loadIndexesIntoMemory % PUT /_api/collection/{collection-name}/loadIndexesIntoMemory
@ -298,7 +298,7 @@ collUnload(PoolNameOrSocket, CollName) ->
collLoadIndexesIntoMemory(PoolNameOrSocket, CollName) -> collLoadIndexesIntoMemory(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/loadIndexesIntoMemory">>, Path = <<"/_api/collection/", CollName/binary, "/loadIndexesIntoMemory">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
% PUT /_api/collection/{collection-name}/properties % PUT /_api/collection/{collection-name}/properties
@ -327,7 +327,7 @@ collLoadIndexesIntoMemory(PoolNameOrSocket, CollName) ->
collChangeProperties(PoolNameOrSocket, CollName, MapData) -> collChangeProperties(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/collection/", CollName/binary, "/properties">>, Path = <<"/_api/collection/", CollName/binary, "/properties">>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% %
% PUT /_api/collection/{collection-name}/rename % PUT /_api/collection/{collection-name}/rename
@ -348,7 +348,7 @@ collChangeProperties(PoolNameOrSocket, CollName, MapData) ->
collRename(PoolNameOrSocket, OldName, NewName) -> collRename(PoolNameOrSocket, OldName, NewName) ->
Path = <<"/_api/collection/", OldName/binary, "/rename">>, Path = <<"/_api/collection/", OldName/binary, "/rename">>,
NameStr = jiffy:encode(NewName), NameStr = jiffy:encode(NewName),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], <<"{\"name\":", NameStr/binary, "}">>).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], <<"{\"name\":", NameStr/binary, "}">>).
% %
% PUT /_api/collection/{collection-name}/rotate % PUT /_api/collection/{collection-name}/rotate
@ -364,7 +364,7 @@ collRename(PoolNameOrSocket, OldName, NewName) ->
% 404HTTP 404 % 404HTTP 404
collRotate(PoolNameOrSocket, CollName) -> collRotate(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/rotate">>, Path = <<"/_api/collection/", CollName/binary, "/rotate">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
@ -377,4 +377,4 @@ collRotate(PoolNameOrSocket, CollName) ->
% RocksDB存储引擎 % RocksDB存储引擎
collRecalculateCount(PoolNameOrSocket, CollName) -> collRecalculateCount(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", CollName/binary, "/recalculateCount">>, Path = <<"/_api/collection/", CollName/binary, "/recalculateCount">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).

+ 5
- 5
src/arangoApi/agDbMgr.erl 查看文件

@ -8,17 +8,17 @@
%% /_api/database/properties %% /_api/database/properties
%% GET /_api/database/current %% GET /_api/database/current
curDbInfo(PoolNameOrSocket) -> curDbInfo(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/database/current">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/database/current">>, [], undefined).
%% 访 %% 访
%% GET /_api/database/user %% GET /_api/database/user
curVisitDbs(PoolNameOrSocket) -> curVisitDbs(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/database/user">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/database/user">>, [], undefined).
%% %%
%% GET /_api/database %% GET /_api/database
curDbList(PoolNameOrSocket) -> curDbList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/database">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/database">>, [], undefined).
%% %%
@ -42,11 +42,11 @@ curDbList(PoolNameOrSocket) ->
newDb(PoolNameOrSocket, MapData) -> newDb(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/database">>, [], BodyStr, true).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/database">>, [], BodyStr, true).
%% %%
%% DELETE /_api/database/{database-name} %% DELETE /_api/database/{database-name}
delDb(PoolNameOrSocket, Name) -> delDb(PoolNameOrSocket, Name) ->
Path = <<"/_api/database/", Name/binary>>, Path = <<"/_api/database/", Name/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined, true).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined, true).

+ 21
- 21
src/arangoApi/agDocuments.erl 查看文件

@ -20,11 +20,11 @@
% 412 If-Match412_rev属性中包含找到的文档的当前修订_id和_key % 412 If-Match412_rev属性中包含找到的文档的当前修订_id和_key
getDocument(PoolNameOrSocket, CollName, Key) -> getDocument(PoolNameOrSocket, CollName, Key) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
getDocument(PoolNameOrSocket, CollName, Key, Headers) -> getDocument(PoolNameOrSocket, CollName, Key, Headers) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, Headers, undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, Headers, undefined).
% %
@ -44,11 +44,11 @@ getDocument(PoolNameOrSocket, CollName, Key, Headers) ->
getDocHead(PoolNameOrSocket, CollName, Key) -> getDocHead(PoolNameOrSocket, CollName, Key) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Head, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgHead, Path, [], undefined).
getDocHead(PoolNameOrSocket, CollName, Key, Headers) -> getDocHead(PoolNameOrSocket, CollName, Key, Headers) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Head, Path, Headers, undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgHead, Path, Headers, undefined).
% %
% POST /_api/document/{collection} % POST /_api/document/{collection}
@ -82,13 +82,13 @@ getDocHead(PoolNameOrSocket, CollName, Key, Headers) ->
newDocument(PoolNameOrSocket, CollName, MapData) -> newDocument(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/document/", CollName/binary>>, Path = <<"/_api/document/", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
newDocument(PoolNameOrSocket, CollName, MapData, QueryPars) -> newDocument(PoolNameOrSocket, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
% PUT /_api/document/{collection}/{key} % PUT /_api/document/{collection}/{key}
@ -126,13 +126,13 @@ newDocument(PoolNameOrSocket, CollName, MapData, QueryPars) ->
replaceDocument(PoolNameOrSocket, CollName, Key, MapData) -> replaceDocument(PoolNameOrSocket, CollName, Key, MapData) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) -> replaceDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, Headers, BodyStr).
% %
% PATCH /_api/document/{collection}/{key} % PATCH /_api/document/{collection}/{key}
@ -173,13 +173,13 @@ replaceDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) ->
updateDocument(PoolNameOrSocket, CollName, Key, MapData) -> updateDocument(PoolNameOrSocket, CollName, Key, MapData) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
updateDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) -> updateDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, Headers, BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, Headers, BodyStr).
% %
% DELETE /_api/document/{collection}/{key} % DELETE /_api/document/{collection}/{key}
@ -203,12 +203,12 @@ updateDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) ->
delDocument(PoolNameOrSocket, CollName, Key) -> delDocument(PoolNameOrSocket, CollName, Key) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delDocument(PoolNameOrSocket, CollName, Key, Headers, QueryPars) -> delDocument(PoolNameOrSocket, CollName, Key, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, Headers, undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, Headers, undefined).
% %
% ArangoDB支持批量处理文档 使API变体可使客户端分摊整批文档中的单个请求的开销ArangoDB % ArangoDB支持批量处理文档 使API变体可使客户端分摊整批文档中的单个请求的开销ArangoDB
@ -236,7 +236,7 @@ getDocuments(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(KeyOrMapDataList), BodyStr = jiffy:encode(KeyOrMapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% %
@ -271,13 +271,13 @@ getDocuments(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) ->
newDocuments(PoolNameOrSocket, CollName, MapDataList) -> newDocuments(PoolNameOrSocket, CollName, MapDataList) ->
Path = <<"/_api/document/", CollName/binary>>, Path = <<"/_api/document/", CollName/binary>>,
BodyStr = jiffy:encode(MapDataList), BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
newDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) -> newDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapDataList), BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
% PUT /_api/document/{collection} % PUT /_api/document/{collection}
@ -308,13 +308,13 @@ newDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
replaceDocuments(PoolNameOrSocket, CollName, MapDataList) -> replaceDocuments(PoolNameOrSocket, CollName, MapDataList) ->
Path = <<"/_api/document/", CollName/binary>>, Path = <<"/_api/document/", CollName/binary>>,
BodyStr = jiffy:encode(MapDataList), BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) -> replaceDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapDataList), BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% %
% PATCH /_api/document/{collection} % PATCH /_api/document/{collection}
@ -348,13 +348,13 @@ replaceDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
updateDocuments(PoolNameOrSocket, CollName, MapDataList) -> updateDocuments(PoolNameOrSocket, CollName, MapDataList) ->
Path = <<"/_api/document/", CollName/binary>>, Path = <<"/_api/document/", CollName/binary>>,
BodyStr = jiffy:encode(MapDataList), BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
updateDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) -> updateDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapDataList), BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
% %
@ -380,10 +380,10 @@ updateDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
delDocuments(PoolNameOrSocket, CollName, KeyOrMapDataList) -> delDocuments(PoolNameOrSocket, CollName, KeyOrMapDataList) ->
Path = <<"/_api/document/", CollName/binary, "/">>, Path = <<"/_api/document/", CollName/binary, "/">>,
BodyStr = jiffy:encode(KeyOrMapDataList), BodyStr = jiffy:encode(KeyOrMapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], BodyStr).
delDocuments(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) -> delDocuments(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(KeyOrMapDataList), BodyStr = jiffy:encode(KeyOrMapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], BodyStr).

+ 1
- 1
src/arangoApi/agEdges.erl 查看文件

@ -23,4 +23,4 @@
getEdges(PoolNameOrSocket, CollName, QueryPars) -> getEdges(PoolNameOrSocket, CollName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/edges/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/edges/", CollName/binary, QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).

+ 1
- 1
src/arangoApi/agEndPoints.erl 查看文件

@ -25,7 +25,7 @@
% tcp://[::1]:8530 % tcp://[::1]:8530
% 501 % 501
getClusterEndpoints(PoolNameOrSocket) -> getClusterEndpoints(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/cluster/endpoints">>, [], undefined, true).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/cluster/endpoints">>, [], undefined, true).
% %
% API调用返回所有端点 % API调用返回所有端点

+ 23
- 23
src/arangoApi/agFoxxServices.erl 查看文件

@ -29,14 +29,14 @@
% %
% 200 % 200
getFoxxList(PoolNameOrSocket) -> getFoxxList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/foxx">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx">>, [], undefined).
getFoxxList(PoolNameOrSocket, ExcludeSystem) -> getFoxxList(PoolNameOrSocket, ExcludeSystem) ->
case ExcludeSystem of case ExcludeSystem of
true -> true ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/foxx?excludeSystem=true">>, [], undefined);
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx?excludeSystem=true">>, [], undefined);
_ -> _ ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/foxx?excludeSystem=false">>, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx?excludeSystem=false">>, [], undefined)
end. end.
% %
@ -58,7 +58,7 @@ getFoxxList(PoolNameOrSocket, ExcludeSystem) ->
% 400 % 400
getFoxxService(PoolNameOrSocket, Mount) -> getFoxxService(PoolNameOrSocket, Mount) ->
Path = <<"/_api/foxx/service?mount=", (agMiscUtils:toBinary(Mount))/binary>>, Path = <<"/_api/foxx/service?mount=", (agMiscUtils:toBinary(Mount))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
@ -89,7 +89,7 @@ installFoxx(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx", QueryBinary/binary>>, Path = <<"/_api/foxx", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
@ -104,7 +104,7 @@ installFoxx(PoolNameOrSocket, MapData, QueryPars) ->
uninstallFoxx(PoolNameOrSocket, QueryPars) -> uninstallFoxx(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/service", QueryBinary/binary>>, Path = <<"/_api/foxx/service", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% %
% PUT /_api/foxx/service % PUT /_api/foxx/service
@ -135,7 +135,7 @@ replaceFoxx(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/service", QueryBinary/binary>>, Path = <<"/_api/foxx/service", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% %
% PATCH /_api/foxx/service % PATCH /_api/foxx/service
@ -166,7 +166,7 @@ upgradeFoxx(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/service", QueryBinary/binary>>, Path = <<"/_api/foxx/service", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
% Foxx服务配置/ % Foxx服务配置/
% Foxx服务配置和依赖关系的ArangoDB HTTP接口的简介 % Foxx服务配置和依赖关系的ArangoDB HTTP接口的简介
@ -182,7 +182,7 @@ upgradeFoxx(PoolNameOrSocket, MapData, QueryPars) ->
getFoxxConfig(PoolNameOrSocket, QueryPars) -> getFoxxConfig(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/configuration", QueryBinary/binary>>, Path = <<"/_api/foxx/configuration", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% PATCH /_api/foxx/configuration % PATCH /_api/foxx/configuration
@ -198,7 +198,7 @@ updateFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/configuration", QueryBinary/binary>>, Path = <<"/_api/foxx/configuration", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
% %
% PUT /_api/foxx/configuration % PUT /_api/foxx/configuration
@ -214,7 +214,7 @@ replaceFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/configuration", QueryBinary/binary>>, Path = <<"/_api/foxx/configuration", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% %
% GET /_api/foxx/dependencies % GET /_api/foxx/dependencies
@ -227,7 +227,7 @@ replaceFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
getFoxxDependencies(PoolNameOrSocket, QueryPars) -> getFoxxDependencies(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>, Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
@ -244,7 +244,7 @@ updateFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>, Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
% %
% PUT /_api/foxx/dependencies % PUT /_api/foxx/dependencies
@ -260,7 +260,7 @@ replaceFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>, Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% Foxx服务杂项 % Foxx服务杂项
% %
@ -275,7 +275,7 @@ replaceFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
getFoxxScripts(PoolNameOrSocket, QueryPars) -> getFoxxScripts(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/scripts", QueryBinary/binary>>, Path = <<"/_api/foxx/scripts", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% POST /_api/foxx/scripts/{name} % POST /_api/foxx/scripts/{name}
@ -293,7 +293,7 @@ runFoxxScripts(PoolNameOrSocket, ScriptName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/scripts/", ScriptName/binary, QueryBinary/binary>>, Path = <<"/_api/foxx/scripts/", ScriptName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
% POST /_api/foxx/tests % POST /_api/foxx/tests
@ -319,7 +319,7 @@ runFoxxScripts(PoolNameOrSocket, ScriptName, MapData, QueryPars) ->
runFoxxTest(PoolNameOrSocket, QueryPars) -> runFoxxTest(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/tests", QueryBinary/binary>>, Path = <<"/_api/foxx/tests", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
% %
@ -336,7 +336,7 @@ runFoxxTest(PoolNameOrSocket, QueryPars) ->
enableFoxxDevelopment(PoolNameOrSocket, QueryPars) -> enableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/development", QueryBinary/binary>>, Path = <<"/_api/foxx/development", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
% %
% DELETE /_api/foxx/development % DELETE /_api/foxx/development
@ -349,7 +349,7 @@ enableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
disableFoxxDevelopment(PoolNameOrSocket, QueryPars) -> disableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/development", QueryBinary/binary>>, Path = <<"/_api/foxx/development", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% %
@ -363,7 +363,7 @@ disableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
getFoxxReadme(PoolNameOrSocket, QueryPars) -> getFoxxReadme(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/readme", QueryBinary/binary>>, Path = <<"/_api/foxx/readme", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% GET /_api/foxx/swagger % GET /_api/foxx/swagger
@ -376,7 +376,7 @@ getFoxxReadme(PoolNameOrSocket, QueryPars) ->
getFoxxSwagger(PoolNameOrSocket, QueryPars) -> getFoxxSwagger(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/swagger", QueryBinary/binary>>, Path = <<"/_api/foxx/swagger", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% POST /_api/foxx/download % POST /_api/foxx/download
@ -391,7 +391,7 @@ getFoxxSwagger(PoolNameOrSocket, QueryPars) ->
downloadFoxxBundle(PoolNameOrSocket, QueryPars) -> downloadFoxxBundle(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/download", QueryBinary/binary>>, Path = <<"/_api/foxx/download", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
% %
% POST /_api/foxx/commit % POST /_api/foxx/commit
@ -404,4 +404,4 @@ downloadFoxxBundle(PoolNameOrSocket, QueryPars) ->
commitFoxxState(PoolNameOrSocket, QueryPars) -> commitFoxxState(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/commit", QueryBinary/binary>>, Path = <<"/_api/foxx/commit", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).

+ 36
- 36
src/arangoApi/agGeneralGraphs.erl 查看文件

@ -23,7 +23,7 @@
% isSmartSmartGraph % isSmartSmartGraph
% smartGraphAttribute % smartGraphAttribute
getGharialList(PoolNameOrSocket) -> getGharialList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/gharial">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/gharial">>, [], undefined).
% %
@ -68,7 +68,7 @@ getGharialList(PoolNameOrSocket) ->
% errorMessage % errorMessage
newGharial(PoolNameOrSocket, MapData) -> newGharial(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/gharial">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/gharial">>, [], BodyStr).
newGharial(PoolNameOrSocket, MapData, WaitForSync) -> newGharial(PoolNameOrSocket, MapData, WaitForSync) ->
Path = Path =
@ -79,7 +79,7 @@ newGharial(PoolNameOrSocket, MapData, WaitForSync) ->
<<"/_api/gharial?waitForSync=false">> <<"/_api/gharial?waitForSync=false">>
end, end,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
% GET /_api/gharial/{graph} % GET /_api/gharial/{graph}
@ -97,7 +97,7 @@ newGharial(PoolNameOrSocket, MapData, WaitForSync) ->
% errorMessage % errorMessage
getGharial(PoolNameOrSocket, GraphName) -> getGharial(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary>>, Path = <<"/_api/gharial/", GraphName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
@ -122,7 +122,7 @@ getGharial(PoolNameOrSocket, GraphName) ->
% errorMessage % errorMessage
delGharial(PoolNameOrSocket, GraphName) -> delGharial(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary>>, Path = <<"/_api/gharial/", GraphName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delGharial(PoolNameOrSocket, GraphName, DropCollections) -> delGharial(PoolNameOrSocket, GraphName, DropCollections) ->
Path = Path =
@ -132,7 +132,7 @@ delGharial(PoolNameOrSocket, GraphName, DropCollections) ->
_ -> _ ->
<<"/_api/gharial/", GraphName/binary, "?dropCollections=false">> <<"/_api/gharial/", GraphName/binary, "?dropCollections=false">>
end, end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% 使 % 使
@ -151,7 +151,7 @@ delGharial(PoolNameOrSocket, GraphName, DropCollections) ->
% errorMessage % errorMessage
getGharialVertexCollList(PoolNameOrSocket, GraphName) -> getGharialVertexCollList(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% POST /_api/gharial/{graph}/vertex % POST /_api/gharial/{graph}/vertex
@ -188,7 +188,7 @@ getGharialVertexCollList(PoolNameOrSocket, GraphName) ->
addGharialVertexColl(PoolNameOrSocket, GraphName, MapData) -> addGharialVertexColl(PoolNameOrSocket, GraphName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
% DELETE /_api/gharial/{graph}/vertex/{collection} % DELETE /_api/gharial/{graph}/vertex/{collection}
@ -224,7 +224,7 @@ addGharialVertexColl(PoolNameOrSocket, GraphName, MapData) ->
% errorMessage % errorMessage
delGharialVertexColl(PoolNameOrSocket, GraphName, CollName) -> delGharialVertexColl(PoolNameOrSocket, GraphName, CollName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delGharialVertexColl(PoolNameOrSocket, GraphName, CollName, DropCollection) -> delGharialVertexColl(PoolNameOrSocket, GraphName, CollName, DropCollection) ->
Path = Path =
@ -234,7 +234,7 @@ delGharialVertexColl(PoolNameOrSocket, GraphName, CollName, DropCollection) ->
_ -> _ ->
<<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "?dropCollection=false">> <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "?dropCollection=false">>
end, end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% %
@ -253,7 +253,7 @@ delGharialVertexColl(PoolNameOrSocket, GraphName, CollName, DropCollection) ->
% errorMessage % errorMessage
getGharialEdgeDefList(PoolNameOrSocket, GraphName) -> getGharialEdgeDefList(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge">>, Path = <<"/_api/gharial/", GraphName/binary, "/edge">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
@ -293,7 +293,7 @@ getGharialEdgeDefList(PoolNameOrSocket, GraphName) ->
addGharialEdgeDef(PoolNameOrSocket, GraphName, MapData) -> addGharialEdgeDef(PoolNameOrSocket, GraphName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge">>, Path = <<"/_api/gharial/", GraphName/binary, "/edge">>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
@ -336,13 +336,13 @@ addGharialEdgeDef(PoolNameOrSocket, GraphName, MapData) ->
replaceGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, MapData) -> replaceGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) -> replaceGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% %
@ -376,12 +376,12 @@ replaceGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars)
delGharialEdgeDef(PoolNameOrSocket, GraphName, CollName) -> delGharialEdgeDef(PoolNameOrSocket, GraphName, CollName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, QueryPars) -> delGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% %
@ -419,13 +419,13 @@ delGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, QueryPars) ->
newGharialVertex(PoolNameOrSocket, GraphName, CollName, MapData) -> newGharialVertex(PoolNameOrSocket, GraphName, CollName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
newGharialVertex(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) -> newGharialVertex(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
@ -471,12 +471,12 @@ newGharialVertex(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
% errorMessage % errorMessage
getGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) -> getGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
getGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, Headers, QueryPars) -> getGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, Headers, undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, Headers, undefined).
% %
@ -530,13 +530,13 @@ getGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, Headers, Quer
updateGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData) -> updateGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
updateGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, Headers, QueryPars) -> updateGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, Headers, BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, Headers, BodyStr).
% %
@ -590,13 +590,13 @@ updateGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, H
replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData) -> replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, Headers, QueryPars) -> replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, Headers, BodyStr).
% %
% DELETE /_api/gharial/{graph}/vertex/{collection}/{vertex} % DELETE /_api/gharial/{graph}/vertex/{collection}/{vertex}
@ -642,12 +642,12 @@ replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData,
% errorMessage % errorMessage
delGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) -> delGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
delGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, Headers, QueryPars) -> delGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, Headers, undefined).
% %
@ -695,13 +695,13 @@ delGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, Headers, Quer
newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData) -> newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) -> newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
% GET /_api/gharial/{graph}/edge/{collection}/{edge} % GET /_api/gharial/{graph}/edge/{collection}/{edge}
@ -746,11 +746,11 @@ newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
% errorMessage % errorMessage
getGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) -> getGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
getGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, Headers) -> getGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, Headers) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, Headers, undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, Headers, undefined).
% %
@ -805,13 +805,13 @@ getGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, Headers) ->
updateGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData) -> updateGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
updateGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, QueryPars) -> updateGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, Headers, BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, Headers, BodyStr).
% %
@ -867,13 +867,13 @@ updateGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Heade
replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData) -> replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, QueryPars) -> replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, Headers, BodyStr).
% %
% DELETE /_api/gharial/{graph}/edge/{collection}/{edge} % DELETE /_api/gharial/{graph}/edge/{collection}/{edge}
@ -919,11 +919,11 @@ replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Head
% errorMessage % errorMessage
delGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) -> delGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, Headers, QueryPars) -> delGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>, Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, Headers, undefined).

+ 6
- 6
src/arangoApi/agHotBackup.erl 查看文件

@ -29,7 +29,7 @@
% 408HTTP 408 % 408HTTP 408
newBackup(PoolNameOrSocket, MapData) -> newBackup(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/backup/create">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/create">>, [], BodyStr).
% %
% POST /_admin/backup/restore % POST /_admin/backup/restore
@ -41,7 +41,7 @@ newBackup(PoolNameOrSocket, MapData) ->
% 400使HTTP方法调用了restore命令POSTHTTP 400 % 400使HTTP方法调用了restore命令POSTHTTP 400
restoreBackup(PoolNameOrSocket, MapData) -> restoreBackup(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/backup/restore">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/restore">>, [], BodyStr).
% %
% POST /_admin/backup/delete % POST /_admin/backup/delete
@ -54,7 +54,7 @@ restoreBackup(PoolNameOrSocket, MapData) ->
% 404id找不到与该标识符相对应的备份 % 404id找不到与该标识符相对应的备份
delBackup(PoolNameOrSocket, MapData) -> delBackup(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/backup/delete">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/delete">>, [], BodyStr).
% %
% POST /_admin/backup/list % POST /_admin/backup/list
@ -67,7 +67,7 @@ delBackup(PoolNameOrSocket, MapData) ->
% 404id给出了ID或ID列表ID作为备份的标识符HTTP 404 NOT FOUND % 404id给出了ID或ID列表ID作为备份的标识符HTTP 404 NOT FOUND
% 405使HTTP方法调用了list命令POSTHTTP 405 METHOD NOT ALLOWED % 405使HTTP方法调用了list命令POSTHTTP 405 METHOD NOT ALLOWED
getBackupList(PoolNameOrSocket) -> getBackupList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/backup/list">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/list">>, [], undefined).
% %
% POST /_admin/backup/upload % POST /_admin/backup/upload
@ -86,7 +86,7 @@ getBackupList(PoolNameOrSocket) ->
% 404id uploadId % 404id uploadId
uploadBackup(PoolNameOrSocket, MapData) -> uploadBackup(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/backup/upload">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/upload">>, [], BodyStr).
% %
% POST /_admin/backup/download % POST /_admin/backup/download
@ -105,4 +105,4 @@ uploadBackup(PoolNameOrSocket, MapData) ->
% 404id downloadId % 404id downloadId
downloadBackup(PoolNameOrSocket, MapData) -> downloadBackup(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/backup/download">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/download">>, [], BodyStr).

+ 10
- 10
src/arangoApi/agIndexes.erl 查看文件

@ -49,7 +49,7 @@
% 404 HTTP 404 % 404 HTTP 404
getIndexInfo(PoolNameOrSocket, IndexId) -> getIndexInfo(PoolNameOrSocket, IndexId) ->
Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>, Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% %
@ -77,7 +77,7 @@ getIndexInfo(PoolNameOrSocket, IndexId) ->
newIndex(PoolNameOrSocket, CollName, MapData) -> newIndex(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/index?collection=", CollName/binary>>, Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
@ -90,7 +90,7 @@ newIndex(PoolNameOrSocket, CollName, MapData) ->
% 404index-id未知HTTP 404 % 404index-id未知HTTP 404
delIndex(PoolNameOrSocket, IndexId) -> delIndex(PoolNameOrSocket, IndexId) ->
Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>, Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% %
% GET /_api/index % GET /_api/index
@ -101,7 +101,7 @@ delIndex(PoolNameOrSocket, IndexId) ->
% 200JSON对象 % 200JSON对象
getIndexList(PoolNameOrSocket, CollName) -> getIndexList(PoolNameOrSocket, CollName) ->
Path = <<"/_api/index", CollName/binary>>, Path = <<"/_api/index", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% 使 % 使
% /_api/simple/by-example则将使用该索引执行示例查询 % /_api/simple/by-example则将使用该索引执行示例查询
@ -130,7 +130,7 @@ newIndexOfHash(PoolNameOrSocket, CollName, MapData) ->
#{<<"type">> := <<"hash">>} -> #{<<"type">> := <<"hash">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>, Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ -> _ ->
{error, param} {error, param}
end. end.
@ -197,7 +197,7 @@ newIndexOfSkipList(PoolNameOrSocket, CollName, MapData) ->
#{<<"type">> := <<"skiplist">>} -> #{<<"type">> := <<"skiplist">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>, Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ -> _ ->
{error, param} {error, param}
end. end.
@ -228,7 +228,7 @@ newIndexOfPersistent(PoolNameOrSocket, CollName, MapData) ->
#{<<"type">> := <<"persistent">>} -> #{<<"type">> := <<"persistent">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>, Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ -> _ ->
{error, param} {error, param}
end. end.
@ -254,7 +254,7 @@ newIndexOfTtl(PoolNameOrSocket, CollName, MapData) ->
#{<<"type">> := <<"ttl">>} -> #{<<"type">> := <<"ttl">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>, Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ -> _ ->
{error, param} {error, param}
end. end.
@ -282,7 +282,7 @@ newIndexOfGeo(PoolNameOrSocket, CollName, MapData) ->
#{<<"type">> := <<"geo">>} -> #{<<"type">> := <<"geo">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>, Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ -> _ ->
{error, param} {error, param}
end. end.
@ -354,7 +354,7 @@ newIndexOfFulltext(PoolNameOrSocket, CollName, MapData) ->
#{<<"type">> := <<"fulltext">>} -> #{<<"type">> := <<"fulltext">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>, Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ -> _ ->
{error, param} {error, param}
end. end.

+ 13
- 13
src/arangoApi/agMiscFun.erl 查看文件

@ -48,12 +48,12 @@
% -[ ] % -[ ]
% hostID % hostID
getSrvVersion(PoolNameOrSocket) -> getSrvVersion(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/version">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/version">>, [], undefined).
getSrvVersion(PoolNameOrSocket, QueryPars) -> getSrvVersion(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/version", QueryBinary/binary>>, Path = <<"/_api/version", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% GET /_api/engine % GET /_api/engine
@ -61,7 +61,7 @@ getSrvVersion(PoolNameOrSocket, QueryPars) ->
% HTTP 200 % HTTP 200
% mmfiles或rocksdb % mmfiles或rocksdb
getSrvEngine(PoolNameOrSocket) -> getSrvEngine(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/engine">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/engine">>, [], undefined).
% WAL同步到磁盘 % WAL同步到磁盘
% PUT /_admin/wal/flush % PUT /_admin/wal/flush
@ -73,7 +73,7 @@ getSrvEngine(PoolNameOrSocket) ->
% 200 % 200
% 405使HTTP方法时返回 % 405使HTTP方法时返回
flushWal(PoolNameOrSocket) -> flushWal(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_admin/wal/flush">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/flush">>, [], undefined).
% %
% %
@ -90,7 +90,7 @@ flushWal(PoolNameOrSocket) ->
% 200 % 200
% 405使HTTP方法时返回 % 405使HTTP方法时返回
getWalProperties(PoolNameOrSocket) -> getWalProperties(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/wal/properties">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/properties">>, [], undefined).
% %
% %
@ -108,7 +108,7 @@ getWalProperties(PoolNameOrSocket) ->
% 405使HTTP方法时返回 % 405使HTTP方法时返回
setWalProperties(PoolNameOrSocket, MapData) -> setWalProperties(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_admin/wal/properties">>, BodyStr, undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/properties">>, BodyStr, undefined).
% %
% %
@ -121,7 +121,7 @@ setWalProperties(PoolNameOrSocket, MapData) ->
% 200 % 200
% 405使HTTP方法时返回 % 405使HTTP方法时返回
getTransactions(PoolNameOrSocket) -> getTransactions(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/wal/transactions">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/transactions">>, [], undefined).
% %
% %
@ -132,7 +132,7 @@ getTransactions(PoolNameOrSocket) ->
% codeHTTP状态码 % codeHTTP状态码
% timeUnix时间戳记为单位 % timeUnix时间戳记为单位
getDbTime(PoolNameOrSocket) -> getDbTime(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/time">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/time">>, [], undefined).
% %
% POST /_admin/echo % POST /_admin/echo
@ -164,7 +164,7 @@ getDbTime(PoolNameOrSocket) ->
% path % path
% rawRequestBody % rawRequestBody
echo(PoolNameOrSocket) -> echo(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/echo">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/echo">>, [], undefined).
% %
% GET /_admin/database/target-version % GET /_admin/database/target-version
@ -172,7 +172,7 @@ echo(PoolNameOrSocket) ->
% %
% 200 % 200
getTargetVersion(PoolNameOrSocket) -> getTargetVersion(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/database/target-version">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/database/target-version">>, [], undefined).
% %
% DELETE /_admin/shutdown % DELETE /_admin/shutdown
@ -180,7 +180,7 @@ getTargetVersion(PoolNameOrSocket) ->
% %
% 200OK都将返回 % 200OK都将返回
shutDown(PoolNameOrSocket) -> shutDown(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, <<"/_admin/shutdown">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_admin/shutdown">>, [], undefined).
% %
@ -196,7 +196,7 @@ shutDown(PoolNameOrSocket) ->
% 404ArangoDB404 % 404ArangoDB404
execute(PoolNameOrSocket, MapData) -> execute(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/execute">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/execute">>, [], BodyStr).
% %
% GET /_admin/status % GET /_admin/status
@ -230,5 +230,5 @@ execute(PoolNameOrSocket, MapData) ->
% %
% 200 % 200
getDbStatus(PoolNameOrSocket) -> getDbStatus(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/status">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/status">>, [], undefined).

+ 2
- 2
src/arangoApi/agRepairJobs.erl 查看文件

@ -8,9 +8,9 @@
%% %%
%% GET /_admin/repairs/distributeShardsLike %% GET /_admin/repairs/distributeShardsLike
checkRepir(PoolNameOrSocket) -> checkRepir(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/repairs/distributeShardsLike">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/repairs/distributeShardsLike">>, [], undefined).
%% %%
%% POST /_admin/repairs/distributeShardsLike %% POST /_admin/repairs/distributeShardsLike
repir(PoolNameOrSocket) -> repir(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_admin/repairs/distributeShardsLike">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/repairs/distributeShardsLike">>, [], undefined).

+ 30
- 30
src/arangoApi/agReplication.erl 查看文件

@ -41,7 +41,7 @@
getRepInventory(PoolNameOrSocket, QueryPars) -> getRepInventory(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/inventory", QueryBinary/binary>>, Path = <<"/_api/replication/inventory", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% POST /_api/replication/batch % POST /_api/replication/batch
@ -59,7 +59,7 @@ getRepInventory(PoolNameOrSocket, QueryPars) ->
% 405使HTTP方法时返回 % 405使HTTP方法时返回
newRepBatch(PoolNameOrSocket, MapData) -> newRepBatch(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/replication/batch">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/replication/batch">>, [], BodyStr).
% %
@ -76,7 +76,7 @@ newRepBatch(PoolNameOrSocket, MapData) ->
% 405使HTTP方法时返回 % 405使HTTP方法时返回
delRepBatch(PoolNameOrSocket, BatchId) -> delRepBatch(PoolNameOrSocket, BatchId) ->
Path = <<"/_api/replication/batch/", (agMiscUtils:toBinary(BatchId))/binary>>, Path = <<"/_api/replication/batch/", (agMiscUtils:toBinary(BatchId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
% %
@ -99,7 +99,7 @@ delRepBatch(PoolNameOrSocket, BatchId) ->
prolongRepBatch(PoolNameOrSocket, BatchId, MapData) -> prolongRepBatch(PoolNameOrSocket, BatchId, MapData) ->
Path = <<"/_api/replication/batch/", (agMiscUtils:toBinary(BatchId))/binary>>, Path = <<"/_api/replication/batch/", (agMiscUtils:toBinary(BatchId))/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% %
% GET /_api/replication/dump % GET /_api/replication/dump
@ -138,7 +138,7 @@ prolongRepBatch(PoolNameOrSocket, BatchId, MapData) ->
getRepDump(PoolNameOrSocket, QueryPars) -> getRepDump(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/dump", QueryBinary/binary>>, Path = <<"/_api/replication/dump", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% %
@ -170,7 +170,7 @@ getRepDump(PoolNameOrSocket, QueryPars) ->
% 501 % 501
startRepSync(PoolNameOrSocket, MapData) -> startRepSync(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/sync">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/sync">>, [], BodyStr).
% %
% %
@ -186,7 +186,7 @@ startRepSync(PoolNameOrSocket, MapData) ->
getRepClusterInventory(PoolNameOrSocket, QueryPars) -> getRepClusterInventory(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/clusterInventory", QueryBinary/binary>>, Path = <<"/_api/replication/clusterInventory", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% %
@ -211,7 +211,7 @@ getRepClusterInventory(PoolNameOrSocket, QueryPars) ->
% 405使HTTP方法时返回 % 405使HTTP方法时返回
% 500 % 500
getRepLoggerState(PoolNameOrSocket) -> getRepLoggerState(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/logger-state">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-state">>, [], undefined).
% %
% %
@ -265,7 +265,7 @@ getRepLoggerState(PoolNameOrSocket) ->
% 500500 % 500500
% 501 % 501
getRepLoggerFirstTick(PoolNameOrSocket) -> getRepLoggerFirstTick(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/logger-first-tick">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-first-tick">>, [], undefined).
% %
% GET /_api/replication/logger-tick-ranges % GET /_api/replication/logger-tick-ranges
@ -281,7 +281,7 @@ getRepLoggerFirstTick(PoolNameOrSocket) ->
% 500 % 500
% 501 % 501
getRepLoggerTickRanges(PoolNameOrSocket) -> getRepLoggerTickRanges(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/logger-tick-ranges">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-tick-ranges">>, [], undefined).
% %
% applier命令允许远程启动ArangoDB数据库复制应用程序的状态和配置 % applier命令允许远程启动ArangoDB数据库复制应用程序的状态和配置
@ -317,14 +317,14 @@ getRepLoggerTickRanges(PoolNameOrSocket) ->
% 405使HTTP方法时返回 % 405使HTTP方法时返回
% 500500 % 500500
getRepApplierConfig(PoolNameOrSocket) -> getRepApplierConfig(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/applier-config">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config">>, [], undefined).
getRepApplierConfig(PoolNameOrSocket, IsGlobal) -> getRepApplierConfig(PoolNameOrSocket, IsGlobal) ->
case IsGlobal of case IsGlobal of
true -> true ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/applier-config?global=true">>, [], undefined);
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config?global=true">>, [], undefined);
_ -> _ ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/applier-config">>, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config">>, [], undefined)
end. end.
% %
@ -363,15 +363,15 @@ getRepApplierConfig(PoolNameOrSocket, IsGlobal) ->
% 500500 % 500500
setRepApplierConfig(PoolNameOrSocket, MapData) -> setRepApplierConfig(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/applier-config">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config">>, [], BodyStr).
setRepApplierConfig(PoolNameOrSocket, MapData, IsGlobal) -> setRepApplierConfig(PoolNameOrSocket, MapData, IsGlobal) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
case IsGlobal of case IsGlobal of
true -> true ->
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/applier-config?global=true">>, [], BodyStr);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config?global=true">>, [], BodyStr);
_ -> _ ->
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/applier-config">>, [], BodyStr)
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config">>, [], BodyStr)
end. end.
% %
@ -388,12 +388,12 @@ setRepApplierConfig(PoolNameOrSocket, MapData, IsGlobal) ->
% 405使HTTP方法时返回 % 405使HTTP方法时返回
% 500500 % 500500
startRepApplier(PoolNameOrSocket) -> startRepApplier(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/applier-start">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-start">>, [], undefined).
startRepApplier(PoolNameOrSocket, QueryPars) -> startRepApplier(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/applier-start", QueryBinary/binary>>, Path = <<"/_api/replication/applier-start", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
% PUT /_api/replication/applier-stop % PUT /_api/replication/applier-stop
@ -405,14 +405,14 @@ startRepApplier(PoolNameOrSocket, QueryPars) ->
% 405使HTTP方法时返回 % 405使HTTP方法时返回
% 500500 % 500500
stopRepApplier(PoolNameOrSocket) -> stopRepApplier(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/applier-stop">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop">>, [], undefined).
stopRepApplier(PoolNameOrSocket, IsGlobal) -> stopRepApplier(PoolNameOrSocket, IsGlobal) ->
case IsGlobal of case IsGlobal of
true -> true ->
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/applier-stop?global=true">>, [], undefined);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop?global=true">>, [], undefined);
_ -> _ ->
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/applier-stop">>, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop">>, [], undefined)
end. end.
% %
@ -455,14 +455,14 @@ stopRepApplier(PoolNameOrSocket, IsGlobal) ->
% 405使HTTP方法时返回 % 405使HTTP方法时返回
% 500500 % 500500
getRepApplierState(PoolNameOrSocket) -> getRepApplierState(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/applier-state">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state">>, [], undefined).
getRepApplierState(PoolNameOrSocket, IsGlobal) -> getRepApplierState(PoolNameOrSocket, IsGlobal) ->
case IsGlobal of case IsGlobal of
true -> true ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/applier-state?global=true">>, [], undefined);
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state?global=true">>, [], undefined);
_ -> _ ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/applier-state">>, [], undefined)
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state">>, [], undefined)
end. end.
@ -533,7 +533,7 @@ getRepApplierState(PoolNameOrSocket, IsGlobal) ->
% 501 % 501
changeRepMakeSlave(PoolNameOrSocket, MapData) -> changeRepMakeSlave(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, <<"/_api/replication/make-slave">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/make-slave">>, [], BodyStr).
% %
%ID %ID
@ -546,7 +546,7 @@ changeRepMakeSlave(PoolNameOrSocket, MapData) ->
%405使HTTP方法时返回 %405使HTTP方法时返回
%500500 %500500
getRepServerId(PoolNameOrSocket) -> getRepServerId(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/replication/server-id">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/server-id">>, [], undefined).
% WAL % WAL
% 线 % 线
@ -563,7 +563,7 @@ getRepServerId(PoolNameOrSocket) ->
% 500 % 500
% 501 % 501
getWalRange(PoolNameOrSocket) -> getWalRange(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/wal/range">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/range">>, [], undefined).
% %
% %
@ -580,7 +580,7 @@ getWalRange(PoolNameOrSocket) ->
% 500500 % 500500
% 501 % 501
getWalLastTick(PoolNameOrSocket) -> getWalLastTick(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/wal/lastTick">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/lastTick">>, [], undefined).
% %
% GET /_api/wal/tail % GET /_api/wal/tail
@ -626,10 +626,10 @@ getWalLastTick(PoolNameOrSocket) ->
% 500500 % 500500
% 501 % 501
getWalTail(PoolNameOrSocket) -> getWalTail(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/wal/tail">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/tail">>, [], undefined).
getWalTail(PoolNameOrSocket, QueryPars) -> getWalTail(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars), QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/wal/tail", QueryBinary/binary>>, Path = <<"/_api/wal/tail", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).

+ 5
- 5
src/arangoApi/agTasks.erl 查看文件

@ -16,7 +16,7 @@
% HTTP 200 % HTTP 200
% ** % **
getTaskList(PoolNameOrSocket) -> getTaskList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/tasks/">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/tasks/">>, [], undefined).
% %
% GET /_api/tasks/{id} % GET /_api/tasks/{id}
@ -26,7 +26,7 @@ getTaskList(PoolNameOrSocket) ->
% HTTP 200 % HTTP 200
getTask(PoolNameOrSocket, TaskId) -> getTask(PoolNameOrSocket, TaskId) ->
Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>, Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% POST /_api/tasks % POST /_api/tasks
@ -52,7 +52,7 @@ getTask(PoolNameOrSocket, TaskId) ->
% 400HTTP 400 % 400HTTP 400
newTask(PoolNameOrSocket, MapData) -> newTask(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/tasks">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/tasks">>, [], BodyStr).
% ID的新任务 % ID的新任务
% PUT /_api/tasks/{id} % PUT /_api/tasks/{id}
@ -70,7 +70,7 @@ newTask(PoolNameOrSocket, MapData) ->
newTask(PoolNameOrSocket, TaskId, MapData) -> newTask(PoolNameOrSocket, TaskId, MapData) ->
Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>, Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
% %
% DELETE /_api/tasks/{id} % DELETE /_api/tasks/{id}
@ -86,4 +86,4 @@ newTask(PoolNameOrSocket, TaskId, MapData) ->
% errorMessage % errorMessage
delTask(PoolNameOrSocket, TaskId) -> delTask(PoolNameOrSocket, TaskId) ->
Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>, Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).

+ 6
- 6
src/arangoApi/agTransactions.erl 查看文件

@ -38,7 +38,7 @@
% errorMessage % errorMessage
beginTransaction(PoolNameOrSocket, MapData) -> beginTransaction(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/transaction/begin">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/transaction/begin">>, [], BodyStr).
% %
% %
@ -54,7 +54,7 @@ beginTransaction(PoolNameOrSocket, MapData) ->
% 404使HTTP 404 % 404使HTTP 404
getTransactionStatus(PoolNameOrSocket, TransactionId) -> getTransactionStatus(PoolNameOrSocket, TransactionId) ->
Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>, Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
@ -81,7 +81,7 @@ getTransactionStatus(PoolNameOrSocket, TransactionId) ->
% 409使HTTP 409 % 409使HTTP 409
commitTransaction(PoolNameOrSocket, TransactionId) -> commitTransaction(PoolNameOrSocket, TransactionId) ->
Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>, Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
% %
% DELETE /_api/transaction/{transaction-id} % DELETE /_api/transaction/{transaction-id}
@ -107,7 +107,7 @@ commitTransaction(PoolNameOrSocket, TransactionId) ->
% 409HTTP 409 % 409HTTP 409
abortTransaction(PoolNameOrSocket, TransactionId) -> abortTransaction(PoolNameOrSocket, TransactionId) ->
Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>, Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% %
% GET /_api/transaction % GET /_api/transaction
@ -118,7 +118,7 @@ abortTransaction(PoolNameOrSocket, TransactionId) ->
% %
% 200HTTP 200 % 200HTTP 200
getTransactionList(PoolNameOrSocket) -> getTransactionList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/transaction">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/transaction">>, [], undefined).
% JavaScript交易的HTTP接口 % JavaScript交易的HTTP接口
% ArangoDB的JS事务在服务器上执行 % ArangoDB的JS事务在服务器上执行
@ -155,7 +155,7 @@ getTransactionList(PoolNameOrSocket) ->
% 500使HTTP 500 % 500使HTTP 500
executeTransaction(PoolNameOrSocket, MapData) -> executeTransaction(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/transaction">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/transaction">>, [], BodyStr).

+ 13
- 13
src/arangoApi/agUserMgr.erl 查看文件

@ -31,7 +31,7 @@
% 409 % 409
newUser(PoolNameOrSocket, MapData) -> newUser(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/user">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/user">>, [], BodyStr).
% 访 % 访
% PUT /_api/user/{user}/database/{dbname} % PUT /_api/user/{user}/database/{dbname}
@ -51,7 +51,7 @@ newUser(PoolNameOrSocket, MapData) ->
setUserDbAccessLevel(PoolNameOrSocket, UserName, DbName, MapData) -> setUserDbAccessLevel(PoolNameOrSocket, UserName, DbName, MapData) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>, Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% 访 % 访
% PUT /_api/user/{user}/database/{dbname}/{collection} % PUT /_api/user/{user}/database/{dbname}/{collection}
@ -72,7 +72,7 @@ setUserDbAccessLevel(PoolNameOrSocket, UserName, DbName, MapData) ->
setUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName, MapData) -> setUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName, MapData) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>, Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% 访访 % 访访
% DELETE /_api/user/{user}/database/{dbname} % DELETE /_api/user/{user}/database/{dbname}
@ -85,7 +85,7 @@ setUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName, MapData) ->
% 400JSON格式不正确或请求中缺少必需数据 % 400JSON格式不正确或请求中缺少必需数据
clearUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) -> clearUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>, Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% 访访 % 访访
@ -100,7 +100,7 @@ clearUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) ->
% 400 % 400
clearUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) -> clearUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>, Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% 访 % 访
% GET /_api/user/{user}/database/ % GET /_api/user/{user}/database/
@ -118,7 +118,7 @@ clearUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) ->
% 403访访 % 403访访
getUserDbList(PoolNameOrSocket, UserName) -> getUserDbList(PoolNameOrSocket, UserName) ->
Path = <<"/_api/user/", UserName/binary, "/database/">>, Path = <<"/_api/user/", UserName/binary, "/database/">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% 访 % 访
% GET /_api/user/{user}/database/{dbname} % GET /_api/user/{user}/database/{dbname}
@ -133,7 +133,7 @@ getUserDbList(PoolNameOrSocket, UserName) ->
% 403访访 % 403访访
getUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) -> getUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>, Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% 访 % 访
% GET /_api/user/{user}/database/{dbname}/{collection} % GET /_api/user/{user}/database/{dbname}/{collection}
@ -149,7 +149,7 @@ getUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) ->
% 403访访 % 403访访
getUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) -> getUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>, Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% PUT /_api/user/{user} % PUT /_api/user/{user}
@ -169,7 +169,7 @@ getUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) ->
replaceUser(PoolNameOrSocket, UserName, MapData) -> replaceUser(PoolNameOrSocket, UserName, MapData) ->
Path = <<"/_api/user/", UserName/binary>>, Path = <<"/_api/user/", UserName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% %
% PATCH /_api/user/{user} % PATCH /_api/user/{user}
@ -189,7 +189,7 @@ replaceUser(PoolNameOrSocket, UserName, MapData) ->
modifyUser(PoolNameOrSocket, UserName, MapData) -> modifyUser(PoolNameOrSocket, UserName, MapData) ->
Path = <<"/_api/user/", UserName/binary>>, Path = <<"/_api/user/", UserName/binary>>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
% %
% DELETE /_api/user/{user} % DELETE /_api/user/{user}
@ -203,7 +203,7 @@ modifyUser(PoolNameOrSocket, UserName, MapData) ->
% 404 % 404
delUser(PoolNameOrSocket, UserName) -> delUser(PoolNameOrSocket, UserName) ->
Path = <<"/_api/user/", UserName/binary>>, Path = <<"/_api/user/", UserName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% %
% GET /_api/user/{user} % GET /_api/user/{user}
@ -217,7 +217,7 @@ delUser(PoolNameOrSocket, UserName) ->
% 404 % 404
getUser(PoolNameOrSocket, UserName) -> getUser(PoolNameOrSocket, UserName) ->
Path = <<"/_api/user/", UserName/binary>>, Path = <<"/_api/user/", UserName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
% GET /_api/user/ % GET /_api/user/
@ -231,4 +231,4 @@ getUser(PoolNameOrSocket, UserName) ->
% 401_system 访访 % 401_system 访访
% 403访访 % 403访访
getUserList(PoolNameOrSocket) -> getUserList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/user/">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/user/">>, [], undefined).

+ 8
- 8
src/arangoApi/agViews.erl 查看文件

@ -43,7 +43,7 @@ newViewOfArangoSearch(PoolNameOrSocket, MapData) ->
case MapData of case MapData of
#{<<"type">> := <<"arangosearch">>} -> #{<<"type">> := <<"arangosearch">>} ->
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/view">>, [], BodyStr);
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/view">>, [], BodyStr);
_ -> _ ->
{error, param} {error, param}
end. end.
@ -60,7 +60,7 @@ newViewOfArangoSearch(PoolNameOrSocket, MapData) ->
% 404HTTP 404 % 404HTTP 404
getViewInfo(PoolNameOrSocket, ViewName) -> getViewInfo(PoolNameOrSocket, ViewName) ->
Path = <<"/_api/view/", ViewName/binary>>, Path = <<"/_api/view/", ViewName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
@ -74,7 +74,7 @@ getViewInfo(PoolNameOrSocket, ViewName) ->
% 404HTTP 404 % 404HTTP 404
getViewProperties(PoolNameOrSocket, ViewName) -> getViewProperties(PoolNameOrSocket, ViewName) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>, Path = <<"/_api/view/", ViewName/binary, "/properties">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% %
@ -86,7 +86,7 @@ getViewProperties(PoolNameOrSocket, ViewName) ->
% %
% 200 % 200
getViewList(PoolNameOrSocket) -> getViewList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/view">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/view">>, [], undefined).
% ArangoSearch视图的所有属性 % ArangoSearch视图的所有属性
% %
@ -125,7 +125,7 @@ getViewList(PoolNameOrSocket) ->
changeViewAllProperties(PoolNameOrSocket, ViewName, MapData) -> changeViewAllProperties(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>, Path = <<"/_api/view/", ViewName/binary, "/properties">>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
% ArangoSearch视图的属性 % ArangoSearch视图的属性
% PATCH /_api/view/{view-name}/properties#ArangoSearch % PATCH /_api/view/{view-name}/properties#ArangoSearch
@ -163,7 +163,7 @@ changeViewAllProperties(PoolNameOrSocket, ViewName, MapData) ->
changeViewPartProperties(PoolNameOrSocket, ViewName, MapData) -> changeViewPartProperties(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>, Path = <<"/_api/view/", ViewName/binary, "/properties">>,
BodyStr = jiffy:encode(MapData), BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
% %
% PUT /_api/view/{view-name}/rename % PUT /_api/view/{view-name}/rename
@ -182,7 +182,7 @@ changeViewPartProperties(PoolNameOrSocket, ViewName, MapData) ->
renameView(PoolNameOrSocket, ViewName, NewViewName) -> renameView(PoolNameOrSocket, ViewName, NewViewName) ->
Path = <<"/_api/view/", ViewName/binary, "/rename">>, Path = <<"/_api/view/", ViewName/binary, "/rename">>,
NameStr = jiffy:encode(NewViewName), NameStr = jiffy:encode(NewViewName),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], <<"{\"name\":", NameStr/binary, "}">>).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], <<"{\"name\":", NameStr/binary, "}">>).
% %
% DELETE /_api/view/{view-name} % DELETE /_api/view/{view-name}
@ -197,4 +197,4 @@ renameView(PoolNameOrSocket, ViewName, NewViewName) ->
% 404HTTP 404 % 404HTTP 404
delView(PoolNameOrSocket, ViewName) -> delView(PoolNameOrSocket, ViewName) ->
Path = <<"/_api/view/", ViewName/binary>>, Path = <<"/_api/view/", ViewName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).

+ 0
- 1
src/httpCli/agAgencyPoolMgrIns.erl 查看文件

@ -42,7 +42,6 @@ handleMsg(_Msg, State) ->
{ok, State}. {ok, State}.
terminate(_Reason, _State) -> terminate(_Reason, _State) ->
io:format("IMY******************* agAgencyPoolMgrIns terminate ~p~n ", [_Reason]),
ets:delete_all_objects(?ETS_AG_Pool), ets:delete_all_objects(?ETS_AG_Pool),
ets:delete_all_objects(?ETS_AG_Agency), ets:delete_all_objects(?ETS_AG_Agency),
agKvsToBeam:load(?agBeamPool, []), agKvsToBeam:load(?agBeamPool, []),

+ 2
- 2
src/httpCli/agAgencyUtils.erl 查看文件

@ -54,7 +54,7 @@ agencyReply({undefined, _RequestId, TimerRef}, _Reply) ->
agAgencyUtils:cancelTimer(TimerRef); agAgencyUtils:cancelTimer(TimerRef);
agencyReply({PidForm, RequestId, TimerRef}, Reply) -> agencyReply({PidForm, RequestId, TimerRef}, Reply) ->
agAgencyUtils:cancelTimer(TimerRef), agAgencyUtils:cancelTimer(TimerRef),
catch PidForm ! #miAgHttpCliRet{requestId = RequestId, reply = Reply},
catch PidForm ! #miRequestRet{requestId = RequestId, reply = Reply},
ok; ok;
agencyReply(undefined, _RequestRet) -> agencyReply(undefined, _RequestRet) ->
ok. ok.
@ -65,7 +65,7 @@ agencyReply(undefined, _RequestId, TimerRef, _Reply) ->
ok; ok;
agencyReply(FormPid, RequestId, TimerRef, Reply) -> agencyReply(FormPid, RequestId, TimerRef, Reply) ->
agAgencyUtils:cancelTimer(TimerRef), agAgencyUtils:cancelTimer(TimerRef),
catch FormPid ! #miAgHttpCliRet{requestId = RequestId, reply = Reply},
catch FormPid ! #miRequestRet{requestId = RequestId, reply = Reply},
ok. ok.
-spec agencyReplyAll(term()) -> ok. -spec agencyReplyAll(term()) -> ok.

+ 15
- 12
src/httpCli/agHttpCli.erl 查看文件

@ -85,7 +85,6 @@ castAgency(PoolNameOrSocket, Method, Path, Headers, Body, Pid, IsSystem, Timeout
case getCurDbInfo(PoolNameOrSocket) of case getCurDbInfo(PoolNameOrSocket) of
{DbName, UserPassWord, Host, Protocol} -> {DbName, UserPassWord, Host, Protocol} ->
Request = agHttpProtocol:request(IsSystem, Body, Method, Host, DbName, Path, [UserPassWord | Headers]), Request = agHttpProtocol:request(IsSystem, Body, Method, Host, DbName, Path, [UserPassWord | Headers]),
io:format("IMY*******************************~n~p ~n", [Request]),
case Protocol of case Protocol of
tcp -> tcp ->
case gen_tcp:send(PoolNameOrSocket, Request) of case gen_tcp:send(PoolNameOrSocket, Request) of
@ -97,7 +96,7 @@ castAgency(PoolNameOrSocket, Method, Path, Headers, Body, Pid, IsSystem, Timeout
_ -> _ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}]) erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
end, end,
receiveTcpData(undefined, PoolNameOrSocket, TimerRef, binary:compile_pattern(<<"\r\n">>), binary:compile_pattern(<<"\r\n\r\n">>), Method == ?Head);
receiveTcpData(undefined, PoolNameOrSocket, TimerRef, binary:compile_pattern(<<"\r\n">>), binary:compile_pattern(<<"\r\n\r\n">>), Method == ?AgHead);
{error, Reason} = Err -> {error, Reason} = Err ->
?WARN(castAgency, ":gen_tcp send error: ~p ~n", [Reason]), ?WARN(castAgency, ":gen_tcp send error: ~p ~n", [Reason]),
disConnectDb(PoolNameOrSocket), disConnectDb(PoolNameOrSocket),
@ -113,7 +112,7 @@ castAgency(PoolNameOrSocket, Method, Path, Headers, Body, Pid, IsSystem, Timeout
_ -> _ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}]) erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
end, end,
receiveSslData(undefined, PoolNameOrSocket, TimerRef, binary:compile_pattern(<<"\r\n">>), binary:compile_pattern(<<"\r\n\r\n">>), Method == ?Head);
receiveSslData(undefined, PoolNameOrSocket, TimerRef, binary:compile_pattern(<<"\r\n">>), binary:compile_pattern(<<"\r\n\r\n">>), Method == ?AgHead);
{error, Reason} = Err -> {error, Reason} = Err ->
?WARN(castAgency, ":ssl send error: ~p ~n", [Reason]), ?WARN(castAgency, ":ssl send error: ~p ~n", [Reason]),
disConnectDb(PoolNameOrSocket), disConnectDb(PoolNameOrSocket),
@ -128,21 +127,25 @@ castAgency(PoolNameOrSocket, Method, Path, Headers, Body, Pid, IsSystem, Timeout
-spec receiveResponse(requestId(), reference()) -> term() | {error, term()}. -spec receiveResponse(requestId(), reference()) -> term() | {error, term()}.
receiveResponse(RequestId, MonitorRef) -> receiveResponse(RequestId, MonitorRef) ->
receive receive
#miAgHttpCliRet{requestId = RequestId, reply = Reply} ->
#miRequestRet{requestId = RequestId, reply = Reply} ->
erlang:demonitor(MonitorRef), erlang:demonitor(MonitorRef),
Reply;
case Reply of
{ok, Headers, Body} ->
{ok, Headers, jiffy:decode(Body, [return_maps])};
_ ->
Reply
end;
{'DOWN', MonitorRef, process, _Pid, Reason} -> {'DOWN', MonitorRef, process, _Pid, Reason} ->
{error, {agencyDown, Reason}} {error, {agencyDown, Reason}}
end. end.
-spec receiveTcpData(recvState() | undefined, socket(), reference() | undefined, binary:cp(), binary:cp(), boolean()) -> requestRet() | {error, term()}.
-spec receiveTcpData(recvState() | undefined, socket(), reference() | undefined, binary:cp(), binary:cp(), boolean()) -> {ok, term(), term()} | {error, term()}.
receiveTcpData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod) -> receiveTcpData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod) ->
receive receive
{tcp, Socket, Data} -> {tcp, Socket, Data} ->
io:format("IMY******************************* ~p ~n ", [Data]),
try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of
{done, #recvState{statusCode = StatusCode, contentLength = ContentLength, headers = Headers, body = Body}} ->
#requestRet{statusCode = StatusCode, contentLength = ContentLength, headers = Headers, body = Body};
{done, #recvState{headers = Headers, body = Body}} ->
{ok, Headers, jiffy:decode(Body, [return_maps])};
{ok, NewRecvState} -> {ok, NewRecvState} ->
receiveTcpData(NewRecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod); receiveTcpData(NewRecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod);
{error, Reason} -> {error, Reason} ->
@ -168,13 +171,13 @@ receiveTcpData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod) ->
receiveTcpData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod) receiveTcpData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod)
end. end.
-spec receiveSslData(recvState() | undefined, socket(), reference() | undefined, binary:cp(), binary:cp(), boolean()) -> requestRet() | {error, term()}.
-spec receiveSslData(recvState() | undefined, socket(), reference() | undefined, binary:cp(), binary:cp(), boolean()) -> {ok, term(), term()} | {error, term()}.
receiveSslData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod) -> receiveSslData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod) ->
receive receive
{ssl, Socket, Data} -> {ssl, Socket, Data} ->
try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of
{done, #recvState{statusCode = StatusCode, contentLength = ContentLength, body = Body}} ->
#requestRet{statusCode = StatusCode, contentLength = ContentLength, body = Body};
{done, #recvState{headers = Headers, body = Body}} ->
{ok, Headers, jiffy:decode(Body, [return_maps])};
{ok, NewRecvState} -> {ok, NewRecvState} ->
receiveTcpData(NewRecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod); receiveTcpData(NewRecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod);
{error, Reason} -> {error, Reason} ->

+ 4
- 6
src/httpCli/agHttpProtocol.erl 查看文件

@ -15,13 +15,13 @@
-spec request(boolean(), body(), method(), host(), binary(), path(), headers()) -> iolist(). -spec request(boolean(), body(), method(), host(), binary(), path(), headers()) -> iolist().
request(true, undefined, Method, Host, _DbName, Path, Headers) -> request(true, undefined, Method, Host, _DbName, Path, Headers) ->
[ [
Method, <<" ">>, Path, <<" HTTP/1.1\r\nHost: ">>, Host, <<"_db/_system">>,
Method, Path, <<" HTTP/1.1\r\nHost: ">>, Host, <<"_db/_system">>,
<<"\r\nContent-Type: application/json; charset=utf-8\r\nContent-Length: 0\r\n">>, <<"\r\nContent-Type: application/json; charset=utf-8\r\nContent-Length: 0\r\n">>,
spellHeaders(Headers), <<"\r\n">> spellHeaders(Headers), <<"\r\n">>
]; ];
request(false, undefined, Method, Host, DbName, Path, Headers) -> request(false, undefined, Method, Host, DbName, Path, Headers) ->
[ [
Method, <<" ">>, Path, <<" HTTP/1.1\r\nHost: ">>, Host, DbName,
Method, Path, <<" HTTP/1.1\r\nHost: ">>, Host, DbName,
<<"\r\nContent-Type: application/json; charset=utf-8\r\nContent-Length: 0\r\n">>, <<"\r\nContent-Type: application/json; charset=utf-8\r\nContent-Length: 0\r\n">>,
spellHeaders(Headers), <<"\r\n">> spellHeaders(Headers), <<"\r\n">>
]; ];
@ -29,8 +29,7 @@ request(false, Body, Method, Host, DbName, Path, Headers) ->
ContentLength = integer_to_binary(iolist_size(Body)), ContentLength = integer_to_binary(iolist_size(Body)),
NewHeaders = [{<<"Content-Length">>, ContentLength} | Headers], NewHeaders = [{<<"Content-Length">>, ContentLength} | Headers],
[ [
Method, <<" ">>, Path,
<<" HTTP/1.1\r\nHost: ">>, Host, DbName,
Method, Path, <<" HTTP/1.1\r\nHost: ">>, Host, DbName,
<<"\r\nContent-Type: application/json; charset=utf-8\r\n">>, <<"\r\nContent-Type: application/json; charset=utf-8\r\n">>,
spellHeaders(NewHeaders), <<"\r\n">>, Body spellHeaders(NewHeaders), <<"\r\n">>, Body
]; ];
@ -38,8 +37,7 @@ request(true, Body, Method, Host, _DbName, Path, Headers) ->
ContentLength = integer_to_binary(iolist_size(Body)), ContentLength = integer_to_binary(iolist_size(Body)),
NewHeaders = [{<<"Content-Length">>, ContentLength} | Headers], NewHeaders = [{<<"Content-Length">>, ContentLength} | Headers],
[ [
Method, <<" ">>, Path,
<<" HTTP/1.1\r\nHost: ">>, Host, <<"_db/_system">>,
Method, Path, <<" HTTP/1.1\r\nHost: ">>, Host, <<"_db/_system">>,
<<"\r\nContent-Type: application/json; charset=utf-8\r\n">>, <<"\r\nContent-Type: application/json; charset=utf-8\r\n">>,
spellHeaders(NewHeaders), <<"\r\n">>, Body spellHeaders(NewHeaders), <<"\r\n">>, Body
]. ].

+ 14
- 1
src/httpCli/agMiscUtils.erl 查看文件

@ -13,6 +13,7 @@
, randomElement/1 , randomElement/1
, toBinary/1 , toBinary/1
, spellQueryPars/1 , spellQueryPars/1
, lookHeader/2
]). ]).
-spec parseUrl(binary()) -> dbOpts() | {error, invalid_url}. -spec parseUrl(binary()) -> dbOpts() | {error, invalid_url}.
@ -104,4 +105,16 @@ spellQueryPars([{Key, Value}]) ->
spellQueryPars([{Key, Value} | Tail]) -> spellQueryPars([{Key, Value} | Tail]) ->
FirstBinary = <<"?", (toBinary(Key))/binary, "=", (toBinary(Value))/binary>>, FirstBinary = <<"?", (toBinary(Key))/binary, "=", (toBinary(Value))/binary>>,
TailBinary = <<<<"&", (toBinary(OtherKey))/binary, "=", (toBinary(OtherValue))/binary>> || {OtherKey, OtherValue} <- Tail>>, TailBinary = <<<<"&", (toBinary(OtherKey))/binary, "=", (toBinary(OtherValue))/binary>> || {OtherKey, OtherValue} <- Tail>>,
<<FirstBinary/binary, TailBinary/binary>>.
<<FirstBinary/binary, TailBinary/binary>>.
-spec lookHeader(binary, list()) -> binary().
lookHeader(_Header, []) ->
<<>>;
lookHeader(Header, [H | T]) ->
case binary:split(H, <<": ">>) of
[Header, Value] ->
Value;
_ ->
lookHeader(Header, T)
end.

+ 7
- 8
src/httpCli/agSslAgencyIns.erl 查看文件

@ -45,7 +45,7 @@ handleMsg(#miRequest{method = Method, path = Path, headers = Headers, body = Bod
_ -> _ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}]) erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
end, end,
{ok, SrvState, CliState#cliState{isHeadMethod = Method == ?Head, status = waiting, backlogNum = BacklogNum + 1, curInfo = {FromPid, RequestId, TimerRef}}};
{ok, SrvState, CliState#cliState{isHeadMethod = Method == ?AgHead, status = waiting, backlogNum = BacklogNum + 1, curInfo = {FromPid, RequestId, TimerRef}}};
{error, Reason} -> {error, Reason} ->
?WARN(ServerName, ":send error: ~p ~p ~p ~n", [Reason, FromPid, RequestId]), ?WARN(ServerName, ":send error: ~p ~p ~p ~n", [Reason, FromPid, RequestId]),
ssl:close(Socket), ssl:close(Socket),
@ -62,8 +62,8 @@ handleMsg({ssl, Socket, Data},
#srvState{serverName = ServerName, rn = Rn, rnrn = RnRn, socket = Socket} = SrvState, #srvState{serverName = ServerName, rn = Rn, rnrn = RnRn, socket = Socket} = SrvState,
#cliState{isHeadMethod = IsHeadMethod, backlogNum = BacklogNum, curInfo = CurInfo, requestsOut = RequestsOut, recvState = RecvState} = CliState) -> #cliState{isHeadMethod = IsHeadMethod, backlogNum = BacklogNum, curInfo = CurInfo, requestsOut = RequestsOut, recvState = RecvState} = CliState) ->
try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of
{done, #recvState{statusCode = StatusCode, contentLength = ContentLength, body = Body}} ->
agAgencyUtils:agencyReply(CurInfo, #requestRet{statusCode = StatusCode, contentLength = ContentLength, body = Body}),
{done, #recvState{headers = Headers, body = Body}} ->
agAgencyUtils:agencyReply(CurInfo, {ok, Headers, Body}),
case agAgencyUtils:getQueue(RequestsOut + 1) of case agAgencyUtils:getQueue(RequestsOut + 1) of
undefined -> undefined ->
{ok, SrvState, CliState#cliState{backlogNum = BacklogNum - 1, status = leisure, curInfo = undefined, recvState = undefined}}; {ok, SrvState, CliState#cliState{backlogNum = BacklogNum - 1, status = leisure, curInfo = undefined, recvState = undefined}};
@ -132,7 +132,6 @@ handleMsg(Msg, #srvState{serverName = ServerName} = SrvState, CliState) ->
terminate(_Reason, terminate(_Reason,
#srvState{socket = Socket} = SrvState, #srvState{socket = Socket} = SrvState,
CliState) -> CliState) ->
io:format("IMY*******************terminate ~p~n", [_Reason]),
{ok, NewSrvState, NewCliState} = overAllWork(SrvState, CliState), {ok, NewSrvState, NewCliState} = overAllWork(SrvState, CliState),
ssl:close(Socket), ssl:close(Socket),
agAgencyUtils:dealClose(NewSrvState, NewCliState, {error, shutdown}), agAgencyUtils:dealClose(NewSrvState, NewCliState, {error, shutdown}),
@ -178,7 +177,7 @@ overDealQueueRequest(#miRequest{method = Method, path = Path, headers = Headers,
_ -> _ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}]) erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
end, end,
overReceiveSslData(SrvState, CliState#cliState{isHeadMethod = Method == ?Head, status = waiting, requestsOut = RequestsOut + 1, curInfo = {FromPid, RequestId, TimerRef}});
overReceiveSslData(SrvState, CliState#cliState{isHeadMethod = Method == ?AgHead, status = waiting, requestsOut = RequestsOut + 1, curInfo = {FromPid, RequestId, TimerRef}});
{error, Reason} -> {error, Reason} ->
?WARN(ServerName, ":send error: ~p~n", [Reason]), ?WARN(ServerName, ":send error: ~p~n", [Reason]),
ssl:close(Socket), ssl:close(Socket),
@ -193,8 +192,8 @@ overReceiveSslData(#srvState{poolName = PoolName, serverName = ServerName, rn =
receive receive
{ssl, Socket, Data} -> {ssl, Socket, Data} ->
try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of
{done, #recvState{statusCode = StatusCode, contentLength = ContentLength, headers = Headers, body = Body}} ->
agAgencyUtils:agencyReply(CurInfo, #requestRet{statusCode = StatusCode, contentLength = ContentLength, headers = Headers, body = Body}),
{done, #recvState{headers = Headers, body = Body}} ->
agAgencyUtils:agencyReply(CurInfo, {ok, Headers, Body}),
case agAgencyUtils:getQueue(RequestsOut + 1) of case agAgencyUtils:getQueue(RequestsOut + 1) of
undefined -> undefined ->
{ok, SrvState, CliState#cliState{backlogNum = BacklogNum - 1, status = leisure, curInfo = undefined, recvState = undefined}}; {ok, SrvState, CliState#cliState{backlogNum = BacklogNum - 1, status = leisure, curInfo = undefined, recvState = undefined}};
@ -294,7 +293,7 @@ dealQueueRequest(#miRequest{method = Method, path = Path, headers = Headers, bod
_ -> _ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}]) erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
end, end,
{ok, SrvState, CliState#cliState{isHeadMethod = Method == ?Head, status = waiting, requestsOut = RequestsOut + 1, curInfo = {FromPid, RequestId, TimerRef}}};
{ok, SrvState, CliState#cliState{isHeadMethod = Method == ?AgHead, status = waiting, requestsOut = RequestsOut + 1, curInfo = {FromPid, RequestId, TimerRef}}};
{error, Reason} -> {error, Reason} ->
?WARN(ServerName, ":send error: ~p~n", [Reason]), ?WARN(ServerName, ":send error: ~p~n", [Reason]),
ssl:close(Socket), ssl:close(Socket),

+ 7
- 9
src/httpCli/agTcpAgencyIns.erl 查看文件

@ -36,7 +36,6 @@ handleMsg(#miRequest{method = Method, path = Path, headers = Headers, body = Bod
case Status of case Status of
leisure -> %% leisure -> %%
Request = agHttpProtocol:request(IsSystem, Body, Method, Host, DbName, Path, [UserPassWord | Headers]), Request = agHttpProtocol:request(IsSystem, Body, Method, Host, DbName, Path, [UserPassWord | Headers]),
io:format("IMY*******************************~n~p ~n", [Request]),
case gen_tcp:send(Socket, Request) of case gen_tcp:send(Socket, Request) of
ok -> ok ->
TimerRef = TimerRef =
@ -46,7 +45,7 @@ handleMsg(#miRequest{method = Method, path = Path, headers = Headers, body = Bod
_ -> _ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}]) erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
end, end,
{ok, SrvState, CliState#cliState{isHeadMethod = Method == ?Head, status = waiting, backlogNum = BacklogNum + 1, curInfo = {FromPid, RequestId, TimerRef}}};
{ok, SrvState, CliState#cliState{isHeadMethod = Method == ?AgHead, status = waiting, backlogNum = BacklogNum + 1, curInfo = {FromPid, RequestId, TimerRef}}};
{error, Reason} -> {error, Reason} ->
?WARN(ServerName, ":send error: ~p ~p ~p ~n", [Reason, FromPid, RequestId]), ?WARN(ServerName, ":send error: ~p ~p ~p ~n", [Reason, FromPid, RequestId]),
gen_tcp:close(Socket), gen_tcp:close(Socket),
@ -63,8 +62,8 @@ handleMsg({tcp, Socket, Data},
#srvState{serverName = ServerName, rn = Rn, rnrn = RnRn, socket = Socket} = SrvState, #srvState{serverName = ServerName, rn = Rn, rnrn = RnRn, socket = Socket} = SrvState,
#cliState{isHeadMethod = IsHeadMethod, backlogNum = BacklogNum, curInfo = CurInfo, requestsOut = RequestsOut, recvState = RecvState} = CliState) -> #cliState{isHeadMethod = IsHeadMethod, backlogNum = BacklogNum, curInfo = CurInfo, requestsOut = RequestsOut, recvState = RecvState} = CliState) ->
try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of
{done, #recvState{statusCode = StatusCode, contentLength = ContentLength, body = Body}} ->
agAgencyUtils:agencyReply(CurInfo, #requestRet{statusCode = StatusCode, contentLength = ContentLength, body = Body}),
{done, #recvState{headers = Headers, body = Body}} ->
agAgencyUtils:agencyReply(CurInfo, {ok, Headers, Body}),
case agAgencyUtils:getQueue(RequestsOut + 1) of case agAgencyUtils:getQueue(RequestsOut + 1) of
undefined -> undefined ->
{ok, SrvState, CliState#cliState{backlogNum = BacklogNum - 1, status = leisure, curInfo = undefined, recvState = undefined}}; {ok, SrvState, CliState#cliState{backlogNum = BacklogNum - 1, status = leisure, curInfo = undefined, recvState = undefined}};
@ -132,7 +131,6 @@ handleMsg(Msg, #srvState{serverName = ServerName} = SrvState, CliState) ->
terminate(_Reason, terminate(_Reason,
#srvState{socket = Socket} = SrvState, #srvState{socket = Socket} = SrvState,
CliState) -> CliState) ->
io:format("IMY*******************terminate ~p~n", [_Reason]),
{ok, NewSrvState, NewCliState} = overAllWork(SrvState, CliState), {ok, NewSrvState, NewCliState} = overAllWork(SrvState, CliState),
gen_tcp:close(Socket), gen_tcp:close(Socket),
agAgencyUtils:dealClose(NewSrvState, NewCliState, {error, shutdown}), agAgencyUtils:dealClose(NewSrvState, NewCliState, {error, shutdown}),
@ -178,7 +176,7 @@ overDealQueueRequest(#miRequest{method = Method, path = Path, headers = Headers,
_ -> _ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}]) erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
end, end,
overReceiveTcpData(SrvState, CliState#cliState{isHeadMethod = Method == ?Head, status = waiting, requestsOut = RequestsOut + 1, curInfo = {FromPid, RequestId, TimerRef}});
overReceiveTcpData(SrvState, CliState#cliState{isHeadMethod = Method == ?AgHead, status = waiting, requestsOut = RequestsOut + 1, curInfo = {FromPid, RequestId, TimerRef}});
{error, Reason} -> {error, Reason} ->
?WARN(ServerName, ":send error: ~p~n", [Reason]), ?WARN(ServerName, ":send error: ~p~n", [Reason]),
gen_tcp:close(Socket), gen_tcp:close(Socket),
@ -193,8 +191,8 @@ overReceiveTcpData(#srvState{poolName = PoolName, serverName = ServerName, rn =
receive receive
{tcp, Socket, Data} -> {tcp, Socket, Data} ->
try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of try agHttpProtocol:response(RecvState, Rn, RnRn, Data, IsHeadMethod) of
{done, #recvState{statusCode = StatusCode, contentLength = ContentLength, headers = Headers, body = Body}} ->
agAgencyUtils:agencyReply(CurInfo, #requestRet{statusCode = StatusCode, contentLength = ContentLength, headers = Headers, body = Body}),
{done, #recvState{headers = Headers, body = Body}} ->
agAgencyUtils:agencyReply(CurInfo, {ok, Headers, Body}),
case agAgencyUtils:getQueue(RequestsOut + 1) of case agAgencyUtils:getQueue(RequestsOut + 1) of
undefined -> undefined ->
{ok, SrvState, CliState#cliState{backlogNum = BacklogNum - 1, status = leisure, curInfo = undefined, recvState = undefined}}; {ok, SrvState, CliState#cliState{backlogNum = BacklogNum - 1, status = leisure, curInfo = undefined, recvState = undefined}};
@ -294,7 +292,7 @@ dealQueueRequest(#miRequest{method = Method, path = Path, headers = Headers, bod
_ -> _ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}]) erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
end, end,
{ok, SrvState, CliState#cliState{isHeadMethod = Method == ?Head, status = waiting, requestsOut = RequestsOut + 1, curInfo = {FromPid, RequestId, TimerRef}}};
{ok, SrvState, CliState#cliState{isHeadMethod = Method == ?AgHead, status = waiting, requestsOut = RequestsOut + 1, curInfo = {FromPid, RequestId, TimerRef}}};
{error, Reason} -> {error, Reason} ->
?WARN(ServerName, ":send error: ~p~n", [Reason]), ?WARN(ServerName, ":send error: ~p~n", [Reason]),
gen_tcp:close(Socket), gen_tcp:close(Socket),

src/httpCli/test.erl → src/user_default.erl 查看文件

@ -1,5 +1,7 @@
-module(test).
-module(user_default).
-include("agHttpCli.hrl").
-compile([export_all, nowarn_export_all]).
-compile([export_all, nowarn_export_all]). -compile([export_all, nowarn_export_all]).

正在加载...
取消
保存