Skip to content

Commit 6e0ede6

Browse files
committed
add: protobuf modules
1 parent fa21bb5 commit 6e0ede6

File tree

9 files changed

+46
-79
lines changed

9 files changed

+46
-79
lines changed

Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ serde = { version = "1.0.217", features = ["derive"] }
88
serde_json = "1.0.134"
99
thiserror = "2.0.9"
1010
tracing = "0.1.41"
11-
unix-named-pipe = "0.2.0"
11+
tonic = "0.12.3"
12+
tokio = { version = "1.28.2", features = ["full"] }
13+
prost = "0.13.4"
14+
15+
[build-dependencies]
16+
tonic-build = "0.12.3"
1217

1318
[dev-dependencies]
14-
bottles-core = { path = "." }
1519
tracing-subscriber = "0.3.19"

build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use std::error::Error;
2+
3+
fn main() -> Result<(), Box<dyn Error>> {
4+
tonic_build::compile_protos("proto/bottles.proto")?;
5+
tonic_build::compile_protos("proto/winebridge.proto")?;
6+
Ok(())
7+
}

examples/cli.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

proto/bottles.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
syntax = "proto3";
2+
3+
package bottles;
4+
5+
service Bottles {
6+
rpc Health (BottlesRequest) returns (BottlesResponse);
7+
}
8+
9+
message BottlesRequest {}
10+
11+
message BottlesResponse {
12+
bool ok = 1;
13+
}

proto/winebridge.proto

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
syntax = "proto3";
2+
3+
package winebridge;
4+
5+
service WineBridge {
6+
rpc Message (MessageRequest) returns (MessageResponse);
7+
}
8+
9+
message MessageRequest {
10+
string message = 1;
11+
}
12+
13+
message MessageResponse {
14+
bool success = 1;
15+
}

src/error.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
extern crate unix_named_pipe;
2-
31
use thiserror::Error;
42

53
#[derive(Error, Debug)]
@@ -8,8 +6,4 @@ pub enum Error {
86
Io(#[from] std::io::Error),
97
#[error("Serde: {0}")]
108
Serde(#[from] serde_json::Error),
11-
#[error("Failed to create named pipe")]
12-
NamedPipeError,
13-
#[error("Failed to connect to bridge, be sure to call .connect() first")]
14-
ConnectToBridgeError,
159
}

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
mod error;
2-
mod wine;
32
pub use error::Error;
4-
pub use wine::bridge::{Payload, WineBridge, WineBridgeAction};
3+
4+
pub mod proto {
5+
tonic::include_proto!("winebridge");
6+
tonic::include_proto!("bottles");
7+
}

src/wine/bridge.rs

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/wine/mod.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)