You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/10/10 11:52:23 UTC

[GitHub] [skywalking-banyandb] hanahmily commented on a change in pull request #55: Feat: metadata registry with embedded etcd

hanahmily commented on a change in pull request #55:
URL: https://github.com/apache/skywalking-banyandb/pull/55#discussion_r725626454



##########
File path: api/proto/banyandb/database/v1/rpc.proto
##########
@@ -0,0 +1,77 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+syntax = "proto3";
+
+option java_package = "org.apache.skywalking.banyandb.database.v1";
+option go_package = "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1";
+
+package banyandb.database.v1;
+
+import "banyandb/database/v1/schema.proto";
+import "banyandb/common/v1/common.proto";
+import "google/protobuf/struct.proto";
+
+// EntityType includes three kinds of entities (schema)
+// that can be create/delete/modified at runtime.
+enum EntityType {
+  ENTITY_TYPE_UNSPECIFIED = 0;
+  ENTITY_TYPE_STREAM = 1;
+  ENTITY_TYPE_INDEX_RULE_BINDING = 2;
+  ENTITY_TYPE_INDEX_RULE = 3;
+}
+
+// EntityCreateOrUpdateRequest is the request for creating
+// or updating entity.
+message EntityCreateOrUpdateRequest {
+  oneof entity {
+    banyandb.database.v1.Stream stream = 1;
+    banyandb.database.v1.IndexRuleBinding index_rule_binding = 2;
+    banyandb.database.v1.IndexRule index_rule = 3;
+  }
+}
+
+message EntityCreateOrUpdateResponse {
+}
+
+// GeneralEntityRequest can be used to delete, get entity
+// with the given entity_type and its metadata.
+message GeneralEntityRequest {
+  banyandb.common.v1.Metadata metadata = 1;
+  EntityType entity_type = 2;
+}
+
+message EntityDeleteResponse {
+}
+
+// EntityGetResponse is the response for Get method.
+// It contains an entity which is possibly nullable which
+// means the entity cannot be found
+message EntityGetResponse {
+  oneof entity {
+    google.protobuf.NullValue null = 1;
+    banyandb.database.v1.Stream stream = 2;
+    banyandb.database.v1.IndexRuleBinding index_rule_binding = 3;
+    banyandb.database.v1.IndexRule index_rule = 4;
+  }
+}
+
+service EntityRegistry {
+  rpc CreateOrUpdate(EntityCreateOrUpdateRequest) returns (EntityCreateOrUpdateResponse);

Review comment:
       We should split it to `Create` and `Update` as we can grant different permission to them once the auth sub-system is built. 

##########
File path: api/proto/banyandb/database/v1/rpc.proto
##########
@@ -0,0 +1,77 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+syntax = "proto3";
+
+option java_package = "org.apache.skywalking.banyandb.database.v1";
+option go_package = "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1";
+
+package banyandb.database.v1;
+
+import "banyandb/database/v1/schema.proto";
+import "banyandb/common/v1/common.proto";
+import "google/protobuf/struct.proto";
+
+// EntityType includes three kinds of entities (schema)
+// that can be create/delete/modified at runtime.
+enum EntityType {
+  ENTITY_TYPE_UNSPECIFIED = 0;
+  ENTITY_TYPE_STREAM = 1;
+  ENTITY_TYPE_INDEX_RULE_BINDING = 2;
+  ENTITY_TYPE_INDEX_RULE = 3;
+}
+
+// EntityCreateOrUpdateRequest is the request for creating
+// or updating entity.
+message EntityCreateOrUpdateRequest {
+  oneof entity {
+    banyandb.database.v1.Stream stream = 1;
+    banyandb.database.v1.IndexRuleBinding index_rule_binding = 2;
+    banyandb.database.v1.IndexRule index_rule = 3;
+  }
+}
+
+message EntityCreateOrUpdateResponse {
+}
+
+// GeneralEntityRequest can be used to delete, get entity
+// with the given entity_type and its metadata.
+message GeneralEntityRequest {
+  banyandb.common.v1.Metadata metadata = 1;
+  EntityType entity_type = 2;
+}
+
+message EntityDeleteResponse {
+}
+
+// EntityGetResponse is the response for Get method.
+// It contains an entity which is possibly nullable which
+// means the entity cannot be found
+message EntityGetResponse {
+  oneof entity {
+    google.protobuf.NullValue null = 1;
+    banyandb.database.v1.Stream stream = 2;
+    banyandb.database.v1.IndexRuleBinding index_rule_binding = 3;
+    banyandb.database.v1.IndexRule index_rule = 4;
+  }
+}
+
+service EntityRegistry {
+  rpc CreateOrUpdate(EntityCreateOrUpdateRequest) returns (EntityCreateOrUpdateResponse);
+  rpc Delete(GeneralEntityRequest) returns (EntityDeleteResponse);
+  rpc Get(GeneralEntityRequest) returns (EntityGetResponse);

Review comment:
       We need a `List` service which is helpful for observing the database. 

##########
File path: api/proto/banyandb/database/v1/rpc.proto
##########
@@ -0,0 +1,77 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+syntax = "proto3";
+
+option java_package = "org.apache.skywalking.banyandb.database.v1";
+option go_package = "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1";
+
+package banyandb.database.v1;
+
+import "banyandb/database/v1/schema.proto";
+import "banyandb/common/v1/common.proto";
+import "google/protobuf/struct.proto";
+
+// EntityType includes three kinds of entities (schema)
+// that can be create/delete/modified at runtime.
+enum EntityType {
+  ENTITY_TYPE_UNSPECIFIED = 0;
+  ENTITY_TYPE_STREAM = 1;
+  ENTITY_TYPE_INDEX_RULE_BINDING = 2;
+  ENTITY_TYPE_INDEX_RULE = 3;
+}
+
+// EntityCreateOrUpdateRequest is the request for creating
+// or updating entity.
+message EntityCreateOrUpdateRequest {
+  oneof entity {
+    banyandb.database.v1.Stream stream = 1;
+    banyandb.database.v1.IndexRuleBinding index_rule_binding = 2;
+    banyandb.database.v1.IndexRule index_rule = 3;
+  }
+}
+
+message EntityCreateOrUpdateResponse {
+}
+
+// GeneralEntityRequest can be used to delete, get entity
+// with the given entity_type and its metadata.
+message GeneralEntityRequest {
+  banyandb.common.v1.Metadata metadata = 1;
+  EntityType entity_type = 2;
+}
+
+message EntityDeleteResponse {
+}
+
+// EntityGetResponse is the response for Get method.
+// It contains an entity which is possibly nullable which
+// means the entity cannot be found
+message EntityGetResponse {
+  oneof entity {
+    google.protobuf.NullValue null = 1;
+    banyandb.database.v1.Stream stream = 2;
+    banyandb.database.v1.IndexRuleBinding index_rule_binding = 3;
+    banyandb.database.v1.IndexRule index_rule = 4;
+  }
+}
+
+service EntityRegistry {
+  rpc CreateOrUpdate(EntityCreateOrUpdateRequest) returns (EntityCreateOrUpdateResponse);
+  rpc Delete(GeneralEntityRequest) returns (EntityDeleteResponse);
+  rpc Get(GeneralEntityRequest) returns (EntityGetResponse);

Review comment:
       We should introduce the `Group` CURD service here. Other "entities" belong to a group. 

##########
File path: api/proto/banyandb/database/v1/rpc.proto
##########
@@ -0,0 +1,77 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+syntax = "proto3";
+
+option java_package = "org.apache.skywalking.banyandb.database.v1";
+option go_package = "github.com/apache/skywalking-banyandb/api/proto/banyandb/database/v1";
+
+package banyandb.database.v1;
+
+import "banyandb/database/v1/schema.proto";
+import "banyandb/common/v1/common.proto";
+import "google/protobuf/struct.proto";
+
+// EntityType includes three kinds of entities (schema)
+// that can be create/delete/modified at runtime.
+enum EntityType {
+  ENTITY_TYPE_UNSPECIFIED = 0;
+  ENTITY_TYPE_STREAM = 1;
+  ENTITY_TYPE_INDEX_RULE_BINDING = 2;
+  ENTITY_TYPE_INDEX_RULE = 3;
+}
+
+// EntityCreateOrUpdateRequest is the request for creating
+// or updating entity.
+message EntityCreateOrUpdateRequest {
+  oneof entity {
+    banyandb.database.v1.Stream stream = 1;
+    banyandb.database.v1.IndexRuleBinding index_rule_binding = 2;
+    banyandb.database.v1.IndexRule index_rule = 3;
+  }
+}
+
+message EntityCreateOrUpdateResponse {
+}
+
+// GeneralEntityRequest can be used to delete, get entity
+// with the given entity_type and its metadata.
+message GeneralEntityRequest {
+  banyandb.common.v1.Metadata metadata = 1;
+  EntityType entity_type = 2;
+}
+
+message EntityDeleteResponse {
+}
+
+// EntityGetResponse is the response for Get method.
+// It contains an entity which is possibly nullable which
+// means the entity cannot be found
+message EntityGetResponse {
+  oneof entity {
+    google.protobuf.NullValue null = 1;
+    banyandb.database.v1.Stream stream = 2;
+    banyandb.database.v1.IndexRuleBinding index_rule_binding = 3;
+    banyandb.database.v1.IndexRule index_rule = 4;
+  }
+}
+
+service EntityRegistry {

Review comment:
       I don't like this style. 
   
   It’s important to keep in our mind that APIs may change over time, and we don’t want to couple these separate RPC calls tightly together. If we re-use the same message object across RPC calls, some fields are set for one call but ignored for another.
   
   The server also has a more difficult time, as it needs to ignore certain fields 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org