mirror of
https://github.com/hexedtech/codemp.git
synced 2024-12-23 05:14:54 +01:00
chore: remove snapshot
This commit is contained in:
parent
bc3df45726
commit
97061524e7
5 changed files with 3 additions and 38 deletions
|
@ -5,22 +5,11 @@ package buffer_service;
|
|||
// handle buffer changes, keep in sync users
|
||||
service Buffer {
|
||||
// attach to a buffer and receive operations
|
||||
rpc Attach (stream Operation) returns (stream Operation);
|
||||
|
||||
rpc Snapshot(SnapshotRequest) returns (SnapshotResponse);
|
||||
|
||||
rpc Attach (stream Operation) returns (stream Operation);
|
||||
}
|
||||
|
||||
message Operation {
|
||||
required bytes data = 1;
|
||||
optional string user = 2;
|
||||
optional string path = 3;
|
||||
}
|
||||
|
||||
message SnapshotRequest {
|
||||
required string path = 1;
|
||||
}
|
||||
|
||||
message SnapshotResponse {
|
||||
required string content = 1;
|
||||
}
|
|
@ -2,7 +2,6 @@ syntax = "proto2";
|
|||
|
||||
package files;
|
||||
|
||||
|
||||
message BufferNode {
|
||||
required string path = 1;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,6 @@ enum FileEventType {
|
|||
|
||||
message FileEvent {
|
||||
required string bufferbuffertree = 1;
|
||||
|
||||
required FileEventType type = 2;
|
||||
}
|
||||
|
||||
|
@ -59,9 +58,7 @@ message BufferPayload {
|
|||
required string path = 1;
|
||||
}
|
||||
|
||||
message BufferListRequest{
|
||||
|
||||
}
|
||||
message BufferListRequest {}
|
||||
|
||||
message UserList {
|
||||
repeated user.UserIdentity users = 1;
|
||||
|
|
|
@ -6,23 +6,13 @@ import "files.proto";
|
|||
import "workspace.proto";
|
||||
|
||||
service Workspace {
|
||||
|
||||
rpc Attach (workspace.AttachRequest) returns (workspace.Token);
|
||||
|
||||
rpc LeaveWorkspace (workspace.WorkspaceDetails) returns (workspace.Empty);
|
||||
|
||||
rpc CreateWorkspace (workspace.WorkspaceDetails) returns (workspace.Empty);
|
||||
|
||||
rpc CreateBuffer (workspace.BufferPayload) returns (workspace.Empty);
|
||||
|
||||
rpc ListBuffers (workspace.BufferListRequest) returns (files.BufferTree);
|
||||
|
||||
rpc ListUsers (workspace.UserListRequest) returns (workspace.UserList);
|
||||
|
||||
rpc ListBufferUsers (workspace.BufferPayload) returns (workspace.UserList); //TODO discuss
|
||||
|
||||
rpc Join (workspace.JoinRequest) returns (workspace.Token);
|
||||
|
||||
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 uuid::Uuid;
|
||||
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,
|
||||
buffer::{self, worker::BufferWorker},
|
||||
client::Services,
|
||||
|
@ -112,16 +112,6 @@ impl Workspace {
|
|||
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
|
||||
pub async fn fetch_buffers(&mut self) -> crate::Result<()> {
|
||||
let mut workspace_client = self.services.workspace.clone();
|
||||
|
|
Loading…
Reference in a new issue