chore: small style tweaks

This commit is contained in:
ftbsc 2023-04-12 16:58:00 +02:00
parent c3d7889e23
commit 0f5e4c7f8d
2 changed files with 7 additions and 7 deletions

View file

@ -73,16 +73,16 @@ impl BufferWorker {
Some(v) => match serde_json::from_str::<OperationSeq>(&v.opseq) { Some(v) => match serde_json::from_str::<OperationSeq>(&v.opseq) {
Err(e) => break error!("could not deserialize opseq: {}", e), Err(e) => break error!("could not deserialize opseq: {}", e),
Ok(op) => match op.apply(&self.store) { Ok(op) => match op.apply(&self.store) {
Err(e) => error!("coult not apply OpSeq '{:?}' on '{}' : {}", v, self.store, e), Err(e) => error!("coult not apply OpSeq '{:?}' on '{}' : {}", v, self.store, e), // TODO
Ok(res) => { Ok(res) => {
self.store = res; self.store = res;
let msg = RawOp { let msg = RawOp {
opseq: v.opseq, opseq: v.opseq,
user: v.user user: v.user
}; };
if let Err(e) = self.digest.send(md5::compute(&self.store)) { // if let Err(e) = self.digest.send(md5::compute(&self.store)) {
error!("could not update digest: {}", e); // error!("could not update digest: {}", e);
} // }
if let Err(e) = self.content.send(self.store.clone()) { if let Err(e) = self.content.send(self.store.clone()) {
error!("could not update content: {}", e); error!("could not update content: {}", e);
} }

View file

@ -52,10 +52,11 @@ impl Buffer for BufferService {
type AttachStream = OperationStream; type AttachStream = OperationStream;
type ListenStream = CursorStream; type ListenStream = CursorStream;
async fn attach(&self, req: Request<BufferPayload>) -> Result<tonic::Response<OperationStream>, Status> { async fn attach(&self, req: Request<BufferPayload>) -> Result<Response<OperationStream>, Status> {
let request = req.into_inner(); let request = req.into_inner();
let myself = request.user; let myself = request.user;
match self.map.read().unwrap().get(&request.path) { match self.map.read().unwrap().get(&request.path) {
None => Err(Status::not_found("path not found")),
Some(handle) => { Some(handle) => {
let (tx, rx) = mpsc::channel(128); let (tx, rx) = mpsc::channel(128);
let mut sub = handle.subscribe(); let mut sub = handle.subscribe();
@ -74,11 +75,10 @@ impl Buffer for BufferService {
info!("registered new subscriber on buffer"); info!("registered new subscriber on buffer");
Ok(Response::new(Box::pin(output_stream))) Ok(Response::new(Box::pin(output_stream)))
}, },
None => Err(Status::not_found("path not found")),
} }
} }
async fn listen(&self, req: Request<BufferPayload>) -> Result<tonic::Response<CursorStream>, Status> { async fn listen(&self, req: Request<BufferPayload>) -> Result<Response<CursorStream>, Status> {
let mut sub = self.cursor.subscribe(); let mut sub = self.cursor.subscribe();
let myself = req.into_inner().user; let myself = req.into_inner().user;
let (tx, rx) = mpsc::channel(128); let (tx, rx) = mpsc::channel(128);