mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
feat: fixed proto and tonic includes
Co-authored-by: zaaarf <me@zaaarf.foo> Co-authored-by: alemi <me@alemi.dev>
This commit is contained in:
parent
3b1be930d8
commit
6230371020
9 changed files with 31 additions and 27 deletions
12
build.rs
12
build.rs
|
@ -1,15 +1,17 @@
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
tonic_build::configure()
|
tonic_build::configure()
|
||||||
.build_server(false)
|
// .build_client(cfg!(feature = "client"))
|
||||||
|
//.build_server(cfg!(feature = "server")) // FIXME if false, build fails????
|
||||||
|
// .build_transport(cfg!(feature = "transport"))
|
||||||
.compile(
|
.compile(
|
||||||
&[
|
&[
|
||||||
"proto/model/cursor.proto",
|
"proto/user.proto",
|
||||||
"proto/model/user.proto",
|
"proto/cursor.proto",
|
||||||
"proto/buffer_service.proto",
|
"proto/buffer_service.proto",
|
||||||
"proto/cursor_service.proto",
|
"proto/cursor_service.proto",
|
||||||
"proto/workspace_service.proto"
|
"proto/workspace_service.proto"
|
||||||
],
|
],
|
||||||
&["proto", "proto", "proto","proto", "proto"]
|
&["proto"]
|
||||||
)?;
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
package codemp.buffer_service;
|
package buffer_service;
|
||||||
|
|
||||||
// handle buffer changes, keep in sync users
|
// handle buffer changes, keep in sync users
|
||||||
service Buffer {
|
service Buffer {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
package codemp.model.cursor;
|
package cursor;
|
||||||
|
|
||||||
import "model/user.proto";
|
import "user.proto";
|
||||||
|
|
||||||
// empty request
|
// empty request
|
||||||
message MovedResponse {}
|
message MovedResponse {}
|
||||||
|
@ -26,7 +26,7 @@ message CursorPosition {
|
||||||
// cursor event, with user id and cursor position
|
// cursor event, with user id and cursor position
|
||||||
message CursorEvent {
|
message CursorEvent {
|
||||||
// user moving the cursor
|
// user moving the cursor
|
||||||
required codemp.model.user.UserIdentity user = 1;
|
required user.UserIdentity user = 1;
|
||||||
// new cursor position
|
// new cursor position
|
||||||
required CursorPosition position = 2;
|
required CursorPosition position = 2;
|
||||||
}
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
package codemp.cursor_service;
|
package cursor_service;
|
||||||
import "model/cursor.proto";
|
import "cursor.proto";
|
||||||
import "model/user.proto";
|
import "user.proto";
|
||||||
|
|
||||||
// handle cursor events and broadcast to all users
|
// handle cursor events and broadcast to all users
|
||||||
service Cursor {
|
service Cursor {
|
||||||
// send cursor movement to server
|
// send cursor movement to server
|
||||||
rpc Moved (codemp.model.cursor.CursorEvent) returns (codemp.model.cursor.MovedResponse);
|
rpc Moved (cursor.CursorEvent) returns (cursor.MovedResponse);
|
||||||
// attach to a workspace and receive cursor events
|
// attach to a workspace and receive cursor events
|
||||||
rpc Listen (codemp.model.user.UserIdentity) returns (stream codemp.model.cursor.CursorEvent);
|
rpc Listen (user.UserIdentity) returns (stream cursor.CursorEvent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
package codemp.model.user;
|
package user;
|
||||||
|
|
||||||
|
|
||||||
// payload identifying user
|
// payload identifying user
|
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
package codemp.workspace_service;
|
package workspace_service;
|
||||||
import "model/user.proto";
|
import "user.proto";
|
||||||
|
|
||||||
|
|
||||||
message Empty {}
|
message Empty {}
|
||||||
|
@ -37,7 +37,7 @@ message WorkspaceFileTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
message WorkspaceUserList {
|
message WorkspaceUserList {
|
||||||
repeated codemp.model.user.UserIdentity user = 1;
|
repeated user.UserIdentity user = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message WorkspaceMessage {
|
message WorkspaceMessage {
|
||||||
|
@ -65,6 +65,8 @@ service Workspace {
|
||||||
|
|
||||||
rpc Join (JoinRequest) returns (Token);
|
rpc Join (JoinRequest) returns (Token);
|
||||||
|
|
||||||
|
rpc Delete (BufferPayload) returns (Empty); //deletes buffer
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,7 +104,7 @@ enum UserEventType {
|
||||||
}
|
}
|
||||||
|
|
||||||
message UserEvent {
|
message UserEvent {
|
||||||
required codemp.model.user.UserIdentity user = 1;
|
required user.UserIdentity user = 1;
|
||||||
|
|
||||||
required UserEventType type = 2;
|
required UserEventType type = 2;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +116,7 @@ message BufferPayload {
|
||||||
required string path = 1;
|
required string path = 1;
|
||||||
|
|
||||||
// user id that is requesting the operation
|
// user id that is requesting the operation
|
||||||
required codemp.model.user.UserIdentity user = 2;
|
required user.UserIdentity user = 2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,5 +134,5 @@ message BufferTree{
|
||||||
}
|
}
|
||||||
|
|
||||||
message UserList{
|
message UserList{
|
||||||
repeated codemp.model.user.UserIdentity users = 1;
|
repeated user.UserIdentity users = 1;
|
||||||
}
|
}
|
12
src/lib.rs
12
src/lib.rs
|
@ -162,14 +162,14 @@ pub mod prelude;
|
||||||
pub use woot;
|
pub use woot;
|
||||||
|
|
||||||
/// protocol types and services auto-generated by grpc
|
/// protocol types and services auto-generated by grpc
|
||||||
#[cfg(feature = "proto")]
|
#[cfg(feature = "transport")]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub mod proto {
|
pub mod proto {
|
||||||
tonic::include_proto!("codemp.model.cursor");
|
pub mod user { tonic::include_proto!("user"); }
|
||||||
tonic::include_proto!("codemp.model.user");
|
pub mod cursor { tonic::include_proto!("cursor"); }
|
||||||
tonic::include_proto!("codemp.buffer_service");
|
pub mod buffer_service { tonic::include_proto!("buffer_service"); }
|
||||||
tonic::include_proto!("codemp.cursor_service");
|
pub mod cursor_service { tonic::include_proto!("cursor_service"); }
|
||||||
tonic::include_proto!("codemp.workspace_service");
|
pub mod workspace_service { tonic::include_proto!("workspace_service"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue