diff --git a/grpc/java/BUILD b/grpc/java/BUILD index 52ffe6b6..6845efe2 100644 --- a/grpc/java/BUILD +++ b/grpc/java/BUILD @@ -3,6 +3,7 @@ # file, You can obtain one at https://mozilla.org/MPL/2.0/. package(default_visibility = ["//visibility:public"]) + load("@typedb_dependencies//tool/checkstyle:rules.bzl", "checkstyle_test") load("@rules_proto_grpc//java:defs.bzl", "java_grpc_library") @@ -12,8 +13,9 @@ java_grpc_library( "//proto:version-proto", "//proto/raft_service:raft-service", "//proto/raft_service:replication-proto", - "//proto/typedb_clustering_service:typedb-clustering-service", + "//proto/raft_service:request-proto", "//proto/typedb_clustering_service:typedb-clustering-proto", + "//proto/typedb_clustering_service:typedb-clustering-service", "//proto/typedb_service:answer-proto", "//proto/typedb_service:authentication-proto", "//proto/typedb_service:concept-proto", @@ -34,7 +36,7 @@ java_grpc_library( checkstyle_test( name = "checkstyle", + size = "small", include = glob(["*"]), license_type = "mpl-header", - size = "small", ) diff --git a/grpc/nodejs/BUILD b/grpc/nodejs/BUILD index 9814648d..e9abaae8 100644 --- a/grpc/nodejs/BUILD +++ b/grpc/nodejs/BUILD @@ -3,6 +3,7 @@ # file, You can obtain one at https://mozilla.org/MPL/2.0/. package(default_visibility = ["//visibility:public"]) + load("@typedb_dependencies//tool/checkstyle:rules.bzl", "checkstyle_test") load("@typedb_bazel_distribution//npm:rules.bzl", "assemble_npm", "deploy_npm") load("@typedb_dependencies//distribution:deployment.bzl", "deployment") @@ -14,7 +15,10 @@ load("//grpc/nodejs:rules.bzl", "ts_grpc_compile") npm_link_all_packages(name = "node_modules") -exports_files(["package.json", "pnpm-lock.yaml"]) +exports_files([ + "package.json", + "pnpm-lock.yaml", +]) load("@typedb_protocol_npm//grpc/nodejs:protoc-gen-ts/package_json.bzl", protoc_gen_ts_bin = "bin") @@ -28,8 +32,9 @@ ts_grpc_compile( "//proto:version-proto", "//proto/raft_service:raft-service", "//proto/raft_service:replication-proto", - "//proto/typedb_clustering_service:typedb-clustering-service", + "//proto/raft_service:request-proto", "//proto/typedb_clustering_service:typedb-clustering-proto", + "//proto/typedb_clustering_service:typedb-clustering-service", "//proto/typedb_service:answer-proto", "//proto/typedb_service:authentication-proto", "//proto/typedb_service:concept-proto", @@ -43,12 +48,14 @@ ts_grpc_compile( "//proto/typedb_service:transaction-proto", "//proto/typedb_service:typedb-service", "//proto/typedb_service:user-proto", - ] + ], ) ts_project( name = "typedb-protocol", srcs = [":typedb-protocol-src"], + declaration = True, + transpiler = "tsc", tsconfig = { "compilerOptions": { "target": "es2019", @@ -58,26 +65,27 @@ ts_project( }, "include": [ "proto", - ] + ], }, - declaration = True, + visibility = ["//visibility:public"], deps = [ ":node_modules/@grpc/grpc-js", - ":node_modules/google-protobuf", ":node_modules/@types/google-protobuf", ":node_modules/@types/node", + ":node_modules/google-protobuf", ":node_modules/typescript", ], - transpiler = "tsc", - visibility = ["//visibility:public"], ) npm_package( name = "typedb-protocol-package", - srcs = [":typedb-protocol", "package.json"], + srcs = [ + "package.json", + ":typedb-protocol", + ], + include_external_repositories = ["typedb_protocol"], include_runfiles = False, package = "typedb-protocol", - include_external_repositories = ["typedb_protocol"], visibility = ["//visibility:public"], ) @@ -88,18 +96,18 @@ assemble_npm( deploy_npm( name = "deploy-npm", - target = ":assemble-npm", - snapshot = deployment["npm"]["snapshot"], release = deployment["npm"]["release"], + snapshot = deployment["npm"]["snapshot"], + target = ":assemble-npm", ) checkstyle_test( name = "checkstyle", + size = "small", include = glob(["*"]), exclude = [ "package.json", "pnpm-lock.yaml", ], license_type = "mpl-header", - size = "small", ) diff --git a/grpc/rust/BUILD b/grpc/rust/BUILD index 7abd941d..b2f74709 100644 --- a/grpc/rust/BUILD +++ b/grpc/rust/BUILD @@ -14,8 +14,9 @@ rust_tonic_compile( "//proto:version-proto", "//proto/raft_service:raft-service", "//proto/raft_service:replication-proto", - "//proto/typedb_clustering_service:typedb-clustering-service", + "//proto/raft_service:request-proto", "//proto/typedb_clustering_service:typedb-clustering-proto", + "//proto/typedb_clustering_service:typedb-clustering-service", "//proto/typedb_service:answer-proto", "//proto/typedb_service:authentication-proto", "//proto/typedb_service:concept-proto", diff --git a/proto/raft_service/BUILD b/proto/raft_service/BUILD index 62000b0e..c9fc4f22 100644 --- a/proto/raft_service/BUILD +++ b/proto/raft_service/BUILD @@ -11,6 +11,7 @@ proto_library( srcs = ["raft_service.proto"], deps = [ ":replication-proto", + ":request-proto", ], ) @@ -20,6 +21,12 @@ proto_library( deps = [], ) +proto_library( + name = "request-proto", + srcs = ["request.proto"], + deps = [], +) + checkstyle_test( name = "checkstyle", size = "small", diff --git a/proto/raft_service/raft_service.proto b/proto/raft_service/raft_service.proto index 51886f28..d9346878 100644 --- a/proto/raft_service/raft_service.proto +++ b/proto/raft_service/raft_service.proto @@ -5,10 +5,12 @@ syntax = "proto3"; import "proto/raft_service/replication.proto"; +import "proto/raft_service/request.proto"; package typedb.protocol; // TODO: If the protocol is exposed, maybe it's actually `TypeDBRaft`? service Raft { rpc replication (Replication.Req) returns (Replication.Res); + rpc request (Request) returns (Request); } diff --git a/proto/raft_service/request.proto b/proto/raft_service/request.proto new file mode 100644 index 00000000..2296a367 --- /dev/null +++ b/proto/raft_service/request.proto @@ -0,0 +1,72 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +syntax = "proto3"; + +package typedb.protocol; + +message Request { + oneof request { + Load load = 1; + DatabaseManager database_manager = 2; + DatabaseCommit database_commit = 3; + UserManager user_manager = 4; + } + + message Load {} + + message DatabaseManager { + oneof database_manager { + All all = 1; + Get get = 2; + GetUnrestricted get_unrestricted = 3; + Create create = 4; + CreateUnrestricted create_unrestricted = 5; + Delete delete = 6; + } + + message All {} + message Get { string name = 1; } + message GetUnrestricted { string name = 1; } + message Create { string name = 1; } + message CreateUnrestricted { string name = 1; } + message Delete { string name = 1; } + } + + message DatabaseCommit { + oneof database_commit { + SchemaCommit schema = 1; + DataCommit data = 2; + } + + message SchemaCommit { + string name = 1; + bytes commit_record = 2; + } + + message DataCommit { + string name = 1; + bytes commit_record = 2; + } + } + + message UserManager { + oneof user_manager { + All all = 1; + Get get = 2; + Contains contains = 3; + Create create = 4; + Update update = 5; + Delete delete = 6; + } + + message All { string accessor = 1; } + message Get { string name = 1; string accessor = 2; } + message Contains { string name = 1; } + message Create { bytes commit_record = 1; } + message Update { bytes commit_record = 1; } + message Delete { bytes commit_record = 1; } + } +} +