diff --git a/zed-rpc/proto/zed.proto b/zed-rpc/proto/zed.proto index 94a4d173b1..4419c3bc82 100644 --- a/zed-rpc/proto/zed.proto +++ b/zed-rpc/proto/zed.proto @@ -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 Ack { - optional string error_message = 1; + message AuthResponse { + bool credentials_valid = 1; + } + + message NewWorktreeResponse { + uint64 worktree_id = 1; + } + + message ShareWorktreeResponse { + repeated int32 needed_file_indices = 1; } } \ No newline at end of file diff --git a/zed-rpc/src/proto.rs b/zed-rpc/src/proto.rs index 177dbd6fa2..6cac628337 100644 --- a/zed-rpc/src/proto.rs +++ b/zed-rpc/src/proto.rs @@ -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 { byte_stream: T,