mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
Add initial messages for setting up a worktree share
This commit is contained in:
parent
a10f4bb4ff
commit
9c5c9fdc36
2 changed files with 46 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -5,13 +5,24 @@ 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> {
|
||||
|
|
Loading…
Reference in a new issue