Skip to content

Commit

Permalink
chore(notifications): WIP integrate tonic
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Jan 12, 2024
1 parent 6553ade commit bdef50e
Show file tree
Hide file tree
Showing 12 changed files with 759 additions and 14 deletions.
153 changes: 147 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ opentelemetry = { version = "0.20.0", features = ["trace", "rt-tokio"]}
opentelemetry-semantic-conventions = "0.12.0"
opentelemetry-http = "0.9.0"
http = "0.2.9"
tonic = "0.10.2"
prost = "0.12"
5 changes: 4 additions & 1 deletion core/notifications/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ rust_library(
"//third-party/rust:rand",
"//third-party/rust:uuid",
"//third-party/rust:serde_with",
"//third-party/rust:prost",
"//third-party/rust:tonic",
"//third-party/rust:tonic-build",
],
srcs = glob([
"src/**/*.rs",
Expand All @@ -75,7 +78,7 @@ rust_library(
]),
env = {
"CARGO_MANIFEST_DIR": ".",
"SQLX_OFFLINE": "true",
"SQLX_OFFLINE": "true"
}
)

Expand Down
5 changes: 5 additions & 0 deletions core/notifications/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ mongodb = { workspace = true }
rand = { workspace = true }
uuid = { workspace = true }
serde_with = { workspace = true }
tonic = { workspace = true }
prost = { workspace = true }

[build-dependencies]
tonic-build = { version = "0.10.2", features = ["prost"] }
7 changes: 7 additions & 0 deletions core/notifications/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rerun-if-changed=migrations");

// std::env::set_var("PROTOC", protobuf_src::protoc());
tonic_build::configure().compile(&["proto/notifications.proto"], &["proto"])?;
Ok(())
}
20 changes: 20 additions & 0 deletions core/notifications/proto/notifications.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package helloworld;

// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
string name = 1;
}

// The response message containing the greetings.
message HelloReply {
string message = 1;
}

5 changes: 5 additions & 0 deletions core/notifications/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ mod primitives;

pub mod cli;
pub mod graphql;

#[allow(clippy::all)]
pub mod proto {
tonic::include_proto!("helloworld");
}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
cargo-watch
reindeer
gitMinimal
protobuf
]
++ buck2NativeBuildInputs
++ lib.optionals pkgs.stdenv.isLinux [
Expand Down
Loading

0 comments on commit bdef50e

Please sign in to comment.