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) {
Err(e) => break error!("could not deserialize opseq: {}", e),
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) => {
self.store = res;
let msg = RawOp {
opseq: v.opseq,
user: v.user
};
if let Err(e) = self.digest.send(md5::compute(&self.store)) {
error!("could not update digest: {}", e);
}
// if let Err(e) = self.digest.send(md5::compute(&self.store)) {
// error!("could not update digest: {}", e);
// }
if let Err(e) = self.content.send(self.store.clone()) {
error!("could not update content: {}", e);
}

View file

@ -52,10 +52,11 @@ impl Buffer for BufferService {
type AttachStream = OperationStream;
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 myself = request.user;
match self.map.read().unwrap().get(&request.path) {
None => Err(Status::not_found("path not found")),
Some(handle) => {
let (tx, rx) = mpsc::channel(128);
let mut sub = handle.subscribe();
@ -74,11 +75,10 @@ impl Buffer for BufferService {
info!("registered new subscriber on buffer");
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 myself = req.into_inner().user;
let (tx, rx) = mpsc::channel(128);