workspace_service cleanup

This commit is contained in:
frelodev 2024-01-01 23:34:59 +01:00
parent 85add1ca0d
commit 1657521356
4 changed files with 93 additions and 86 deletions

View file

@ -8,6 +8,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"proto/user.proto",
"proto/cursor.proto",
"proto/files.proto",
"proto/workspace.proto",
"proto/buffer_service.proto",
"proto/cursor_service.proto",
"proto/workspace_service.proto"

View file

@ -0,0 +1,83 @@
syntax = "proto2";
package workspace;
import "user.proto";
import "files.proto";
message Empty {}
message TreeRequest {} // empty
message UserRequest {}
message CursorResponse{}
message UserListRequest{}
message WorkspaceUserList {
repeated user.UserIdentity user = 1;
}
message WorkspaceMessage {
required int32 id = 1;
}
message JoinRequest{
required string username=1;
required string password=2;
}
message AttachRequest{
required string bufferAttach = 1;
}
message Token{
required string token = 1;
}
enum FileEventType {
CREATE = 0;
DELETE = 1;
RENAME = 2;
}
message FileEvent {
required string buffer = 1;
required FileEventType type = 2;
}
enum UserEventType {
JOIN = 0;
LEAVE = 1;
}
message UserEvent {
required user.UserIdentity user = 1;
required UserEventType type = 2;
}
message BufferPayload {
// buffer path to operate onto
required string path = 1;
// user id that is requesting the operation
required user.UserIdentity user = 2;
}
message BufferListRequest{
}
message UserList{
repeated user.UserIdentity users = 1;
}

View file

@ -27,104 +27,26 @@ syntax = "proto2";
package workspace_service;
import "user.proto";
import "files.proto";
import "workspace.proto";
message Empty {}
message WorkspaceUserList {
repeated user.UserIdentity user = 1;
}
message WorkspaceMessage {
required int32 id = 1;
}
message TreeRequest {} // empty
message UserRequest {}
message CursorResponse{}
message UserListRequest{}
service Workspace {
//
rpc Create (BufferPayload) returns (Empty);
rpc Create (workspace.BufferPayload) returns (workspace.Empty);
rpc Attach (AttachRequest) returns (Token);
rpc Attach (workspace.AttachRequest) returns (workspace.Token);
rpc ListBuffers (BufferListRequest) returns (files.BufferTree);
rpc ListBuffers (workspace.BufferListRequest) returns (files.BufferTree);
rpc ListUsers (UserListRequest) returns (UserList);
rpc ListUsers (workspace.UserListRequest) returns (workspace.UserList);
rpc ListBufferUsers (Empty) returns (Empty);
rpc ListBufferUsers (workspace.Empty) returns (workspace.Empty);
rpc Join (JoinRequest) returns (Token);
rpc Join (workspace.JoinRequest) returns (workspace.Token);
rpc Delete (BufferPayload) returns (Empty); //deletes buffer
rpc Delete (workspace.BufferPayload) returns (workspace.Empty); //deletes buffer
}
message JoinRequest{
required string username=1;
required string password=2;
}
message AttachRequest{
required string bufferAttach = 1;
}
message Token{
required string token = 1;
}
enum FileEventType {
CREATE = 0;
DELETE = 1;
RENAME = 2;
}
message FileEvent {
required string buffer = 1;
required FileEventType type = 2;
}
enum UserEventType {
JOIN = 0;
LEAVE = 1;
}
message UserEvent {
required user.UserIdentity user = 1;
required UserEventType type = 2;
}
message BufferPayload {
// buffer path to operate onto
required string path = 1;
// user id that is requesting the operation
required user.UserIdentity user = 2;
}
message BufferListRequest{
}
message UserList{
repeated user.UserIdentity users = 1;
}

View file

@ -168,6 +168,7 @@ pub mod proto {
pub mod user { tonic::include_proto!("user"); }
pub mod cursor { tonic::include_proto!("cursor"); }
pub mod files { tonic::include_proto!("files"); }
pub mod workspace { tonic::include_proto!("workspace"); }
pub mod buffer_service { tonic::include_proto!("buffer_service"); }
pub mod cursor_service { tonic::include_proto!("cursor_service"); }
pub mod workspace_service { tonic::include_proto!("workspace_service"); }