2024-03-09 18:45:32 +01:00
|
|
|
syntax = "proto2";
|
|
|
|
|
|
|
|
package workspace;
|
|
|
|
|
|
|
|
import "common.proto";
|
|
|
|
import "files.proto";
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// Handles workspace state management.
|
2024-03-09 18:45:32 +01:00
|
|
|
service Workspace {
|
2024-09-05 00:08:07 +02:00
|
|
|
// Attach to a workspace.
|
2024-03-09 18:45:32 +01:00
|
|
|
rpc Attach (common.Empty) returns (stream WorkspaceEvent);
|
2024-09-05 00:08:07 +02:00
|
|
|
// Create a buffer within the workspace.
|
2024-03-09 18:45:32 +01:00
|
|
|
rpc CreateBuffer (files.BufferNode) returns (common.Empty);
|
2024-09-05 00:08:07 +02:00
|
|
|
// Access a buffer within the workspace and returns a buffer token for it.
|
2024-08-21 21:38:36 +02:00
|
|
|
rpc AccessBuffer (files.BufferNode) returns (common.Token);
|
2024-09-05 00:08:07 +02:00
|
|
|
// Delete a buffer.
|
2024-03-09 18:45:32 +01:00
|
|
|
rpc DeleteBuffer (files.BufferNode) returns (common.Empty);
|
2024-09-05 00:08:07 +02:00
|
|
|
// List buffers in the workspace.
|
2024-03-09 18:45:32 +01:00
|
|
|
rpc ListBuffers (common.Empty) returns (files.BufferTree);
|
2024-09-05 00:08:07 +02:00
|
|
|
// List users in the workspace.
|
2024-08-21 21:38:36 +02:00
|
|
|
rpc ListUsers (common.Empty) returns (UserList);
|
2024-09-05 00:08:07 +02:00
|
|
|
// List users within a given buffer.
|
2024-08-21 21:38:36 +02:00
|
|
|
rpc ListBufferUsers (files.BufferNode) returns (UserList);
|
|
|
|
}
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// A message representing a list of users.
|
2024-08-21 21:38:36 +02:00
|
|
|
message UserList {
|
2024-09-05 00:08:07 +02:00
|
|
|
// A vector of users.
|
2024-08-21 21:38:36 +02:00
|
|
|
repeated common.User users = 1;
|
2024-03-09 18:45:32 +01:00
|
|
|
}
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// A message representing a workspace event.
|
2024-03-09 18:45:32 +01:00
|
|
|
message WorkspaceEvent {
|
2024-09-05 00:08:07 +02:00
|
|
|
// Event that occurs when a user joins a workspace.
|
2024-03-09 18:45:32 +01:00
|
|
|
message UserJoin {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The user that joined.
|
2024-08-21 21:38:36 +02:00
|
|
|
required common.User user = 1;
|
2024-03-09 18:45:32 +01:00
|
|
|
}
|
2024-09-05 00:08:07 +02:00
|
|
|
// Event that occurs when a user leaves a workspace.
|
2024-03-09 18:45:32 +01:00
|
|
|
message UserLeave {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The user that left.
|
2024-08-21 21:38:36 +02:00
|
|
|
required common.User user = 1;
|
2024-03-09 18:45:32 +01:00
|
|
|
}
|
2024-09-05 00:08:07 +02:00
|
|
|
// Event that occurs when a file is created in a workspace.
|
2024-03-09 18:45:32 +01:00
|
|
|
message FileCreate {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The path of the created file.
|
2024-03-09 18:45:32 +01:00
|
|
|
required string path = 1;
|
|
|
|
}
|
2024-09-05 00:08:07 +02:00
|
|
|
// Event that occurs when a file is renamed in a workspace.
|
2024-03-09 18:45:32 +01:00
|
|
|
message FileRename {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The old path of the file.
|
2024-03-09 18:45:32 +01:00
|
|
|
required string before = 1;
|
2024-09-05 00:08:07 +02:00
|
|
|
// The new path of the file.
|
2024-03-09 18:45:32 +01:00
|
|
|
required string after = 2;
|
|
|
|
}
|
2024-09-05 00:08:07 +02:00
|
|
|
// Event that occurs when a file is deleted in a workspace.
|
2024-03-09 18:45:32 +01:00
|
|
|
message FileDelete {
|
2024-09-05 00:08:07 +02:00
|
|
|
// The path of the deleted file
|
2024-03-09 18:45:32 +01:00
|
|
|
required string path = 1;
|
|
|
|
}
|
|
|
|
|
2024-09-05 00:08:07 +02:00
|
|
|
// The union containing actual event.
|
2024-03-09 18:45:32 +01:00
|
|
|
oneof event {
|
|
|
|
UserJoin join = 1;
|
|
|
|
UserLeave leave = 2;
|
|
|
|
FileCreate create = 3;
|
|
|
|
FileRename rename = 4;
|
|
|
|
FileDelete delete = 5;
|
|
|
|
}
|
|
|
|
}
|