mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
feat: defined some basic protocol
Co-authored-by: f-tlm <f-tlm@users.noreply.github.com>
This commit is contained in:
parent
773a90b94f
commit
0151a9e1bd
3 changed files with 43 additions and 15 deletions
22
proto/buffer.proto
Normal file
22
proto/buffer.proto
Normal 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;
|
||||||
|
}
|
|
@ -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
21
proto/workspace.proto
Normal 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;
|
||||||
|
}
|
Loading…
Reference in a new issue