From a0ceacdd4f5a046f8123ee5859529408706df295 Mon Sep 17 00:00:00 2001 From: Jeff Baskin Date: Fri, 22 Aug 2025 13:12:54 -0400 Subject: [PATCH] Removed reply and error for general response. --- src/message.rs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/message.rs b/src/message.rs index ebc7f39..f4f222f 100644 --- a/src/message.rs +++ b/src/message.rs @@ -227,22 +227,6 @@ impl Message { action: action.into(), } } - - fn reply(&self, resp: Reply) -> Self { - Self { - msg_id: self.msg_id.clone(), - document_id: self.document_id.clone(), - action: MsgAction::Reply(resp), - } - } - - fn error(&self, err: MTTError) -> Self { - Self { - msg_id: self.msg_id.clone(), - document_id: self.document_id.clone(), - action: MsgAction::Error(err), - } - } } #[cfg(test)] @@ -311,7 +295,7 @@ mod messages { let name = "testing"; let msg = Message::new(name, MsgAction::Query(Query::new())); let responce = Reply::new(); - let reply = msg.reply(responce); + let reply = msg.response(responce); assert_eq!(reply.get_message_id(), msg.get_message_id()); match reply.get_document_id() { NameID::Name(data) => assert_eq!(data, name), @@ -328,7 +312,7 @@ mod messages { let name = "testing"; let msg = Message::new(name, MsgAction::Query(Query::new())); let err_msg = Uuid::new_v4().to_string(); - let result = msg.error(MTTError::DocumentNotFound(err_msg.clone())); + let result = msg.response(MTTError::DocumentNotFound(err_msg.clone())); assert_eq!(result.get_message_id(), msg.get_message_id()); match result.get_document_id() { @@ -1633,7 +1617,7 @@ impl DocumentFile { match queue.register(tx, name, routes) { Ok(_) => {} Err(err) => { - let error = msg.error(err); + let error = msg.response(err); queue.send(error).unwrap(); return; } @@ -1647,7 +1631,7 @@ impl DocumentFile { spawn(move || { doc.listen(); }); - let reply = msg.reply(Reply::new()); + let reply = msg.response(Reply::new()); queue.send(reply).unwrap(); }