Parcourir la source

agMiscFuns.erl改进

erlArango_v1
AICells il y a 5 ans
Parent
révision
5746b86199
6 fichiers modifiés avec 252 ajouts et 247 suppressions
  1. +4
    -4
      src/agApi/agAqls.erl
  2. +2
    -2
      src/agApi/agCollections.erl
  3. +0
    -236
      src/agApi/agMiscFun.erl
  4. +241
    -0
      src/agApi/agMiscFuns.erl
  5. +3
    -3
      src/agApi/agViews.erl
  6. +2
    -2
      src/user_default.erl

+ 4
- 4
src/agApi/agAqls.erl Voir le fichier

@ -184,7 +184,7 @@ parseQuery(PoolNameOrSocket, MapData) ->
%
% 200
% 400HTTP 400
getQueryProperties(PoolNameOrSocket) ->
getQueryProps(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query/properties">>, [], undefined).
% AQL查询跟踪的配置
@ -201,7 +201,7 @@ getQueryProperties(PoolNameOrSocket) ->
%
% 200
% 400HTTP 400
changeQueryProperties(PoolNameOrSocket, MapData) ->
changeQueryProps(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/query/properties">>, [], BodyStr).
@ -306,7 +306,7 @@ clearQueryCaches(PoolNameOrSocket) ->
%
% 200
% 400HTTP 400
getQCacheProperties(PoolNameOrSocket) ->
getQCacheProps(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/properties">>, [], undefined).
% AQL查询结果缓存属性
@ -322,7 +322,7 @@ getQCacheProperties(PoolNameOrSocket) ->
%
% 200
% 400HTTP 400
changeQCacheProperties(PoolNameOrSocket, MapData) ->
changeQCacheProps(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/query-cache/properties">>, [], BodyStr).

+ 2
- 2
src/agApi/agCollections.erl Voir le fichier

@ -177,7 +177,7 @@ collInfo(PoolNameOrSocket, CollName) ->
% 400HTTP 400
% 404 HTTP 404
% HTTP 200
collProperties(PoolNameOrSocket, CollName) ->
collProps(PoolNameOrSocket, CollName) ->
Path = <<"/_api/collection/", (CollName)/binary, "/properties">>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
@ -419,7 +419,7 @@ collLoadIndexesIntoMemory(PoolNameOrSocket, CollName) ->
%
% 400HTTP 400
% 404 HTTP 404
collChangeProperties(PoolNameOrSocket, CollName, MapData) ->
collChangeProps(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/collection/", CollName/binary, "/properties">>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).

+ 0
- 236
src/agApi/agMiscFun.erl Voir le fichier

@ -1,236 +0,0 @@
-module(agMiscFun).
-include("erlArango.hrl").
-compile(inline).
-compile({inline_size, 128}).
-compile([export_all, nowarn_export_all]).
%% doc_address:https://www.arangodb.com/docs/stable/http/miscellaneous-functions.html
%
% GET /_api/version
%
% detailstruedetails属性ArangoDB版本而异
% JSON对象
% HTTP 200
% arango
% version major major和minor将是数字sub
% detailsJSON对象details查询参数设置为true时
% CPU体系结构64
% arm false-ARM cpu上运行
% asanasan地址清理器打开的情况下进行编译
% asm-crc32CRC函数吗
% =>
% boost-versionboost版本
% build-date
% build-repositorygit-ID
% 使
% cplusplusC ++
% debug false
%
% false
% fd-client-event-handler使fd-setlinux上进行
% fd-setsizefd setsize对于文件描述符的最大数目有效
% full-version-string
% icu-versionICU
% jemalloc 使jemalloctrue
% maintenanceer-mode false
% openssl-versionopenssl版本
% os- linuxwindows或darwin
% epoll TODO
% rockdb-versionrocksdb版本
% server-versionArangoDB发行版本
% sizeof int
% sizeof void * void指针的字节数
% sse42SSE 4.2CPU
% unaligned-access访
% v8版本V8 JavaScript引擎版本
% vpack-version使velocypack实现的版本
% zlib-versionzlib的版本
% -[ ]
% hostID
getSrvVersion(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/version">>, [], undefined).
getSrvVersion(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/version", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
%
% GET /_api/engine
% 使JSON对象
% HTTP 200
% mmfiles或rocksdb
getSrvEngine(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/engine">>, [], undefined).
% WAL同步到磁盘
% PUT /_admin/wal/flush
%
% waitForSync
% waitForCollectortrue可能会阻塞很长时间
%
%
% 200
% 405使HTTP方法时返回
flushWal(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/flush">>, [], undefined).
%
%
% GET /_admin/wal/properties
% JSON对象
% allowOversizeEntries
% logfileSize
% HistoricLogfiles
% reserveLogfilesArangoDB在后台分配的最大保留日志文件数
% syncInterval
% valveWait
% acceleratorWhenPending 0
%
% 200
% 405使HTTP方法时返回
getWalProperties(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/properties">>, [], undefined).
%
%
% PUT /_admin/wal/properties
% JSON对象
% allowOversizeEntries
% logfileSize
% HistoricLogfiles
% reserveLogfilesArangoDB在后台分配的最大保留日志文件数
% valveWait
% acceleratorWhenPending 0
%
%
% 200
% 405使HTTP方法时返回
setWalProperties(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/properties">>, BodyStr, undefined).
%
%
% GET /_admin/wal/transactions
% JSON对象
% runningTransactions
% minLastCollectedIDnull
% minLastSealedIDnull
%
% 200
% 405使HTTP方法时返回
getTransactions(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/transactions">>, [], undefined).
%
%
% GET /_admin/time
% time的对象Unix时间戳为单位
% HTTP 200
% errorfalse
% codeHTTP状态码
% timeUnix时间戳记为单位
getDbTime(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/time">>, [], undefined).
%
% POST /_admin/echo
%
%
%
% HTTP 200 Echo成功返回
%
%
% database
% urlURL
% ['http''https''velocystream']
%
% address
% port
% client
% IP地址
% porttcp连接的客户端端口
% idid
%
% prefix
% headersHTTP标头的列表
% requestTypePOST使HTTP-Verb/...
% requestBodyPOST正文的字符串化版本
%
% cookiescookie列表
%
% rawSuffix
% path
% rawRequestBody
echo(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/echo">>, [], undefined).
%
% GET /_admin/database/target-version
%
%
% 200
getTargetVersion(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/database/target-version">>, [], undefined).
%
% DELETE /_admin/shutdown
%
%
% 200OK都将返回
shutDown(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_admin/shutdown">>, [], undefined).
%
% POST /_admin/execute
%
%
% javascript代码作为不带参数的函数主体执行return语句 application / json返回returnAsJSON设置为 trueJSON对象JSON.stringify生成的字符串
% 使option启动服务器时API端点才会存在--javascript.allow-admin-execute true
% falseAPI端点
%
% 200application / json类型的主体returnAsJSON的不同json对象或纯字符串
% 403ArangoDB不在集群模式下运行
% 404ArangoDB404
execute(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/execute">>, [], BodyStr).
%
% GET /_admin/status
%
% 使
%
% arango
%
% version
%
% hostServerState
% serverInfo.role
% serverInfo.writeOpsEnabledtrue
% serverInfo.maintenancetrue
% agency.endpoints
%
% serverInfo.persistedIdide CRDN-e427b441-5087-4a9a-9983-2fb1682f3e2a
%
% serverInfo.state
% serverInfo.addresstcp// [:: 1]8530
% serverInfo.serverId CRDN-e427b441-5087-4a9a-9983-2fb1682f3e2a
%
% coordinator.foxxmasterfoxx主服务器的服务器ID
% coordinator.isFoxxmasterfoxx主服务器true
%
% agent.idID
% agent.leaderIdID
% agentLeading true
% agent.endpoint
% agent.term
%
% 200
getDbStatus(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/status">>, [], undefined).

+ 241
- 0
src/agApi/agMiscFuns.erl Voir le fichier

@ -0,0 +1,241 @@
-module(agMiscFuns).
-include("erlArango.hrl").
-compile(inline).
-compile({inline_size, 128}).
-compile([export_all, nowarn_export_all]).
%% doc_address:https://www.arangodb.com/docs/stable/http/miscellaneous-functions.html
% HTTP接口
% ArangoDB的其他功能的HTTP接口的概述
%
% GET /_api/version
%
% detailstruedetails属性ArangoDB版本而异
% JSON对象
% HTTP 200
% arango
% version major major和minor将是数字sub
% detailsJSON对象details查询参数设置为true时
% architectureCPU体系结构64
% arm false-ARM cpu上运行
% asanasan地址清理器打开的情况下进行编译
% asm-crc32CRC函数吗
% assertions=>
% boost-versionboost版本
% build-date
% build-repositorygit-ID
% compiler使
% cplusplusC ++
% debug false
% endianness
% failure-tests false
% fd-client-event-handler使fd-setlinux上进行
% fd-setsizefd setsize对于文件描述符的最大数目有效
% full-version-string
% icu-versionICU
% jemalloc 使jemalloctrue
% maintenanceer-mode false
% openssl-versionopenssl版本
% platformos- linuxwindows或darwin
% reactor-type epoll TODO
% rockdb-versionrocksdb版本
% server-versionArangoDB发行版本
% sizeof int
% sizeof void * void指针的字节数
% sse42SSE 4.2CPU
% unaligned-access访
% v8-versionV8 JavaScript引擎版本
% vpack-version使velocypack实现的版本
% zlib-versionzlib的版本
% mode-[ ]
% hostID
srvVersion(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/version">>, [], undefined).
srvVersion(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/version", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
%
% GET /_api/engine
% 使JSON对象
% HTTP 200
% mmfiles或rocksdb
srvEngine(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/engine">>, [], undefined).
% WAL同步到磁盘
% PUT /_admin/wal/flush
%
% waitForSync
% waitForCollectortrue可能会阻塞很长时间
%
%
% 200
% 405使HTTP方法时返回
flushWal(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/flush">>, [], undefined).
flushWal(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_admin/wal/flush", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
%
% GET /_admin/wal/properties
% JSON对象
% allowOversizeEntries
% logfileSize
% HistoricLogfiles
% reserveLogfilesArangoDB在后台分配的最大保留日志文件数
% syncInterval
% valveWait
% acceleratorWhenPending 0
%
% 200
% 405使HTTP方法时返回
getWalProps(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/properties">>, [], undefined).
% Wal的参数
% PUT /_admin/wal/properties
% JSON对象
% allowOversizeEntries
% logfileSize
% HistoricLogfiles
% reserveLogfilesArangoDB在后台分配的最大保留日志文件数
% valveWait
% acceleratorWhenPending 0
%
%
% 200
% 405使HTTP方法时返回
setWalProps(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_admin/wal/properties">>, BodyStr, undefined).
%
% GET /_admin/wal/transactions
% JSON对象
% runningTransactions
% minLastCollectedIDnull
% minLastSealedIDnull
%
% 200
% 405使HTTP方法时返回
getTransactions(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/wal/transactions">>, [], undefined).
%
% GET /_admin/time
% time的对象Unix时间戳为单位
% HTTP 200
% errorfalse
% codeHTTP状态码
% timeUnix时间戳记为单位
curDbTime(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/time">>, [], undefined).
%
%
% POST /_admin/echo
%
%
%
% HTTP 200 Echo成功返回
% authorized
% user
% database
% urlURL
% protocol['http''https''velocystream']
% server
% address
% port
% client
% addressIP地址
% porttcp连接的客户端端口
% idid
% internals
% prefix
% headersHTTP标头的列表
% requestTypePOST使HTTP-Verb/...
% requestBodyPOST正文的字符串化版本
% parameters
% cookiescookie列表
% suffix
% rawSuffix
% path
% rawRequestBody
echo(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/echo">>, [], BodyStr).
%
% GET /_admin/database/target-version
%
%
% 200
targetVersion(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/database/target-version">>, [], undefined).
%
% DELETE /_admin/shutdown
%
%
% 200OK都将返回
shutDown(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_admin/shutdown">>, [], undefined).
%
% POST /_admin/execute
%
%
% javascript代码作为不带参数的函数主体执行return语句 application / json返回returnAsJSON设置为 trueJSON对象JSON.stringify生成的字符串
% 使option启动服务器时API端点才会存在--javascript.allow-admin-execute true
% falseAPI端点
%
% 200application / json类型的主体returnAsJSON的不同json对象或纯字符串
% 403ArangoDB不在集群模式下运行
% 404ArangoDB404
execute(PoolNameOrSocket, BodyStr) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_admin/execute">>, [], BodyStr).
%
% GET /_admin/status
%
% 使
%
% serverarango
% license
% version
% mode
% hostServerState
% serverInfo.role
% serverInfo.writeOpsEnabledtrue
% serverInfo.maintenancetrue
% agency.endpoints
% agency
% serverInfo.persistedIdide CRDN-e427b441-5087-4a9a-9983-2fb1682f3e2a
%
% serverInfo.state
% serverInfo.addresstcp// [:: 1]8530
% serverInfo.serverId CRDN-e427b441-5087-4a9a-9983-2fb1682f3e2a
%
% coordinator.foxxmasterfoxx主服务器的服务器ID
% coordinator.isFoxxmasterfoxx主服务器true
%
% agent.idID
% agent.leaderIdID
% agentLeading true
% agent.endpoint
% agent.term
%
% 200
dbStatus(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_admin/status">>, [], undefined).

+ 3
- 3
src/agApi/agViews.erl Voir le fichier

@ -101,7 +101,7 @@ getViewList(PoolNameOrSocket) ->
%
% 400HTTP 400
% 404HTTP 404
getViewProperties(PoolNameOrSocket, ViewName) ->
getViewProps(PoolNameOrSocket, ViewName) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).
@ -138,7 +138,7 @@ getViewProperties(PoolNameOrSocket, ViewName) ->
%
% 400HTTP 400
% 404HTTP 404
changeViewAllProperties(PoolNameOrSocket, ViewName, MapData) ->
changeViewAllProps(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], BodyStr).
@ -176,7 +176,7 @@ changeViewAllProperties(PoolNameOrSocket, ViewName, MapData) ->
%
% 400HTTP 400
% 404HTTP 404
changeViewPartProperties(PoolNameOrSocket, ViewName, MapData) ->
changeViewPartProps(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, [], BodyStr).

+ 2
- 2
src/user_default.erl Voir le fichier

@ -19,10 +19,10 @@ tt(C, N) ->
%% /_api/database
test(0, StartTime) ->
agMiscFun:getDbTime(tt),
agMiscFuns:curDbTime(tt),
io:format("IMY******test over use time ~p~n", [erlang:system_time(millisecond) - StartTime]);
test(N, StartTime) ->
agMiscFun:getDbTime(tt),
agMiscFuns:curDbTime(tt),
test(N - 1, StartTime).
%% tt(C, N) ->

Chargement…
Annuler
Enregistrer