2024-01-01 23:34:59 +01:00
syntax = "proto2" ;
package workspace ;
2024-02-07 01:09:28 +01:00
import "common.proto" ;
2024-01-01 23:34:59 +01:00
import "files.proto" ;
2024-02-05 23:31:06 +01:00
import "auth.proto" ;
service Workspace {
2024-02-07 01:09:28 +01:00
rpc Attach ( common.Empty ) returns ( stream WorkspaceEvent ) ;
2024-02-05 23:31:06 +01:00
2024-02-07 01:09:28 +01:00
rpc CreateBuffer ( files.BufferNode ) returns ( common.Empty ) ;
rpc AccessBuffer ( files.BufferNode ) returns ( BufferCredentials ) ;
rpc DeleteBuffer ( files.BufferNode ) returns ( common.Empty ) ;
2024-02-05 23:31:06 +01:00
rpc ListBuffers ( common.Empty ) returns ( files.BufferTree ) ;
2024-02-07 01:09:28 +01:00
rpc ListUsers ( common.Empty ) returns ( common.IdentityList ) ;
2024-02-07 01:15:32 +01:00
rpc ListBufferUsers ( files.BufferNode ) returns ( common.IdentityList ) ;
2024-02-04 13:25:26 +01:00
}
message WorkspaceEvent {
2024-02-05 23:31:06 +01:00
message UserJoin {
2024-02-07 01:09:28 +01:00
required common.Identity user = 1 ;
2024-02-05 23:31:06 +01:00
}
message UserLeave {
2024-02-07 01:09:28 +01:00
required common.Identity user = 1 ;
2024-02-05 23:31:06 +01:00
}
message FileCreate {
required string path = 1 ;
}
message FileRename {
required string before = 1 ;
required string after = 2 ;
}
message FileDelete {
required string path = 1 ;
}
oneof event {
UserJoin join = 1 ;
UserLeave leave = 2 ;
FileCreate create = 3 ;
FileRename rename = 4 ;
FileDelete delete = 5 ;
}
}
2024-02-07 01:15:32 +01:00
// TODO this is very ugly because we can't just return a new token (which is already smelly but whatev), we also need to tell the underlying id so that
// the client can put it as metadata while attaching, because it can't really know the underlying id that the server is using for each buffer without
// parsing the token itself. meehhhhhh, this bleeds underlying implementation to the upper levels, how can we avoid this??
2024-02-07 01:09:28 +01:00
message BufferCredentials {
required common.Identity id = 1 ;
required auth.Token token = 2 ;
2024-02-04 13:25:26 +01:00
}