Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions grpc/java/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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",
Expand All @@ -34,7 +36,7 @@ java_grpc_library(

checkstyle_test(
name = "checkstyle",
size = "small",
include = glob(["*"]),
license_type = "mpl-header",
size = "small",
)
34 changes: 21 additions & 13 deletions grpc/nodejs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")

Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"],
)

Expand All @@ -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",
)
3 changes: 2 additions & 1 deletion grpc/rust/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions proto/raft_service/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ proto_library(
srcs = ["raft_service.proto"],
deps = [
":replication-proto",
":request-proto",
],
)

Expand All @@ -20,6 +21,12 @@ proto_library(
deps = [],
)

proto_library(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add these libs in all languages. Moreover, I remember that there is another place where you need to list all the proto files, please search for replication-proto and replication.proto usages. I might be wrong.
But this might be the reason why it does not build these files without introducing them into the service.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 00c2246

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stop checking Github on your holiday bro

name = "request-proto",
srcs = ["request.proto"],
deps = [],
)

checkstyle_test(
name = "checkstyle",
size = "small",
Expand Down
2 changes: 2 additions & 0 deletions proto/raft_service/raft_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without registering the endpoint, the Request message doesn't trigger code-generation. Find out why.

}
72 changes: 72 additions & 0 deletions proto/raft_service/request.proto
Original file line number Diff line number Diff line change
@@ -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; }
}
}