You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2024/03/14 09:51:10 UTC

(skywalking-banyandb) 01/01: Add HTTP services to TopNAggregation operations

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch topnagg
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit 2648fd00e60c9d0cdc6f85d3f9301ef64e27911a
Author: Gao Hongtao <ha...@gmail.com>
AuthorDate: Thu Mar 14 09:45:47 2024 +0000

    Add HTTP services to TopNAggregation operations
    
    Signed-off-by: Gao Hongtao <ha...@gmail.com>
---
 CHANGES.md                               |  1 +
 api/proto/banyandb/database/v1/rpc.proto | 27 ++++++++++++++++++++++-----
 banyand/liaison/http/server.go           |  1 +
 docs/api-reference.md                    |  2 +-
 4 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 8d2d91f8..c3df6733 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -20,6 +20,7 @@ Release Notes.
   - Data ingestion and retrieval.
   - Flush memory data to disk.
   - Merge memory data and disk data.
+- Add HTTP services to TopNAggregation operations.
 
 ### Bugs
 
diff --git a/api/proto/banyandb/database/v1/rpc.proto b/api/proto/banyandb/database/v1/rpc.proto
index 09ffada3..a3429b7d 100644
--- a/api/proto/banyandb/database/v1/rpc.proto
+++ b/api/proto/banyandb/database/v1/rpc.proto
@@ -459,10 +459,27 @@ message TopNAggregationRegistryServiceExistResponse {
 }
 
 service TopNAggregationRegistryService {
-  rpc Create(TopNAggregationRegistryServiceCreateRequest) returns (TopNAggregationRegistryServiceCreateResponse);
-  rpc Update(TopNAggregationRegistryServiceUpdateRequest) returns (TopNAggregationRegistryServiceUpdateResponse);
-  rpc Delete(TopNAggregationRegistryServiceDeleteRequest) returns (TopNAggregationRegistryServiceDeleteResponse);
-  rpc Get(TopNAggregationRegistryServiceGetRequest) returns (TopNAggregationRegistryServiceGetResponse);
-  rpc List(TopNAggregationRegistryServiceListRequest) returns (TopNAggregationRegistryServiceListResponse);
+  rpc Create(TopNAggregationRegistryServiceCreateRequest) returns (TopNAggregationRegistryServiceCreateResponse) {
+    option (google.api.http) = {
+      post: "/v1/topn-agg/schema"
+      body: "*"
+    };
+  }
+  rpc Update(TopNAggregationRegistryServiceUpdateRequest) returns (TopNAggregationRegistryServiceUpdateResponse) {
+    option (google.api.http) = {
+      put: "/v1/topn-agg/schema/{top_n_aggregation.metadata.group}/{top_n_aggregation.metadata.name}"
+      body: "*"
+    };
+  }
+  rpc Delete(TopNAggregationRegistryServiceDeleteRequest) returns (TopNAggregationRegistryServiceDeleteResponse) {
+    option (google.api.http) = {delete: "/v1/topn-agg/schema/{metadata.group}/{metadata.name}"};
+  }
+  rpc Get(TopNAggregationRegistryServiceGetRequest) returns (TopNAggregationRegistryServiceGetResponse) {
+    option (google.api.http) = {get: "/v1/topn-agg/schema/{metadata.group}/{metadata.name}"};
+  }
+  rpc List(TopNAggregationRegistryServiceListRequest) returns (TopNAggregationRegistryServiceListResponse) {
+    option (google.api.http) = {get: "/v1/topn-agg/schema/lists/{group}"};
+  }
+  // Exist doesn't expose an HTTP endpoint. Please use HEAD method to touch Get instead
   rpc Exist(TopNAggregationRegistryServiceExistRequest) returns (TopNAggregationRegistryServiceExistResponse);
 }
diff --git a/banyand/liaison/http/server.go b/banyand/liaison/http/server.go
index e51cf77b..f1b10053 100644
--- a/banyand/liaison/http/server.go
+++ b/banyand/liaison/http/server.go
@@ -176,6 +176,7 @@ func (p *server) Serve() run.StopNotify {
 		databasev1.RegisterIndexRuleRegistryServiceHandlerFromEndpoint(ctx, gwMux, p.grpcAddr, opts),
 		databasev1.RegisterIndexRuleBindingRegistryServiceHandlerFromEndpoint(ctx, gwMux, p.grpcAddr, opts),
 		databasev1.RegisterGroupRegistryServiceHandlerFromEndpoint(ctx, gwMux, p.grpcAddr, opts),
+		databasev1.RegisterTopNAggregationRegistryServiceHandlerFromEndpoint(ctx, gwMux, p.grpcAddr, opts),
 		streamv1.RegisterStreamServiceHandlerFromEndpoint(ctx, gwMux, p.grpcAddr, opts),
 		measurev1.RegisterMeasureServiceHandlerFromEndpoint(ctx, gwMux, p.grpcAddr, opts),
 		propertyv1.RegisterPropertyServiceHandlerFromEndpoint(ctx, gwMux, p.grpcAddr, opts),
diff --git a/docs/api-reference.md b/docs/api-reference.md
index 0d7875e7..f61a6f80 100644
--- a/docs/api-reference.md
+++ b/docs/api-reference.md
@@ -2282,7 +2282,7 @@ Type determine the index structure under the hood
 | Delete | [TopNAggregationRegistryServiceDeleteRequest](#banyandb-database-v1-TopNAggregationRegistryServiceDeleteRequest) | [TopNAggregationRegistryServiceDeleteResponse](#banyandb-database-v1-TopNAggregationRegistryServiceDeleteResponse) |  |
 | Get | [TopNAggregationRegistryServiceGetRequest](#banyandb-database-v1-TopNAggregationRegistryServiceGetRequest) | [TopNAggregationRegistryServiceGetResponse](#banyandb-database-v1-TopNAggregationRegistryServiceGetResponse) |  |
 | List | [TopNAggregationRegistryServiceListRequest](#banyandb-database-v1-TopNAggregationRegistryServiceListRequest) | [TopNAggregationRegistryServiceListResponse](#banyandb-database-v1-TopNAggregationRegistryServiceListResponse) |  |
-| Exist | [TopNAggregationRegistryServiceExistRequest](#banyandb-database-v1-TopNAggregationRegistryServiceExistRequest) | [TopNAggregationRegistryServiceExistResponse](#banyandb-database-v1-TopNAggregationRegistryServiceExistResponse) |  |
+| Exist | [TopNAggregationRegistryServiceExistRequest](#banyandb-database-v1-TopNAggregationRegistryServiceExistRequest) | [TopNAggregationRegistryServiceExistResponse](#banyandb-database-v1-TopNAggregationRegistryServiceExistResponse) | Exist doesn&#39;t expose an HTTP endpoint. Please use HEAD method to touch Get instead |