mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
chore: remove snapshot
This commit is contained in:
parent
bc3df45726
commit
97061524e7
5 changed files with 3 additions and 38 deletions
|
@ -5,10 +5,7 @@ package buffer_service;
|
||||||
// handle buffer changes, keep in sync users
|
// handle buffer changes, keep in sync users
|
||||||
service Buffer {
|
service Buffer {
|
||||||
// attach to a buffer and receive operations
|
// attach to a buffer and receive operations
|
||||||
rpc Attach (stream Operation) returns (stream Operation);
|
rpc Attach (stream Operation) returns (stream Operation);
|
||||||
|
|
||||||
rpc Snapshot(SnapshotRequest) returns (SnapshotResponse);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message Operation {
|
message Operation {
|
||||||
|
@ -16,11 +13,3 @@ message Operation {
|
||||||
optional string user = 2;
|
optional string user = 2;
|
||||||
optional string path = 3;
|
optional string path = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SnapshotRequest {
|
|
||||||
required string path = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SnapshotResponse {
|
|
||||||
required string content = 1;
|
|
||||||
}
|
|
|
@ -2,7 +2,6 @@ syntax = "proto2";
|
||||||
|
|
||||||
package files;
|
package files;
|
||||||
|
|
||||||
|
|
||||||
message BufferNode {
|
message BufferNode {
|
||||||
required string path = 1;
|
required string path = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,6 @@ enum FileEventType {
|
||||||
|
|
||||||
message FileEvent {
|
message FileEvent {
|
||||||
required string bufferbuffertree = 1;
|
required string bufferbuffertree = 1;
|
||||||
|
|
||||||
required FileEventType type = 2;
|
required FileEventType type = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,9 +58,7 @@ message BufferPayload {
|
||||||
required string path = 1;
|
required string path = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message BufferListRequest{
|
message BufferListRequest {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
message UserList {
|
message UserList {
|
||||||
repeated user.UserIdentity users = 1;
|
repeated user.UserIdentity users = 1;
|
||||||
|
|
|
@ -6,23 +6,13 @@ import "files.proto";
|
||||||
import "workspace.proto";
|
import "workspace.proto";
|
||||||
|
|
||||||
service Workspace {
|
service Workspace {
|
||||||
|
|
||||||
rpc Attach (workspace.AttachRequest) returns (workspace.Token);
|
rpc Attach (workspace.AttachRequest) returns (workspace.Token);
|
||||||
|
|
||||||
rpc LeaveWorkspace (workspace.WorkspaceDetails) returns (workspace.Empty);
|
rpc LeaveWorkspace (workspace.WorkspaceDetails) returns (workspace.Empty);
|
||||||
|
|
||||||
rpc CreateWorkspace (workspace.WorkspaceDetails) returns (workspace.Empty);
|
rpc CreateWorkspace (workspace.WorkspaceDetails) returns (workspace.Empty);
|
||||||
|
|
||||||
rpc CreateBuffer (workspace.BufferPayload) returns (workspace.Empty);
|
rpc CreateBuffer (workspace.BufferPayload) returns (workspace.Empty);
|
||||||
|
|
||||||
rpc ListBuffers (workspace.BufferListRequest) returns (files.BufferTree);
|
rpc ListBuffers (workspace.BufferListRequest) returns (files.BufferTree);
|
||||||
|
|
||||||
rpc ListUsers (workspace.UserListRequest) returns (workspace.UserList);
|
rpc ListUsers (workspace.UserListRequest) returns (workspace.UserList);
|
||||||
|
|
||||||
rpc ListBufferUsers (workspace.BufferPayload) returns (workspace.UserList); //TODO discuss
|
rpc ListBufferUsers (workspace.BufferPayload) returns (workspace.UserList); //TODO discuss
|
||||||
|
|
||||||
rpc Join (workspace.JoinRequest) returns (workspace.Token);
|
rpc Join (workspace.JoinRequest) returns (workspace.Token);
|
||||||
|
|
||||||
rpc Delete (workspace.BufferPayload) returns (workspace.Empty); //deletes buffer
|
rpc Delete (workspace.BufferPayload) returns (workspace.Empty); //deletes buffer
|
||||||
|
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ use std::{collections::{BTreeMap, BTreeSet}, sync::Arc};
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use crate::{
|
use crate::{
|
||||||
proto::{buffer_service::SnapshotRequest, user::UserIdentity, workspace::{AttachRequest, BufferListRequest, BufferPayload, Token, UserListRequest}},
|
proto::{user::UserIdentity, workspace::{AttachRequest, BufferListRequest, BufferPayload, Token, UserListRequest}},
|
||||||
api::controller::ControllerWorker,
|
api::controller::ControllerWorker,
|
||||||
buffer::{self, worker::BufferWorker},
|
buffer::{self, worker::BufferWorker},
|
||||||
client::Services,
|
client::Services,
|
||||||
|
@ -112,16 +112,6 @@ impl Workspace {
|
||||||
Ok(controller)
|
Ok(controller)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get a snapshot of a buffer (meaning its contents as a flat string)
|
|
||||||
pub async fn snapshot(&self, path: &str) -> crate::Result<String> {
|
|
||||||
let mut buffer_client = self.services.buffer.clone();
|
|
||||||
let contents = buffer_client.snapshot(
|
|
||||||
tonic::Request::new(SnapshotRequest { path: path.to_string() })
|
|
||||||
).await?.into_inner().content;
|
|
||||||
|
|
||||||
Ok(contents)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// fetch a list of all buffers in a workspace
|
/// fetch a list of all buffers in a workspace
|
||||||
pub async fn fetch_buffers(&mut self) -> crate::Result<()> {
|
pub async fn fetch_buffers(&mut self) -> crate::Result<()> {
|
||||||
let mut workspace_client = self.services.workspace.clone();
|
let mut workspace_client = self.services.workspace.clone();
|
||||||
|
|
Loading…
Reference in a new issue