Kaynağa Gözat

代码调整

erlArango_v1
SisMaker 5 yıl önce
ebeveyn
işleme
9f2257d9df
32 değiştirilmiş dosya ile 322 ekleme ve 318 silme
  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 Dosyayı Görüntüle

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

+ 6
- 6
include/erlArango.hrl Dosyayı Görüntüle

@ -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 Dosyayı Görüntüle

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

+ 5
- 5
src/arangoApi/agAnalyzers.erl Dosyayı Görüntüle

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

+ 19
- 19
src/arangoApi/agAqlMod.erl Dosyayı Görüntüle

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

@ -48,7 +48,7 @@
% 404404x-arango-async-id HTTP标头
getAsyncJobRet(PoolNameOrSocket, JodId) ->
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标头
cancelAsyncJob(PoolNameOrSocket, JodId) ->
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
@ -86,7 +86,7 @@ delAsyncJobRet(PoolNameOrSocket, TypeOrJodId, Stamp) ->
_ ->
<<"/_api/job/", (agMiscUtils:toBinary(TypeOrJodId))/binary>>
end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
%
@ -100,7 +100,7 @@ delAsyncJobRet(PoolNameOrSocket, TypeOrJodId, Stamp) ->
% 404404
getAsyncJobStatus(PoolNameOrSocket, JodId) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
% ID
@ -115,9 +115,9 @@ getAsyncJobStatus(PoolNameOrSocket, JodId) ->
% 400type或值无效
getAsyncJobList(PoolNameOrSocket, Type) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
getAsyncJobList(PoolNameOrSocket, Type, Count) ->
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 Dosyayı Görüntüle

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

+ 5
- 5
src/arangoApi/agCluster.erl Dosyayı Görüntüle

@ -23,7 +23,7 @@
% 200
% 500
getServerId(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/server/id">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/id">>, [], undefined).
%
%GET /_admin/server/role
@ -40,7 +40,7 @@ getServerId(PoolNameOrSocket) ->
%errorNum
%[ SINGLEPRIMARYSECONDARYAGENTUNDEFINED ]
getServerRole(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/server/role">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/server/role">>, [], undefined).
% DBserver查询统计
%
@ -52,7 +52,7 @@ getServerRole(PoolNameOrSocket) ->
% 400ID
% 403
getClusterStatistics(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_admin/clusterStatistics">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/clusterStatistics">>, [], undefined).
%
%
@ -82,7 +82,7 @@ getClusterStatistics(PoolNameOrSocket) ->
% LastAckedTimeacked以秒为单位
% 200
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
% 504
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 Dosyayı Görüntüle

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

+ 5
- 5
src/arangoApi/agDbMgr.erl Dosyayı Görüntüle

@ -8,17 +8,17 @@
%% /_api/database/properties
%% GET /_api/database/current
curDbInfo(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/database/current">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/database/current">>, [], undefined).
%% 访
%% GET /_api/database/user
curVisitDbs(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/database/user">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/database/user">>, [], undefined).
%%
%% GET /_api/database
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) ->
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}
delDb(PoolNameOrSocket, Name) ->
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 Dosyayı Görüntüle

@ -20,11 +20,11 @@
% 412 If-Match412_rev属性中包含找到的文档的当前修订_id和_key
getDocument(PoolNameOrSocket, CollName, Key) ->
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) ->
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) ->
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) ->
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}
@ -82,13 +82,13 @@ getDocHead(PoolNameOrSocket, CollName, Key, Headers) ->
newDocument(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
newDocument(PoolNameOrSocket, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
%
% PUT /_api/document/{collection}/{key}
@ -126,13 +126,13 @@ newDocument(PoolNameOrSocket, CollName, MapData, QueryPars) ->
replaceDocument(PoolNameOrSocket, CollName, Key, MapData) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, Headers, BodyStr).
%
% PATCH /_api/document/{collection}/{key}
@ -173,13 +173,13 @@ replaceDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) ->
updateDocument(PoolNameOrSocket, CollName, Key, MapData) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
updateDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, Headers, BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, Headers, BodyStr).
%
% DELETE /_api/document/{collection}/{key}
@ -203,12 +203,12 @@ updateDocument(PoolNameOrSocket, CollName, Key, MapData, Headers, QueryPars) ->
delDocument(PoolNameOrSocket, CollName, Key) ->
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) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
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
@ -236,7 +236,7 @@ getDocuments(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
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) ->
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
newDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
%
% PUT /_api/document/{collection}
@ -308,13 +308,13 @@ newDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
replaceDocuments(PoolNameOrSocket, CollName, MapDataList) ->
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
%
% PATCH /_api/document/{collection}
@ -348,13 +348,13 @@ replaceDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
updateDocuments(PoolNameOrSocket, CollName, MapDataList) ->
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = jiffy:encode(MapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
updateDocuments(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
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) ->
Path = <<"/_api/document/", CollName/binary, "/">>,
BodyStr = jiffy:encode(KeyOrMapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], BodyStr).
delDocuments(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(KeyOrMapDataList),
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], BodyStr).

+ 1
- 1
src/arangoApi/agEdges.erl Dosyayı Görüntüle

@ -23,4 +23,4 @@
getEdges(PoolNameOrSocket, CollName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
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 Dosyayı Görüntüle

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

+ 23
- 23
src/arangoApi/agFoxxServices.erl Dosyayı Görüntüle

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

+ 36
- 36
src/arangoApi/agGeneralGraphs.erl Dosyayı Görüntüle

@ -23,7 +23,7 @@
% isSmartSmartGraph
% smartGraphAttribute
getGharialList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/gharial">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/gharial">>, [], undefined).
%
@ -68,7 +68,7 @@ getGharialList(PoolNameOrSocket) ->
% errorMessage
newGharial(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, <<"/_api/gharial">>, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/gharial">>, [], BodyStr).
newGharial(PoolNameOrSocket, MapData, WaitForSync) ->
Path =
@ -79,7 +79,7 @@ newGharial(PoolNameOrSocket, MapData, WaitForSync) ->
<<"/_api/gharial?waitForSync=false">>
end,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
%
% GET /_api/gharial/{graph}
@ -97,7 +97,7 @@ newGharial(PoolNameOrSocket, MapData, WaitForSync) ->
% errorMessage
getGharial(PoolNameOrSocket, GraphName) ->
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
delGharial(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delGharial(PoolNameOrSocket, GraphName, DropCollections) ->
Path =
@ -132,7 +132,7 @@ delGharial(PoolNameOrSocket, GraphName, DropCollections) ->
_ ->
<<"/_api/gharial/", GraphName/binary, "?dropCollections=false">>
end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% 使
@ -151,7 +151,7 @@ delGharial(PoolNameOrSocket, GraphName, DropCollections) ->
% errorMessage
getGharialVertexCollList(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
%
% POST /_api/gharial/{graph}/vertex
@ -188,7 +188,7 @@ getGharialVertexCollList(PoolNameOrSocket, GraphName) ->
addGharialVertexColl(PoolNameOrSocket, GraphName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
%
% DELETE /_api/gharial/{graph}/vertex/{collection}
@ -224,7 +224,7 @@ addGharialVertexColl(PoolNameOrSocket, GraphName, MapData) ->
% errorMessage
delGharialVertexColl(PoolNameOrSocket, GraphName, CollName) ->
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) ->
Path =
@ -234,7 +234,7 @@ delGharialVertexColl(PoolNameOrSocket, GraphName, CollName, DropCollection) ->
_ ->
<<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "?dropCollection=false">>
end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
%
@ -253,7 +253,7 @@ delGharialVertexColl(PoolNameOrSocket, GraphName, CollName, DropCollection) ->
% errorMessage
getGharialEdgeDefList(PoolNameOrSocket, GraphName) ->
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) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge">>,
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) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
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) ->
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) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
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) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
newGharialVertex(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, QueryBinary/binary>>,
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
getGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) ->
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) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
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) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
updateGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
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) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
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}
@ -642,12 +642,12 @@ replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData,
% errorMessage
delGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) ->
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) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
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) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
%
% GET /_api/gharial/{graph}/edge/{collection}/{edge}
@ -746,11 +746,11 @@ newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
% errorMessage
getGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) ->
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) ->
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) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
updateGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
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) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
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}
@ -919,11 +919,11 @@ replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Head
% errorMessage
delGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) ->
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) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
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 Dosyayı Görüntüle

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

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

+ 13
- 13
src/arangoApi/agMiscFun.erl Dosyayı Görüntüle

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

+ 2
- 2
src/arangoApi/agRepairJobs.erl Dosyayı Görüntüle

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

+ 30
- 30
src/arangoApi/agReplication.erl Dosyayı Görüntüle

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

+ 5
- 5
src/arangoApi/agTasks.erl Dosyayı Görüntüle

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

@ -38,7 +38,7 @@
% errorMessage
beginTransaction(PoolNameOrSocket, 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
getTransactionStatus(PoolNameOrSocket, TransactionId) ->
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
commitTransaction(PoolNameOrSocket, TransactionId) ->
Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
%
% DELETE /_api/transaction/{transaction-id}
@ -107,7 +107,7 @@ commitTransaction(PoolNameOrSocket, TransactionId) ->
% 409HTTP 409
abortTransaction(PoolNameOrSocket, TransactionId) ->
Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
%
% GET /_api/transaction
@ -118,7 +118,7 @@ abortTransaction(PoolNameOrSocket, TransactionId) ->
%
% 200HTTP 200
getTransactionList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/transaction">>, [], undefined).
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/transaction">>, [], undefined).
% JavaScript交易的HTTP接口
% ArangoDB的JS事务在服务器上执行
@ -155,7 +155,7 @@ getTransactionList(PoolNameOrSocket) ->
% 500使HTTP 500
executeTransaction(PoolNameOrSocket, 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 Dosyayı Görüntüle

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

+ 8
- 8
src/arangoApi/agViews.erl Dosyayı Görüntüle

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

+ 0
- 1
src/httpCli/agAgencyPoolMgrIns.erl Dosyayı Görüntüle

@ -42,7 +42,6 @@ handleMsg(_Msg, State) ->
{ok, 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_Agency),
agKvsToBeam:load(?agBeamPool, []),

+ 2
- 2
src/httpCli/agAgencyUtils.erl Dosyayı Görüntüle

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

+ 15
- 12
src/httpCli/agHttpCli.erl Dosyayı Görüntüle

@ -85,7 +85,6 @@ castAgency(PoolNameOrSocket, Method, Path, Headers, Body, Pid, IsSystem, Timeout
case getCurDbInfo(PoolNameOrSocket) of
{DbName, UserPassWord, Host, Protocol} ->
Request = agHttpProtocol:request(IsSystem, Body, Method, Host, DbName, Path, [UserPassWord | Headers]),
io:format("IMY*******************************~n~p ~n", [Request]),
case Protocol of
tcp ->
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}])
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 ->
?WARN(castAgency, ":gen_tcp send error: ~p ~n", [Reason]),
disConnectDb(PoolNameOrSocket),
@ -113,7 +112,7 @@ castAgency(PoolNameOrSocket, Method, Path, Headers, Body, Pid, IsSystem, Timeout
_ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
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 ->
?WARN(castAgency, ":ssl send error: ~p ~n", [Reason]),
disConnectDb(PoolNameOrSocket),
@ -128,21 +127,25 @@ castAgency(PoolNameOrSocket, Method, Path, Headers, Body, Pid, IsSystem, Timeout
-spec receiveResponse(requestId(), reference()) -> term() | {error, term()}.
receiveResponse(RequestId, MonitorRef) ->
receive
#miAgHttpCliRet{requestId = RequestId, reply = Reply} ->
#miRequestRet{requestId = RequestId, reply = Reply} ->
erlang:demonitor(MonitorRef),
Reply;
case Reply of
{ok, Headers, Body} ->
{ok, Headers, jiffy:decode(Body, [return_maps])};
_ ->
Reply
end;
{'DOWN', MonitorRef, process, _Pid, Reason} ->
{error, {agencyDown, Reason}}
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) ->
receive
{tcp, Socket, Data} ->
io:format("IMY******************************* ~p ~n ", [Data]),
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} ->
receiveTcpData(NewRecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod);
{error, Reason} ->
@ -168,13 +171,13 @@ receiveTcpData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod) ->
receiveTcpData(RecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod)
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) ->
receive
{ssl, Socket, Data} ->
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} ->
receiveTcpData(NewRecvState, Socket, TimerRef, Rn, RnRn, IsHeadMethod);
{error, Reason} ->

+ 4
- 6
src/httpCli/agHttpProtocol.erl Dosyayı Görüntüle

@ -15,13 +15,13 @@
-spec request(boolean(), body(), method(), host(), binary(), path(), headers()) -> iolist().
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">>,
spellHeaders(Headers), <<"\r\n">>
];
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">>,
spellHeaders(Headers), <<"\r\n">>
];
@ -29,8 +29,7 @@ request(false, Body, Method, Host, DbName, Path, Headers) ->
ContentLength = integer_to_binary(iolist_size(Body)),
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">>,
spellHeaders(NewHeaders), <<"\r\n">>, Body
];
@ -38,8 +37,7 @@ request(true, Body, Method, Host, _DbName, Path, Headers) ->
ContentLength = integer_to_binary(iolist_size(Body)),
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">>,
spellHeaders(NewHeaders), <<"\r\n">>, Body
].

+ 14
- 1
src/httpCli/agMiscUtils.erl Dosyayı Görüntüle

@ -13,6 +13,7 @@
, randomElement/1
, toBinary/1
, spellQueryPars/1
, lookHeader/2
]).
-spec parseUrl(binary()) -> dbOpts() | {error, invalid_url}.
@ -104,4 +105,16 @@ spellQueryPars([{Key, Value}]) ->
spellQueryPars([{Key, Value} | Tail]) ->
FirstBinary = <<"?", (toBinary(Key))/binary, "=", (toBinary(Value))/binary>>,
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 Dosyayı Görüntüle

@ -45,7 +45,7 @@ handleMsg(#miRequest{method = Method, path = Path, headers = Headers, body = Bod
_ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
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} ->
?WARN(ServerName, ":send error: ~p ~p ~p ~n", [Reason, FromPid, RequestId]),
ssl:close(Socket),
@ -62,8 +62,8 @@ handleMsg({ssl, Socket, Data},
#srvState{serverName = ServerName, rn = Rn, rnrn = RnRn, socket = Socket} = SrvState,
#cliState{isHeadMethod = IsHeadMethod, backlogNum = BacklogNum, curInfo = CurInfo, requestsOut = RequestsOut, recvState = RecvState} = CliState) ->
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
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,
#srvState{socket = Socket} = SrvState,
CliState) ->
io:format("IMY*******************terminate ~p~n", [_Reason]),
{ok, NewSrvState, NewCliState} = overAllWork(SrvState, CliState),
ssl:close(Socket),
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}])
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} ->
?WARN(ServerName, ":send error: ~p~n", [Reason]),
ssl:close(Socket),
@ -193,8 +192,8 @@ overReceiveSslData(#srvState{poolName = PoolName, serverName = ServerName, rn =
receive
{ssl, Socket, Data} ->
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
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}])
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} ->
?WARN(ServerName, ":send error: ~p~n", [Reason]),
ssl:close(Socket),

+ 7
- 9
src/httpCli/agTcpAgencyIns.erl Dosyayı Görüntüle

@ -36,7 +36,6 @@ handleMsg(#miRequest{method = Method, path = Path, headers = Headers, body = Bod
case Status of
leisure -> %%
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
ok ->
TimerRef =
@ -46,7 +45,7 @@ handleMsg(#miRequest{method = Method, path = Path, headers = Headers, body = Bod
_ ->
erlang:start_timer(OverTime, self(), waiting_over, [{abs, true}])
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} ->
?WARN(ServerName, ":send error: ~p ~p ~p ~n", [Reason, FromPid, RequestId]),
gen_tcp:close(Socket),
@ -63,8 +62,8 @@ handleMsg({tcp, Socket, Data},
#srvState{serverName = ServerName, rn = Rn, rnrn = RnRn, socket = Socket} = SrvState,
#cliState{isHeadMethod = IsHeadMethod, backlogNum = BacklogNum, curInfo = CurInfo, requestsOut = RequestsOut, recvState = RecvState} = CliState) ->
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
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,
#srvState{socket = Socket} = SrvState,
CliState) ->
io:format("IMY*******************terminate ~p~n", [_Reason]),
{ok, NewSrvState, NewCliState} = overAllWork(SrvState, CliState),
gen_tcp:close(Socket),
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}])
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} ->
?WARN(ServerName, ":send error: ~p~n", [Reason]),
gen_tcp:close(Socket),
@ -193,8 +191,8 @@ overReceiveTcpData(#srvState{poolName = PoolName, serverName = ServerName, rn =
receive
{tcp, Socket, Data} ->
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
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}])
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} ->
?WARN(ServerName, ":send error: ~p~n", [Reason]),
gen_tcp:close(Socket),

src/httpCli/test.erl → src/user_default.erl Dosyayı Görüntüle

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

Yükleniyor…
İptal
Kaydet