Change summary
zed-rpc/proto/zed.proto | 36 +++++++++++++++++++++++++++++++++---
zed-rpc/src/proto.rs | 15 +++++++++++++--
2 files changed, 46 insertions(+), 5 deletions(-)
Detailed changes
@@ -6,22 +6,52 @@ message FromClient {
oneof variant {
Auth auth = 2;
+ NewWorktree new_worktree = 3;
+ ShareWorktree share_worktree = 4;
+ UploadFile upload_file = 5;
}
message Auth {
int32 user_id = 1;
string access_token = 2;
}
+
+ message NewWorktree {}
+
+ message ShareWorktree {
+ uint64 worktree_id = 1;
+ repeated PathAndDigest files = 2;
+ }
+
+ message PathAndDigest {
+ bytes path = 1;
+ bytes digest = 2;
+ }
+
+ message UploadFile {
+ bytes path = 1;
+ bytes content = 2;
+ }
}
message FromServer {
optional int32 request_id = 1;
oneof variant {
- Ack ack = 2;
+ AuthResponse auth_response = 2;
+ NewWorktreeResponse new_worktree_response = 3;
+ ShareWorktreeResponse share_worktree_response = 4;
+ }
+
+ message AuthResponse {
+ bool credentials_valid = 1;
+ }
+
+ message NewWorktreeResponse {
+ uint64 worktree_id = 1;
}
- message Ack {
- optional string error_message = 1;
+ message ShareWorktreeResponse {
+ repeated int32 needed_file_indices = 1;
}
}
@@ -5,14 +5,25 @@ use std::io;
include!(concat!(env!("OUT_DIR"), "/zed.messages.rs"));
+use from_client as client;
+use from_server as server;
+
pub trait Request {
type Response;
}
-impl Request for from_client::Auth {
- type Response = from_server::Ack;
+macro_rules! request_response {
+ ($req:path, $resp:path) => {
+ impl Request for $req {
+ type Response = $resp;
+ }
+ };
}
+request_response!(client::Auth, server::AuthResponse);
+request_response!(client::NewWorktree, server::NewWorktreeResponse);
+request_response!(client::ShareWorktree, server::ShareWorktreeResponse);
+
/// A stream of protobuf messages.
pub struct MessageStream<T> {
byte_stream: T,