feat: initial rework of protocol flow

Added a "session" stage, to auth and connect to a Workspace.
Added workspace-level operations (sync, get buffers list...).
Added buffer-level sync operations (push, pull).
This commit is contained in:
əlemi 2022-07-31 13:44:48 +02:00
parent 4491482b0a
commit 83ae6e3cd1
3 changed files with 22 additions and 14 deletions

View file

@ -3,6 +3,8 @@ package buffer;
service Buffer {
rpc Attach (stream Operation) returns (stream Operation);
rpc Push (BufferPayload) returns (BufferResponse);
rpc Pull (BufferPayload) returns (BufferPayload);
}
message Operation {
@ -20,3 +22,15 @@ message Operation {
optional string text = 5;
}
message BufferPayload {
string sessionKey = 1;
string path = 2;
optional string content = 3;
}
message BufferResponse {
string sessionKey = 1;
string path = 2;
bool accepted = 3;
}

View file

@ -8,7 +8,7 @@ service Session {
}
message SessionRequest {
optional string sessionKey = 1;
string sessionKey = 1;
}
message SessionResponse {

View file

@ -2,26 +2,20 @@ syntax = "proto3";
package workspace;
service Workspace {
rpc Buffers (WorkspaceRequest) returns (BufferList);
rpc Push (BufferPayload) returns (WorkspaceResponse);
rpc Pull (BufferPayload) returns (BufferPayload);
rpc Subscribe (WorkspaceRequest) returns (stream Event);
rpc Buffers (WorkspaceRequest) returns (BufferList);
}
message Event {
int32 id = 1;
optional string body = 2;
}
message WorkspaceRequest {
string sessionKey = 1;
}
message WorkspaceResponse {
string sessionKey = 1;
bool accepted = 2;
}
message BufferList {
repeated string path = 1;
}
message BufferPayload {
string sessionKey = 1;
string path = 2;
optional string content = 3;
}