From 02e13c90c1ccb1baf405a7253a77cce169480633 Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Tue, 31 Aug 2021 15:43:18 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ src/agApi/agCollections.erl | 26 +++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index bbaa8d4..83b9c81 100644 --- a/README.md +++ b/README.md @@ -42,4 +42,8 @@ Efficient, fast and easy to use. %% Then you can then invoke various apis using poolName as the first argument agMgrDb:curDbInfo(poolName). +# notice + 该驱动中所有的字符串 一律值 二进制的字符串 + QueryPars 和 Headers为map 其中的 key -> value 必须为字符串 + diff --git a/src/agApi/agCollections.erl b/src/agApi/agCollections.erl index 23bb650..866da38 100644 --- a/src/agApi/agCollections.erl +++ b/src/agApi/agCollections.erl @@ -181,7 +181,7 @@ collProps(PoolNameOrSocket, CollName) -> % 返回码 % 400:如果缺少集合名称,则返回HTTP 400。 % 404:如果集合名称未知,则 返回HTTP 404。 -collCount(PoolNameOrSocket, CollName) -> +collCnt(PoolNameOrSocket, CollName) -> Path = <<"/_api/collection/", CollName/binary, "/count">>, agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path). @@ -189,20 +189,29 @@ collCount(PoolNameOrSocket, CollName) -> % GET /_api/collection/{collection-name}/figures % 从版本3.4.0开始,不建议使用按其数字ID访问集合。您应该通过它们的名称来引用它们。 % 路径参数 -% collection-name(必填):集合的名称。 +% 集合名称(必需):集合的名称。 +% 查询参数 +% details (可选):设置details为true将向数字返回扩展存储引擎特定的详细信息。详细信息用于调试 ArangoDB 本身, +% 其格式可能会发生变化。默认情况下,details设置为false,因此不会返回任何详细信息,并且行为与之前版本的 ArangoDB 相同。 +% 请注意,请求details可能会导致额外的负载,从而影响性能。 % 除上述内容外,结果还包含文档数量和有关集合的其他统计信息。 % HTTP 200返回有关集合的信息: % count:集合中当前存在的文档数。 -% figures:收集指标 -% indexes: -% count:为集合定义的索引总数,包括预定义的索引(例如主索引)。 -% size:为索引分配的总内存,以字节为单位。 +% figures:集合的度量 +% indexes: +% count:为集合定义的索引总数,包括预定义的索引(例如主索引)。 +% size:为索引分配的总内存(以字节为单位)。 % 400:如果缺少集合名称,则返回HTTP 400。 % 404:如果集合名称未知,则 返回HTTP 404。 collFigures(PoolNameOrSocket, CollName) -> Path = <<"/_api/collection/", CollName/binary, "/figures">>, agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path). +collFigures(PoolNameOrSocket, CollName, QueryPars) -> + Path = <<"/_api/collection/", CollName/binary, "/figures">>, + agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars). + + % 返回负责文档的分片 % PUT /_api/collection/{collection-name}/responsibleShard % 路径参数 @@ -221,15 +230,14 @@ collFigures(PoolNameOrSocket, CollName) -> % eg: MapData = #{'_key' => testkey, value => 23} collResponsibleShard(PoolNameOrSocket, CollName, MapData) -> Path = <<"/_api/collection/", CollName/binary, "/responsibleShard">>, - BodyStr = eVPack:encodeBin(MapData), - agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, ?AgDefQuery, ?AgDefHeader, BodyStr). + agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, eVPack:encodeBin(MapData)). % 返回集合的分片ID % GET /_api/collection/{collection-name}/shards % 路径参数 % collection-name(必填):集合的名称。 % 查询参数 -% 详细信息(可选):如果设置为true,则返回值还将包含集合碎片的负责服务器。 +% details(可选):如果设置为true,则返回值还将包含集合碎片的负责服务器。 % 默认情况下,返回带有集合的分片ID的JSON数组。 % 如果details参数设置为true,它将返回一个以分片ID作为对象属性键的JSON对象,并将每个分片的负责服务器映射到它们。在详细的响应中,领导者碎片将排在阵列的首位。 % 注意:此方法仅在群集协调器中可用。