feat: defined some basic protocol

Co-authored-by: f-tlm <f-tlm@users.noreply.github.com>
This commit is contained in:
əlemi 2022-07-13 01:56:21 +02:00
parent 773a90b94f
commit 0151a9e1bd
3 changed files with 43 additions and 15 deletions

22
proto/buffer.proto Normal file
View file

@ -0,0 +1,22 @@
syntax = "proto3";
package buffer;
service Buffer {
rpc Attach (stream Operation) returns (stream Operation);
}
message Operation {
int64 opId = 1;
enum Action {
RETAIN = 0;
INSERT = 1;
DELETE = 2;
};
Action action = 2;
int32 row = 3;
int32 column = 4;
optional string text = 5;
}

View file

@ -1,15 +0,0 @@
syntax = "proto3";
package core;
service Session {
rpc Create (SessionRequest) returns (SessionResponse);
}
message SessionRequest {
int32 sessionId = 1;
}
message SessionResponse {
int32 sessionId = 1;
}

21
proto/workspace.proto Normal file
View file

@ -0,0 +1,21 @@
syntax = "proto3";
package workspace;
service Workspace {
rpc Create (SessionRequest) returns (SessionResponse);
rpc Join (SessionRequest) returns (SessionResponse);
rpc Sync (SessionRequest) returns (SessionResponse);
rpc Leave (SessionRequest) returns (SessionResponse);
}
message SessionRequest {
string sessionKey = 1;
optional string content = 2;
}
message SessionResponse {
string sessionKey = 1;
bool accepted = 2;
optional string hash = 3;
optional string content = 4;
}