Respond to proto::OpenBuffer requests
This commit is contained in:
+22
-27
@@ -12,11 +12,9 @@ message Envelope {
|
||||
ShareWorktreeResponse share_worktree_response = 7;
|
||||
OpenWorktree open_worktree = 8;
|
||||
OpenWorktreeResponse open_worktree_response = 9;
|
||||
OpenFile open_file = 10;
|
||||
OpenFileResponse open_file_response = 11;
|
||||
CloseFile close_file = 12;
|
||||
OpenBuffer open_buffer = 13;
|
||||
OpenBufferResponse open_buffer_response = 14;
|
||||
OpenBuffer open_buffer = 10;
|
||||
OpenBufferResponse open_buffer_response = 11;
|
||||
CloseBuffer close_buffer = 12;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,28 +55,18 @@ message RemoveGuest {
|
||||
uint64 worktree_id = 1;
|
||||
}
|
||||
|
||||
message OpenFile {
|
||||
message OpenBuffer {
|
||||
uint64 worktree_id = 1;
|
||||
string path = 2;
|
||||
}
|
||||
|
||||
message OpenFileResponse {
|
||||
uint64 id = 1;
|
||||
uint64 mtime = 2;
|
||||
}
|
||||
|
||||
message CloseFile {
|
||||
uint64 worktree_id = 1;
|
||||
uint64 id = 2;
|
||||
}
|
||||
|
||||
message OpenBuffer {
|
||||
uint64 worktree_id = 1;
|
||||
uint64 id = 2;
|
||||
}
|
||||
|
||||
message OpenBufferResponse {
|
||||
Buffer buffer = 1;
|
||||
uint64 buffer_id = 1;
|
||||
Buffer buffer = 2;
|
||||
}
|
||||
|
||||
message CloseBuffer {
|
||||
uint64 id = 1;
|
||||
}
|
||||
|
||||
message User {
|
||||
@@ -116,15 +104,22 @@ message Operation {
|
||||
uint32 local_timestamp = 2;
|
||||
uint32 lamport_timestamp = 3;
|
||||
repeated VectorClockEntry version = 4;
|
||||
repeated Range ranges = 5;
|
||||
optional string new_text = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message VectorClockEntry {
|
||||
uint32 replica_id = 1;
|
||||
uint32 timestamp = 2;
|
||||
}
|
||||
message VectorClockEntry {
|
||||
uint32 replica_id = 1;
|
||||
uint32 timestamp = 2;
|
||||
}
|
||||
|
||||
message Timestamp {
|
||||
uint64 seconds = 1;
|
||||
uint32 nanos = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message Range {
|
||||
uint64 start = 1;
|
||||
uint64 end = 2;
|
||||
}
|
||||
|
||||
+4
-2
@@ -432,9 +432,10 @@ mod tests {
|
||||
};
|
||||
let request3 = proto::OpenBuffer {
|
||||
worktree_id: 1,
|
||||
id: 2,
|
||||
path: "path/two".to_string(),
|
||||
};
|
||||
let response3 = proto::OpenBufferResponse {
|
||||
buffer_id: 2,
|
||||
buffer: Some(proto::Buffer {
|
||||
content: "path/two content".to_string(),
|
||||
history: vec![],
|
||||
@@ -442,9 +443,10 @@ mod tests {
|
||||
};
|
||||
let request4 = proto::OpenBuffer {
|
||||
worktree_id: 2,
|
||||
id: 1,
|
||||
path: "path/one".to_string(),
|
||||
};
|
||||
let response4 = proto::OpenBufferResponse {
|
||||
buffer_id: 1,
|
||||
buffer: Some(proto::Buffer {
|
||||
content: "path/one content".to_string(),
|
||||
history: vec![],
|
||||
|
||||
@@ -71,9 +71,8 @@ macro_rules! request_message {
|
||||
request_message!(Auth, AuthResponse);
|
||||
request_message!(ShareWorktree, ShareWorktreeResponse);
|
||||
request_message!(OpenWorktree, OpenWorktreeResponse);
|
||||
request_message!(OpenFile, OpenFileResponse);
|
||||
message!(CloseFile);
|
||||
request_message!(OpenBuffer, OpenBufferResponse);
|
||||
message!(CloseBuffer);
|
||||
|
||||
/// A stream of protobuf messages.
|
||||
pub struct MessageStream<T> {
|
||||
@@ -169,7 +168,7 @@ mod tests {
|
||||
|
||||
let message2 = OpenBuffer {
|
||||
worktree_id: 0,
|
||||
id: 1,
|
||||
path: "some/path".to_string(),
|
||||
}
|
||||
.into_envelope(5, None, None);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user