Procházet zdrojové kódy

agApi适配vst协议

master
SisMaker před 4 roky
rodič
revize
ab9eddd438
25 změnil soubory, kde provedl 251 přidání a 414 odebrání
  1. +2
    -3
      rebar.config
  2. +1
    -1
      src/agApi/agAdminMonitor.erl
  3. +1
    -1
      src/agApi/agAnalyzers.erl
  4. +2
    -2
      src/agApi/agAqls.erl
  5. +1
    -1
      src/agApi/agAsyncResultHandling.erl
  6. +9
    -12
      src/agApi/agBulkImportExport.erl
  7. +1
    -1
      src/agApi/agCluster.erl
  8. +4
    -4
      src/agApi/agCollections.erl
  9. +2
    -2
      src/agApi/agDbMgr.erl
  10. +22
    -36
      src/agApi/agDocuments.erl
  11. +2
    -3
      src/agApi/agEdges.erl
  12. +1
    -1
      src/agApi/agEndPoints.erl
  13. +24
    -63
      src/agApi/agFoxxServices.erl
  14. +66
    -90
      src/agApi/agGeneralGraphs.erl
  15. +6
    -6
      src/agApi/agHotBackup.erl
  16. +24
    -85
      src/agApi/agIndexes.erl
  17. +12
    -14
      src/agApi/agMiscFuns.erl
  18. +2
    -2
      src/agApi/agRepairJobs.erl
  19. +30
    -52
      src/agApi/agReplication.erl
  20. +5
    -5
      src/agApi/agTasks.erl
  21. +6
    -6
      src/agApi/agTransactions.erl
  22. +15
    -16
      src/agApi/agUserMgr.erl
  23. +7
    -7
      src/agApi/agViews.erl
  24. +5
    -0
      src/agVstCli/agVstCli.erl
  25. +1
    -1
      src/user_default.erl

+ 2
- 3
rebar.config Zobrazit soubor

@ -1,8 +1,7 @@
{erl_opts, [{i, "include"}]}.
{deps, [
{eVPack, {git, "http://192.168.0.88:53000/SisMaker/eVPack.git", {branch, master}}},
{jiffy, {git, "http://192.168.0.88:53000/SisMaker/jiffy.git", {branch, master}}},
{jsx, {git, "https://github.com/talentdeficit/jsx.git", {tag, "v3.0.0"}}}
{eVPack, {git, "http://192.168.0.88:53000/SisMaker/eVPack.git", {branch, master}}}
%%{jiffy, {git, "http://192.168.0.88:53000/SisMaker/jiffy.git", {branch, master}}}
]}.

+ 1
- 1
src/agApi/agAdminMonitor.erl Zobrazit soubor

@ -37,7 +37,7 @@ getAdminLog(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/log">>).
getAdminLog(PoolNameOrSocket, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/log">>, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/log">>, QueryPars).
%
% GET /_admin/log/level

+ 1
- 1
src/agApi/agAnalyzers.erl Zobrazit soubor

@ -78,4 +78,4 @@ delAnalyzer(PoolNameOrSocket, AnalyzerName) ->
delAnalyzer(PoolNameOrSocket, AnalyzerName, QueryPars) ->
Path = <<"/_api/analyzer/", AnalyzerName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).

+ 2
- 2
src/agApi/agAqls.erl Zobrazit soubor

@ -385,7 +385,7 @@ delUserFun(PoolNameOrSocket, UserFunName) ->
delUserFun(PoolNameOrSocket, UserFunName, QueryPars) ->
Path = <<"/_api/aqlfunction/", (agMiscUtils:toBinary(UserFunName))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
% AQL用户功能
% GET /_api/aqlfunction
@ -409,7 +409,7 @@ getUserFuns(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/aqlfunction">>).
getUserFuns(PoolNameOrSocket, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/aqlfunction">>, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/aqlfunction">>, QueryPars).

+ 1
- 1
src/agApi/agAsyncResultHandling.erl Zobrazit soubor

@ -104,7 +104,7 @@ delAsyncJobRet(PoolNameOrSocket, TypeOrJodId) ->
delAsyncJobRet(PoolNameOrSocket, TypeOrJodId, QueryPars) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(TypeOrJodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
%
% GET /_api/job/{job-id}

+ 9
- 12
src/agApi/agBulkImportExport.erl Zobrazit soubor

@ -58,9 +58,8 @@
% 409complete则返回 true
% 500500
docImport(PoolNameOrSocket, ListOfList, QueryPars) ->
Path = <<"/_api/import">>,
BodyStr = <<<<(eVPack:encodeBin(OneList))/binary, "\n">> || OneList <- ListOfList>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, QueryPars, ?AgDefHeader, BodyStr).
BodyStr = <<<<(jiffy:encode(OneList))/binary, "\n">> || OneList <- ListOfList>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/import">>, QueryPars, ?AgDefHeader, BodyStr).
% JSON导入文档
% POST /_api/import#json
@ -100,17 +99,15 @@ docImport(PoolNameOrSocket, ListOfList, QueryPars) ->
% 409complete则返回 true
% 500500
jsonImport(PoolNameOrSocket, MapDataList, QueryPars) ->
case lists:keyfind(type, 1, QueryPars) of
{type, list} ->
BodyStr = eVPack:encodeBin(MapDataList);
{type, documents} ->
BodyStr = <<<<(eVPack:encodeBin(OneList))/binary, "\n">> || OneList <- MapDataList>>;
case QueryPars of
#{type := list} ->
BodyStr = jiffy:encode(MapDataList);
#{type := documents} ->
BodyStr = <<<<(jiffy:encode(OneList))/binary, "\n">> || OneList <- MapDataList>>;
_ ->
BodyStr = MapDataList
end,
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/import", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/import">>, QueryPars, ?AgDefHeader, BodyStr).
% ------->
% JSON文档
@ -231,4 +228,4 @@ jsonImport(PoolNameOrSocket, MapDataList, QueryPars) ->
docExport(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/export?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).

+ 1
- 1
src/agApi/agCluster.erl Zobrazit soubor

@ -54,7 +54,7 @@ serverRole(PoolNameOrSocket) ->
% 400ID
% 403
clusterStats(PoolNameOrSocket, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/clusterStatistics">>, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/clusterStatistics">>, QueryPars).
%
% GET /_admin/cluster/health

+ 4
- 4
src/agApi/agCollections.erl Zobrazit soubor

@ -119,7 +119,7 @@ delColl(PoolNameOrSocket, CollName) ->
delColl(PoolNameOrSocket, CollName, QueryPars) ->
Path = <<"/_api/collection/", CollName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
%
% PUT /_api/collection/{collection-name}/truncate
@ -246,7 +246,7 @@ collShards(PoolNameOrSocket, CollName) ->
collShards(PoolNameOrSocket, CollName, QueryPars) ->
Path = <<"/_api/collection/", CollName/binary, "/shards">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars).
% ID
% GET /_api/collection/{collection-name}/revision
@ -288,7 +288,7 @@ collChecksum(PoolNameOrSocket, CollName) ->
collChecksum(PoolNameOrSocket, CollName, QueryPars) ->
Path = <<"/_api/collection/", CollName/binary, "/checksum">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars).
%
% GET /_api/collection
@ -303,7 +303,7 @@ collList(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/collection">>).
collList(PoolNameOrSocket, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/collection">>, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/collection">>, QueryPars).
%
% PUT /_api/collection/{collection-name}/load

+ 2
- 2
src/agApi/agDbMgr.erl Zobrazit soubor

@ -55,7 +55,7 @@ visitDbs(PoolNameOrSocket) ->
% 400
% 403_system数据库中执行
allDbs(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/database">>, ?AgDefQuery, ?AgDefHeader, ?AgDefBody, true).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/database">>, ?AgDefQuery, true).
%
% POST /_api/database
@ -95,4 +95,4 @@ newDb(PoolNameOrSocket, MapData) ->
% 404
delDb(PoolNameOrSocket, Name) ->
Path = <<"/_api/database/", Name/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, ?AgDefQuery, ?AgDefHeader, ?AgDefBody, true).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, ?AgDefQuery, true).

+ 22
- 36
src/agApi/agDocuments.erl Zobrazit soubor

@ -296,17 +296,15 @@ updateDoc(PoolNameOrSocket, CollName, Key, MapData, QueryPars, Headers) ->
% 412-match_rev属性中包含找到的文档的当前修订_id和_key
delDoc(PoolNameOrSocket, CollName, Key) ->
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
delDoc(PoolNameOrSocket, CollName, Key, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
delDoc(PoolNameOrSocket, CollName, Key, QueryPars, Headers) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, Headers, undefined).
Path = <<"/_api/document/", CollName/binary, "/", (agMiscUtils:toBinary(Key))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars, Headers, ?AgDefBody).
%
% ArangoDB支持批量处理文档 使API变体可使客户端分摊整批文档中的单个请求的开销ArangoDB
@ -330,23 +328,15 @@ delDoc(PoolNameOrSocket, CollName, Key, QueryPars, Headers) ->
% 404
% _rev条件不满足 使
getDocs(PoolNameOrSocket, CollName, KeyOrMapDataList) ->
QueryBinary = agMiscUtils:spellQueryPars([{onlyget, true}]),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(KeyOrMapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, #{<<"onlyget">> => <<"true">>}, ?AgDefHeader, BodyStr).
getDocs(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) ->
LastQueryPars =
case lists:keyfind(onlyget, 1, QueryPars) of
{onlyget, true} ->
QueryPars;
_ ->
lists:keystore(onlyget, 1, QueryPars, {onlyget, true})
end,
QueryBinary = agMiscUtils:spellQueryPars(LastQueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
LastQueryPars = QueryPars#{<<"onlyget">> => <<"true">>},
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(KeyOrMapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, LastQueryPars, ?AgDefHeader, BodyStr).
%
% POST /_api/document/{collection}#multiple
@ -381,13 +371,12 @@ getDocs(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) ->
newDocs(PoolNameOrSocket, CollName, MapDataList) ->
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
newDocs(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, QueryPars, ?AgDefHeader, BodyStr).
%
% PUT /_api/document/{collection}
@ -417,13 +406,12 @@ newDocs(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
replaceDocs(PoolNameOrSocket, CollName, MapDataList) ->
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
replaceDocs(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, QueryPars, ?AgDefHeader, BodyStr).
%
% PATCH /_api/document/{collection}
@ -456,13 +444,12 @@ replaceDocs(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
updateDocs(PoolNameOrSocket, CollName, MapDataList) ->
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
updateDocs(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, QueryPars, ?AgDefHeader, BodyStr).
%
% DELETE /_api/document/{collection}
@ -486,10 +473,9 @@ updateDocs(PoolNameOrSocket, CollName, MapDataList, QueryPars) ->
delDocs(PoolNameOrSocket, CollName, KeyOrMapDataList) ->
Path = <<"/_api/document/", CollName/binary, "/">>,
BodyStr = eVPack:encodeBin(KeyOrMapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, ?AgDefQuery, ?AgDefQuery, BodyStr).
delDocs(PoolNameOrSocket, CollName, KeyOrMapDataList, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/document/", CollName/binary, QueryBinary/binary>>,
Path = <<"/_api/document/", CollName/binary>>,
BodyStr = eVPack:encodeBin(KeyOrMapDataList),
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars, ?AgDefHeader, BodyStr).

+ 2
- 3
src/agApi/agEdges.erl Zobrazit soubor

@ -38,6 +38,5 @@
% 400
% 404
getEdges(PoolNameOrSocket, CollName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/edges/", CollName/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
Path = <<"/_api/edges/", CollName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars).

+ 1
- 1
src/agApi/agEndPoints.erl Zobrazit soubor

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

+ 24
- 63
src/agApi/agFoxxServices.erl Zobrazit soubor

@ -31,11 +31,10 @@
%
% 200
getFoxxList(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx">>).
getFoxxList(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx", QueryBinary/binary>>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx">>, QueryPars).
%
%
@ -55,9 +54,8 @@ getFoxxList(PoolNameOrSocket, QueryPars) ->
%
% 200
% 400
getFoxxService(PoolNameOrSocket, Mount) ->
Path = <<"/_api/foxx/service?mount=", (agMiscUtils:toBinary(Mount))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
getFoxxService(PoolNameOrSocket, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx/service">>, QueryPars).
%
% POST /_api/foxx
@ -83,10 +81,8 @@ getFoxxService(PoolNameOrSocket, Mount) ->
%
% 201
installFoxx(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx", QueryBinary/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/foxx">>, QueryPars, ?AgDefHeader, BodyStr).
%
% DELETE /_api/foxx/service
@ -98,9 +94,7 @@ installFoxx(PoolNameOrSocket, MapData, QueryPars) ->
%
% 204
uninstallFoxx(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/service", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_api/foxx/service">>, QueryPars).
%
% PUT /_api/foxx/service
@ -128,10 +122,8 @@ uninstallFoxx(PoolNameOrSocket, QueryPars) ->
%
% 200
replaceFoxx(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/service", QueryBinary/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/foxx/service">>, QueryPars, ?AgDefHeader, BodyStr).
%
% PATCH /_api/foxx/service
@ -159,10 +151,8 @@ replaceFoxx(PoolNameOrSocket, MapData, QueryPars) ->
%
% 200
upgradeFoxx(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/service", QueryBinary/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, <<"/_api/foxx/service">>, QueryPars, ?AgDefHeader, BodyStr).
% Foxx服务配置/
% Foxx服务配置和依赖关系的ArangoDB HTTP接口的简介
@ -176,9 +166,7 @@ upgradeFoxx(PoolNameOrSocket, MapData, QueryPars) ->
%
% 200
getFoxxConfig(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/configuration", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx/configuration">>, QueryPars).
%
% PATCH /_api/foxx/configuration
@ -191,10 +179,8 @@ getFoxxConfig(PoolNameOrSocket, QueryPars) ->
%
% 200
updateFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/configuration", QueryBinary/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, <<"/_api/foxx/configuration">>, QueryPars, ?AgDefHeader, BodyStr).
%
% PUT /_api/foxx/configuration
@ -207,10 +193,8 @@ updateFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
%
% 200
replaceFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/configuration", QueryBinary/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/foxx/configuration">>, QueryPars, ?AgDefHeader, BodyStr).
%
% GET /_api/foxx/dependencies
@ -221,9 +205,7 @@ replaceFoxxConfig(PoolNameOrSocket, MapData, QueryPars) ->
%
% 200
getFoxxDependencies(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx/dependencies">>, QueryPars).
%
@ -237,10 +219,8 @@ getFoxxDependencies(PoolNameOrSocket, QueryPars) ->
%
% 200
updateFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, <<"/_api/foxx/dependencies">>, QueryPars, ?AgDefHeader, BodyStr).
%
% PUT /_api/foxx/dependencies
@ -253,10 +233,8 @@ updateFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
%
% 200
replaceFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/dependencies", QueryBinary/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/foxx/dependencies">>, QueryPars, ?AgDefHeader, BodyStr).
% Foxx服务杂项
%
@ -269,9 +247,7 @@ replaceFoxxDependencies(PoolNameOrSocket, MapData, QueryPars) ->
%
% 200
getFoxxScripts(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/scripts", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx/scripts">>, QueryPars).
%
% POST /_api/foxx/scripts/{name}
@ -286,10 +262,9 @@ getFoxxScripts(PoolNameOrSocket, QueryPars) ->
%
% 200
runFoxxScripts(PoolNameOrSocket, ScriptName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/scripts/", ScriptName/binary, QueryBinary/binary>>,
Path = <<"/_api/foxx/scripts/", ScriptName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, QueryPars, ?AgDefHeader, BodyStr).
%
% POST /_api/foxx/tests
@ -313,9 +288,7 @@ runFoxxScripts(PoolNameOrSocket, ScriptName, MapData, QueryPars) ->
%
% 200
runFoxxTest(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/tests", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/foxx/tests">>, QueryPars).
%
% POST /_api/foxx/development
@ -327,9 +300,7 @@ runFoxxTest(PoolNameOrSocket, QueryPars) ->
%
% 200
enableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/development", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/foxx/development">>, QueryPars).
%
% DELETE /_api/foxx/development
@ -340,9 +311,7 @@ enableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
%
% 200
disableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/development", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_api/foxx/development">>, QueryPars).
%
% GET /_api/foxx/readme
@ -353,9 +322,7 @@ disableFoxxDevelopment(PoolNameOrSocket, QueryPars) ->
% 200
% 204
getFoxxReadme(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/readme", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx/readme">>, QueryPars).
%
% GET /_api/foxx/swagger
@ -366,9 +333,7 @@ getFoxxReadme(PoolNameOrSocket, QueryPars) ->
%
% 200
getFoxxSwagger(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/swagger", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/foxx/swagger">>, QueryPars).
%
% POST /_api/foxx/download
@ -381,9 +346,7 @@ getFoxxSwagger(PoolNameOrSocket, QueryPars) ->
% 200
% 400
downloadFoxxBundle(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/download", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/foxx/download">>, QueryPars).
%
% POST /_api/foxx/commit
@ -394,6 +357,4 @@ downloadFoxxBundle(PoolNameOrSocket, QueryPars) ->
%
% 204
commitFoxxState(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/foxx/commit", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/foxx/commit">>, QueryPars).

+ 66
- 90
src/agApi/agGeneralGraphs.erl Zobrazit soubor

@ -29,7 +29,7 @@
% isSmartSmartGraph
% smartGraphAttribute
graphList(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/gharial">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/gharial">>).
%
%
@ -78,13 +78,11 @@ graphList(PoolNameOrSocket) ->
% errorMessage
newGraph(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/gharial">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/gharial">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
newGraph(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial", QueryBinary/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/gharial">>, QueryPars, ?AgDefHeader, BodyStr).
%
% GET /_api/gharial/{graph}
@ -102,7 +100,7 @@ newGraph(PoolNameOrSocket, MapData, QueryPars) ->
% errorMessage
getGraph(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% DELETE /_api/gharial/{graph}
@ -126,12 +124,11 @@ getGraph(PoolNameOrSocket, GraphName) ->
% errorMessage
delGraph(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
delGraph(PoolNameOrSocket, GraphName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
Path = <<"/_api/gharial/", GraphName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
% 使
% GET /_api/gharial/{graph}/vertex
@ -149,7 +146,7 @@ delGraph(PoolNameOrSocket, GraphName, QueryPars) ->
% errorMessage
vertexCollList(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% POST /_api/gharial/{graph}/vertex
@ -186,7 +183,7 @@ vertexCollList(PoolNameOrSocket, GraphName) ->
addVertexColl(PoolNameOrSocket, GraphName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% DELETE /_api/gharial/{graph}/vertex/{collection}
@ -222,12 +219,11 @@ addVertexColl(PoolNameOrSocket, GraphName, MapData) ->
% errorMessage
delVertexColl(PoolNameOrSocket, GraphName, CollName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
delVertexColl(PoolNameOrSocket, GraphName, CollName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
%
% GET /_api/gharial/{graph}/edge
@ -245,7 +241,7 @@ delVertexColl(PoolNameOrSocket, GraphName, CollName, QueryPars) ->
% errorMessage
edgeDefList(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% POST /_api/gharial/{graph}/edge
@ -284,7 +280,7 @@ edgeDefList(PoolNameOrSocket, GraphName) ->
addEdgeDef(PoolNameOrSocket, GraphName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge">>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% PUT /_api/gharial/{graph}/edge/{definition}#definition
@ -328,13 +324,12 @@ addEdgeDef(PoolNameOrSocket, GraphName, MapData) ->
replaceEdgeDef(PoolNameOrSocket, GraphName, EdgeDefName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", EdgeDefName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
replaceEdgeDef(PoolNameOrSocket, GraphName, EdgeDefName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", EdgeDefName/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", EdgeDefName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, QueryPars, ?AgDefHeader, BodyStr).
%
% DELETE /_api/gharial/{graph}/edge/{definition}#definition
@ -366,12 +361,11 @@ replaceEdgeDef(PoolNameOrSocket, GraphName, EdgeDefName, MapData, QueryPars) ->
% errorMessage
delEdgeDef(PoolNameOrSocket, GraphName, EdgeDefName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", EdgeDefName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
delEdgeDef(PoolNameOrSocket, GraphName, EdgeDefName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", EdgeDefName/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", EdgeDefName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
%
@ -410,13 +404,12 @@ delEdgeDef(PoolNameOrSocket, GraphName, EdgeDefName, QueryPars) ->
newVertex(PoolNameOrSocket, GraphName, CollName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
newVertex(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, QueryPars, ?AgDefHeader, BodyStr).
%
% GET /_api/gharial/{graph}/vertex/{collection}/{vertex}
@ -461,17 +454,15 @@ newVertex(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
% errorMessage
getVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
getVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars).
getVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, QueryPars, Headers) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, Headers, undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars, Headers, ?AgDefBody).
%
% PATCH /_api/gharial/{graph}/vertex/{collection}/{vertex}
@ -524,19 +515,17 @@ getVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, QueryPars, Headers)
updateVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
updateVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, QueryPars, ?AgDefHeader, BodyStr).
updateVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, QueryPars, Headers) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, Headers, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, QueryPars, Headers, BodyStr).
%
% PUT /_api/gharial/{graph}/vertex/{collection}/{vertex}
@ -589,19 +578,17 @@ updateVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, QueryPar
replaceVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
replaceVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, QueryPars, ?AgDefHeader, BodyStr).
replaceVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, QueryPars, Headers) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, Headers, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, QueryPars, Headers, BodyStr).
%
% DELETE /_api/gharial/{graph}/vertex/{collection}/{vertex}
@ -647,17 +634,15 @@ replaceVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, QueryPa
% errorMessage
delVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
delVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
delVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, QueryPars, Headers) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, Headers, undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars, Headers, ?AgDefBody).
%
%
@ -705,13 +690,12 @@ delVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, QueryPars, Headers)
newEdge(PoolNameOrSocket, GraphName, CollName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
newEdge(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, QueryPars, ?AgDefHeader, BodyStr).
%
% GET /_api/gharial/{graph}/edge/{collection}/{edge}
@ -756,17 +740,15 @@ newEdge(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
% errorMessage
getEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
getEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars).
getEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, QueryPars, Headers) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, Headers, undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars, Headers, ?AgDefBody).
%
% PATCH /_api/gharial/{graph}/edge/{collection}/{edge}
@ -820,19 +802,17 @@ getEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, QueryPars, Headers) ->
updateEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
updateEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, QueryPars, ?AgDefHeader, BodyStr).
updateEdge(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>>,
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, Headers, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, QueryPars, Headers, BodyStr).
%
@ -888,19 +868,17 @@ updateEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, Que
replaceEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
replaceEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, QueryPars, ?AgDefHeader, BodyStr).
replaceEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, QueryPars, Headers) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, Headers, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, QueryPars, Headers, BodyStr).
%
% DELETE /_api/gharial/{graph}/edge/{collection}/{edge}
@ -946,16 +924,14 @@ replaceEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, QueryPars,
% errorMessage
delEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
delEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
delEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, Headers, undefined).
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars, Headers, ?AgDefBody).

+ 6
- 6
src/agApi/agHotBackup.erl Zobrazit soubor

@ -31,7 +31,7 @@
% 408HTTP 408
newBackup(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/create">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/create">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% POST /_admin/backup/restore
@ -43,7 +43,7 @@ newBackup(PoolNameOrSocket, MapData) ->
% 400使HTTP方法调用了restore命令POSTHTTP 400
restoreBackup(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/restore">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/restore">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% POST /_admin/backup/delete
@ -56,7 +56,7 @@ restoreBackup(PoolNameOrSocket, MapData) ->
% 404id找不到与该标识符相对应的备份
delBackup(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/delete">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/delete">>,?AgDefQuery, ?AgDefHeader, BodyStr).
%
% POST /_admin/backup/list
@ -69,7 +69,7 @@ delBackup(PoolNameOrSocket, MapData) ->
% 404id给出了ID或ID列表ID作为备份的标识符HTTP 404 NOT FOUND
% 405使HTTP方法调用了list命令POSTHTTP 405 METHOD NOT ALLOWED
getBackupList(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/list">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/list">>).
% list热备份的一个对象组成idid唯一地标识了特定的热备份version描绘了用于创建任何单个热备份的ArangoDB的版本datetime显示了创建热备份的时间
% sizeInBytesnrFiles的数量nrDBServers的数量访db服务器上找到的nrPiecesPresent
@ -94,7 +94,7 @@ getBackupList(PoolNameOrSocket) ->
% 404id uploadId
uploadBackup(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/upload">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/upload">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% POST /_admin/backup/download
@ -113,4 +113,4 @@ uploadBackup(PoolNameOrSocket, MapData) ->
% 404id downloadId
downloadBackup(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/download">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/backup/download">>, ?AgDefQuery, ?AgDefHeader, BodyStr).

+ 24
- 85
src/agApi/agIndexes.erl Zobrazit soubor

@ -58,7 +58,7 @@
% 404 HTTP 404
getIndexInfo(PoolNameOrSocket, IndexId) ->
Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% POST /_api/index#general
@ -85,10 +85,9 @@ getIndexInfo(PoolNameOrSocket, IndexId) ->
% 201 HTTP 201
% 400使HTTP 400
% 404HTTP 404
newIndex(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/index?collection=", CollName/binary>>,
newIndex(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, BodyStr).
%
% DELETE /_api/index/{index-id}
@ -100,7 +99,7 @@ newIndex(PoolNameOrSocket, CollName, MapData) ->
% 404index-id未知HTTP 404
delIndex(PoolNameOrSocket, IndexId) ->
Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
%
% GET /_api/index
@ -109,9 +108,8 @@ delIndex(PoolNameOrSocket, IndexId) ->
% 使
%
% 200JSON对象
getIndexList(PoolNameOrSocket, CollName) ->
Path = <<"/_api/index?collection=", CollName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
getIndexList(PoolNameOrSocket, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/index">>, QueryPars).
% 使
% /_api/simple/by-example则将使用该索引执行示例查询
@ -135,19 +133,10 @@ getIndexList(PoolNameOrSocket, CollName) ->
% 201 HTTP 201
% 400使HTTP 400
% 404HTTP 404
newIndexOfHash(PoolNameOrSocket, CollName, MapData) ->
case MapData of
#{type := <<"hash">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
#{<<"type">> := <<"hash">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ ->
{error, param}
end.
newIndexOfHash(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, BodyStr).
%
% PUT /_api/simple/by-example
@ -204,19 +193,9 @@ newIndexOfHash(PoolNameOrSocket, CollName, MapData) ->
% 201 HTTP 201
% 400HTTP 400
% 404HTTP 404
newIndexOfSkipList(PoolNameOrSocket, CollName, MapData) ->
case MapData of
#{type := <<"skiplist">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
#{<<"type">> := <<"skiplist">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
newIndexOfSkipList(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ ->
{error, param}
end.
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
% 使
% /_api/simple/range其他操作将使用该索引执行查询
@ -239,19 +218,9 @@ newIndexOfSkipList(PoolNameOrSocket, CollName, MapData) ->
% 201 HTTP 201
% 400HTTP 400
% 404HTTP 404
newIndexOfPersistent(PoolNameOrSocket, CollName, MapData) ->
case MapData of
#{type := <<"persistent">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
#{<<"type">> := <<"persistent">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ ->
{error, param}
end.
newIndexOfPersistent(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
% 使TTL
%
@ -269,19 +238,9 @@ newIndexOfPersistent(PoolNameOrSocket, CollName, MapData) ->
% 201 HTTP 201
% 400TTL索引HTTP 400TTL索引
% 404HTTP 404
newIndexOfTtl(PoolNameOrSocket, CollName, MapData) ->
case MapData of
#{type := <<"ttl">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
#{<<"type">> := <<"ttl">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ ->
{error, param}
end.
newIndexOfTtl(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
%
% POST /_api/index#geo
@ -301,19 +260,9 @@ newIndexOfTtl(PoolNameOrSocket, CollName, MapData) ->
% 200HTTP 200
% 201 HTTP 201
% 404HTTP 404
newIndexOfGeo(PoolNameOrSocket, CollName, MapData) ->
case MapData of
#{type := <<"geo">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
#{<<"type">> := <<"geo">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ ->
{error, param}
end.
newIndexOfGeo(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
%
%PUT /_api/simple/near
@ -373,19 +322,9 @@ newIndexOfGeo(PoolNameOrSocket, CollName, MapData) ->
% 200HTTP 200
% 201 HTTP 201
% 404HTTP 404
newIndexOfFulltext(PoolNameOrSocket, CollName, MapData) ->
case MapData of
#{type := <<"fulltext">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
#{<<"type">> := <<"fulltext">>} ->
Path = <<"/_api/index?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], BodyStr);
_ ->
{error, param}
end.
newIndexOfFulltext(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
%
%

+ 12
- 14
src/agApi/agMiscFuns.erl Zobrazit soubor

@ -56,7 +56,7 @@ srvVersion(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/version">>).
srvVersion(PoolNameOrSocket, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/version">>, QueryPars, ?AgDefHeader, ?AgDefBody).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/version">>, QueryPars).
%
% GET /_api/engine
@ -64,7 +64,7 @@ srvVersion(PoolNameOrSocket, QueryPars) ->
% HTTP 200
% mmfiles或rocksdb
srvEngine(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/engine">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/engine">>).
% WAL同步到磁盘
% PUT /_admin/wal/flush
@ -76,12 +76,10 @@ srvEngine(PoolNameOrSocket) ->
% 200
% 405使HTTP方法时返回
flushWal(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/flush">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/flush">>).
flushWal(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_admin/wal/flush", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/flush">>, QueryPars).
%
% GET /_admin/wal/properties
@ -97,7 +95,7 @@ flushWal(PoolNameOrSocket, QueryPars) ->
% 200
% 405使HTTP方法时返回
getWalProps(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/properties">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/properties">>).
% Wal的参数
% PUT /_admin/wal/properties
@ -114,7 +112,7 @@ getWalProps(PoolNameOrSocket) ->
% 405使HTTP方法时返回
setWalProps(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/properties">>, BodyStr, undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/properties">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% GET /_admin/wal/transactions
@ -126,7 +124,7 @@ setWalProps(PoolNameOrSocket, MapData) ->
% 200
% 405使HTTP方法时返回
getTransactions(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/transactions">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/transactions">>).
%
% GET /_admin/time
@ -136,7 +134,7 @@ getTransactions(PoolNameOrSocket) ->
% codeHTTP状态码
% timeUnix时间戳记为单位
curDbTime(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/time">>, #{}, #{}, <<>>).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/time">>).
%
%
@ -178,7 +176,7 @@ echo(PoolNameOrSocket, MapData) ->
%
% 200
targetVersion(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/database/target-version">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/database/target-version">>).
%
% DELETE /_admin/shutdown
@ -186,7 +184,7 @@ targetVersion(PoolNameOrSocket) ->
%
% 200OK都将返回
shutDown(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_admin/shutdown">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_admin/shutdown">>).
%
@ -201,7 +199,7 @@ shutDown(PoolNameOrSocket) ->
% 403ArangoDB不在集群模式下运行
% 404ArangoDB404
execute(PoolNameOrSocket, BodyStr) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/execute">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/execute">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% GET /_admin/status
@ -235,5 +233,5 @@ execute(PoolNameOrSocket, BodyStr) ->
%
% 200
dbStatus(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/status">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/status">>).

+ 2
- 2
src/agApi/agRepairJobs.erl Zobrazit soubor

@ -30,7 +30,7 @@
%%
%% GET /_admin/repairs/distributeShardsLike
checkRepair(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/repairs/distributeShardsLike">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/repairs/distributeShardsLike">>).
% collections<db>/<collection>error属性true如果该集合false error为trueerrorNum和 errorMessageerrorDetails
% POST /_admin/repairs/distributeShardsLike
@ -72,4 +72,4 @@ checkRepair(PoolNameOrSocket) ->
%%
%% POST /_admin/repairs/distributeShardsLike
doRepair(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/repairs/distributeShardsLike">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/repairs/distributeShardsLike">>).

+ 30
- 52
src/agApi/agReplication.erl Zobrazit soubor

@ -52,9 +52,7 @@
% 405使HTTP方法时返回
% 500500
getRepInventory(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/inventory", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/inventory">>, QueryPars).
%
%
@ -73,7 +71,7 @@ getRepInventory(PoolNameOrSocket, QueryPars) ->
% 405使HTTP方法时返回
newRepBatch(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/replication/batch">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/replication/batch">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
%
@ -89,7 +87,7 @@ newRepBatch(PoolNameOrSocket, MapData) ->
% 405使HTTP方法时返回
delRepBatch(PoolNameOrSocket, BatchId) ->
Path = <<"/_api/replication/batch/", (agMiscUtils:toBinary(BatchId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
%
%
@ -112,7 +110,7 @@ delRepBatch(PoolNameOrSocket, BatchId) ->
prolongRepBatch(PoolNameOrSocket, BatchId, MapData) ->
Path = <<"/_api/replication/batch/", (agMiscUtils:toBinary(BatchId))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
%
@ -142,9 +140,7 @@ prolongRepBatch(PoolNameOrSocket, BatchId, MapData) ->
% 405使HTTP方法时返回
% 500500
getRepDump(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/dump", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/dump">>, QueryPars).
% Merkle树以进行收集
% Merkle树
@ -180,9 +176,7 @@ getRepDump(PoolNameOrSocket, QueryPars) ->
% 500500
% 501使mmfiles调用或在不支持按版本同步的集合上返回
getRepTree(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/revisions/tree", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/revisions/tree">>, QueryPars).
% Merkle树
% Merkle树
@ -200,9 +194,7 @@ getRepTree(PoolNameOrSocket, QueryPars) ->
% 500500
% 501使mmfiles调用或在不支持按版本同步的集合上返回
resetRepTree(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/revisions/tree", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/replication/revisions/tree">>, QueryPars).
% ID
% ID
@ -213,9 +205,7 @@ resetRepTree(PoolNameOrSocket, QueryPars) ->
% batchId使ID
% resume
getRepRanges(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/revisions/ranges", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/revisions/ranges">>, QueryPars).
%
%
@ -244,9 +234,7 @@ getRepRanges(PoolNameOrSocket, QueryPars) ->
% 500500
% 501使mmfiles调用或在不支持按版本同步的集合上返回
getRepDoc(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/revisions/documents", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/revisions/documents">>, QueryPars).
%
%
@ -278,7 +266,7 @@ getRepDoc(PoolNameOrSocket, QueryPars) ->
% 501
startRepSync(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/sync">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/sync">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
%
@ -292,9 +280,7 @@ startRepSync(PoolNameOrSocket, MapData) ->
% 405使HTTP方法时返回
% 500500
getRepClusterInv(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/clusterInventory", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/clusterInventory">>, QueryPars).
%
% ArangoDB允许启动ArangoDB 2.2
@ -323,7 +309,7 @@ getRepClusterInv(PoolNameOrSocket, QueryPars) ->
% 405使HTTP方法时返回
% 500
getRepLoggerState(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-state">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-state">>).
%
@ -378,7 +364,7 @@ getRepLoggerState(PoolNameOrSocket) ->
% 500500
% 501
getRepLoggerFirstTick(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-first-tick">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-first-tick">>).
%
% GET /_api/replication/logger-tick-ranges
@ -394,7 +380,7 @@ getRepLoggerFirstTick(PoolNameOrSocket) ->
% 500
% 501
getRepLoggerTickRanges(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-tick-ranges">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/logger-tick-ranges">>).
%
% applier命令允许远程启动ArangoDB数据库复制应用程序的状态和配置
@ -433,11 +419,10 @@ getRepLoggerTickRanges(PoolNameOrSocket) ->
% 405使HTTP方法时返回
% 500500
getRepApplierConfig(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config">>).
getRepApplierConfig(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config", QueryBinary/binary>>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-config">>, QueryPars).
%
% PUT /_api/replication/applier-config
@ -475,12 +460,11 @@ getRepApplierConfig(PoolNameOrSocket, QueryPars) ->
% 500500
setRepApplierConfig(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
setRepApplierConfig(PoolNameOrSocket, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config", QueryBinary/binary>>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-config">>, QueryPars, ?AgDefHeader, BodyStr).
%
% PUT /_api/replication/applier-start
@ -496,12 +480,10 @@ setRepApplierConfig(PoolNameOrSocket, MapData, QueryPars) ->
% 405使HTTP方法时返回
% 500500
startRepApplier(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-start">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-start">>).
startRepApplier(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/replication/applier-start", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-start">>, QueryPars).
%
% PUT /_api/replication/applier-stop
@ -513,11 +495,10 @@ startRepApplier(PoolNameOrSocket, QueryPars) ->
% 405使HTTP方法时返回
% 500500
stopRepApplier(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop">>).
stopRepApplier(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop", QueryBinary/binary>>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/applier-stop">>, QueryPars).
%
% GET /_api/replication/applier-state
@ -559,11 +540,10 @@ stopRepApplier(PoolNameOrSocket, QueryPars) ->
% 405使HTTP方法时返回
% 500500
getRepApplierState(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state">>).
getRepApplierState(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state", QueryBinary/binary>>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/applier-state">>, QueryPars).
%
% PUT /_api/replication/make-slave
@ -632,7 +612,7 @@ getRepApplierState(PoolNameOrSocket, QueryPars) ->
% 501
changeRepMakeSlave(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/make-slave">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/replication/make-slave">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
%ID
@ -645,7 +625,7 @@ changeRepMakeSlave(PoolNameOrSocket, MapData) ->
%405使HTTP方法时返回
%500500
getRepServerId(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/server-id">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/replication/server-id">>).
% WAL
% 线
@ -662,7 +642,7 @@ getRepServerId(PoolNameOrSocket) ->
% 500
% 501
getWalRange(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/range">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/range">>).
%
%
@ -679,7 +659,7 @@ getWalRange(PoolNameOrSocket) ->
% 500500
% 501
getWalLastTick(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/lastTick">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/lastTick">>).
%
% GET /_api/wal/tail
@ -725,10 +705,8 @@ getWalLastTick(PoolNameOrSocket) ->
% 500500
% 501
getWalTail(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/tail">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/tail">>).
getWalTail(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/wal/tail", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/wal/tail">>, QueryPars).

+ 5
- 5
src/agApi/agTasks.erl Zobrazit soubor

@ -17,7 +17,7 @@
% HTTP 200
% **
getTaskList(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/tasks/">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/tasks/">>).
%
% GET /_api/tasks/{id}
@ -28,7 +28,7 @@ getTaskList(PoolNameOrSocket) ->
% **
getTask(PoolNameOrSocket, TaskId) ->
Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% POST /_api/tasks
@ -55,7 +55,7 @@ getTask(PoolNameOrSocket, TaskId) ->
% 400HTTP 400
newTask(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/tasks">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/tasks">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
% ID的新任务
% PUT /_api/tasks/{id}
@ -73,7 +73,7 @@ newTask(PoolNameOrSocket, MapData) ->
newTask(PoolNameOrSocket, TaskId, MapData) ->
Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% DELETE /_api/tasks/{id}
@ -89,4 +89,4 @@ newTask(PoolNameOrSocket, TaskId, MapData) ->
% errorMessage
delTask(PoolNameOrSocket, TaskId) ->
Path = <<"/_api/tasks/", (agMiscUtils:toBinary(TaskId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).

+ 6
- 6
src/agApi/agTransactions.erl Zobrazit soubor

@ -80,7 +80,7 @@
% 404使HTTP 404
beginTransaction(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/transaction/begin">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/transaction/begin">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% GET /_api/transaction/{transaction-id}
@ -95,7 +95,7 @@ beginTransaction(PoolNameOrSocket, MapData) ->
% 404使HTTP 404
getTransactionStatus(PoolNameOrSocket, TransactionId) ->
Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
% 使使
%
@ -123,7 +123,7 @@ getTransactionStatus(PoolNameOrSocket, TransactionId) ->
% 409使HTTP 409
commitTransaction(PoolNameOrSocket, TransactionId) ->
Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path).
%
% DELETE /_api/transaction/{transaction-id}
@ -149,7 +149,7 @@ commitTransaction(PoolNameOrSocket, TransactionId) ->
% 409HTTP 409
abortTransaction(PoolNameOrSocket, TransactionId) ->
Path = <<"/_api/transaction/", (agMiscUtils:toBinary(TransactionId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
%
% GET /_api/transaction
@ -160,7 +160,7 @@ abortTransaction(PoolNameOrSocket, TransactionId) ->
%
% 200HTTP 200
getTransactionList(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/transaction">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/transaction">>).
% JavaScript交易的HTTP接口
% ArangoDB的JS事务在服务器上执行
@ -198,7 +198,7 @@ getTransactionList(PoolNameOrSocket) ->
% 500使HTTP 500
executeTransaction(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/transaction">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/transaction">>, ?AgDefQuery, ?AgDefHeader, BodyStr).

+ 15
- 16
src/agApi/agUserMgr.erl Zobrazit soubor

@ -29,7 +29,7 @@
% 409
newUser(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/user">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/user">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
% 访
% PUT /_api/user/{user}/database/{dbname}
@ -49,7 +49,7 @@ newUser(PoolNameOrSocket, MapData) ->
setUserDbAccessLevel(PoolNameOrSocket, UserName, DbName, MapData) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
% 访
% PUT /_api/user/{user}/database/{dbname}/{collection}
@ -71,7 +71,7 @@ setUserDbAccessLevel(PoolNameOrSocket, UserName, DbName, MapData) ->
setUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName, MapData) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
% 访访
% DELETE /_api/user/{user}/database/{dbname}
@ -86,7 +86,7 @@ setUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName, MapData) ->
% 400JSON格式不正确或请求中缺少必需数据
clearUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
% 访访
% DELETE /_api/user/{user}/database/{dbname}/{collection}
@ -101,7 +101,7 @@ clearUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) ->
% 400
clearUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
% 访
% GET /_api/user/{user}/database/
@ -119,12 +119,11 @@ clearUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) ->
% 403访访
getUserDbList(PoolNameOrSocket, UserName) ->
Path = <<"/_api/user/", UserName/binary, "/database/">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
getUserDbList(PoolNameOrSocket, UserName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/user/", UserName/binary, "/database/", QueryBinary/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
Path = <<"/_api/user/", UserName/binary, "/database/">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars).
% 访
% GET /_api/user/{user}/database/{dbname}
@ -139,7 +138,7 @@ getUserDbList(PoolNameOrSocket, UserName, QueryPars) ->
% 403访访
getUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
% 访
% GET /_api/user/{user}/database/{dbname}/{collection}
@ -155,7 +154,7 @@ getUserDbAccessLevel(PoolNameOrSocket, UserName, DbName) ->
% 403访访
getUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) ->
Path = <<"/_api/user/", UserName/binary, "/database/", DbName/binary, "/", CollName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% PUT /_api/user/{user}
@ -175,7 +174,7 @@ getUserCollAccessLevel(PoolNameOrSocket, UserName, DbName, CollName) ->
replaceUser(PoolNameOrSocket, UserName, MapData) ->
Path = <<"/_api/user/", UserName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% PATCH /_api/user/{user}
@ -195,7 +194,7 @@ replaceUser(PoolNameOrSocket, UserName, MapData) ->
updateUser(PoolNameOrSocket, UserName, MapData) ->
Path = <<"/_api/user/", UserName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% DELETE /_api/user/{user}
@ -209,7 +208,7 @@ updateUser(PoolNameOrSocket, UserName, MapData) ->
% 404
delUser(PoolNameOrSocket, UserName) ->
Path = <<"/_api/user/", UserName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
%
% GET /_api/user/{user}
@ -223,7 +222,7 @@ delUser(PoolNameOrSocket, UserName) ->
% 404
getUser(PoolNameOrSocket, UserName) ->
Path = <<"/_api/user/", UserName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% GET /_api/user/
@ -237,4 +236,4 @@ getUser(PoolNameOrSocket, UserName) ->
% 401_system 访访
% 403访访
getUserList(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/user/">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/user/">>).

+ 7
- 7
src/agApi/agViews.erl Zobrazit soubor

@ -65,7 +65,7 @@
% 409name的视图HTTP 409
newView(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/view">>, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/view">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% GET /_api/view/{view-name}
@ -79,7 +79,7 @@ newView(PoolNameOrSocket, MapData) ->
% 404HTTP 404
getViewInfo(PoolNameOrSocket, ViewName) ->
Path = <<"/_api/view/", ViewName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% GET /_api/view
@ -90,7 +90,7 @@ getViewInfo(PoolNameOrSocket, ViewName) ->
%
% 200
getViewList(PoolNameOrSocket) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/view">>, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/view">>).
%
% GET /_api/view/{view-name}/properties
@ -103,7 +103,7 @@ getViewList(PoolNameOrSocket) ->
% 404HTTP 404
getViewProps(PoolNameOrSocket, ViewName) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
% ArangoSearch视图的所有属性
% PUT /_api/view/{view-name}/properties#ArangoSearch
@ -141,7 +141,7 @@ getViewProps(PoolNameOrSocket, ViewName) ->
changeViewAllProps(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
% ArangoSearch视图的属性
% PATCH /_api/view/{view-name}/properties#ArangoSearch
@ -179,7 +179,7 @@ changeViewAllProps(PoolNameOrSocket, ViewName, MapData) ->
changeViewPartProps(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
%
% PUT /_api/view/{view-name}/rename
@ -213,4 +213,4 @@ renameView(PoolNameOrSocket, ViewName, NewViewName) ->
% 404HTTP 404
delView(PoolNameOrSocket, ViewName) ->
Path = <<"/_api/view/", ViewName/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).

+ 5
- 0
src/agVstCli/agVstCli.erl Zobrazit soubor

@ -8,6 +8,7 @@
-export([
%% Common Request API
callAgency/3
, callAgency/4
, callAgency/6
, callAgency/7
, callAgency/8
@ -39,6 +40,10 @@
callAgency(PoolNameOrSocket, Method, Path) ->
callAgency(PoolNameOrSocket, Method, Path, #{}, #{}, <<>>, false, ?AgDefTimeout).
-spec callAgency(poolNameOrSocket(), method(), path(), queryPars()) -> term() | {error, term()}.
callAgency(PoolNameOrSocket, Method, Path, QueryPars) ->
callAgency(PoolNameOrSocket, Method, Path, QueryPars, #{}, <<>>, false, ?AgDefTimeout).
-spec callAgency(poolNameOrSocket(), method(), path(), queryPars(), headers(), body()) -> term() | {error, term()}.
callAgency(PoolNameOrSocket, Method, Path, QueryPars, Headers, Body) ->
callAgency(PoolNameOrSocket, Method, Path, QueryPars, Headers, Body, false, ?AgDefTimeout).

+ 1
- 1
src/user_default.erl Zobrazit soubor

@ -156,7 +156,7 @@ jd1(0, Fun, Bin) ->
?MODULE:Fun(Bin);
jd1(N, Fun, Bin) ->
?MODULE:Fun(Bin),
jd1(N - 1, Fun).
jd1(N - 1, Fun, Bin).
decodeJy1(Bin) ->
jiffy:decode(Bin, [return_maps]).

Načítá se…
Zrušit
Uložit