Skip to content

Commit

Permalink
remove protocol version from response
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Apr 28, 2023
1 parent 8cebed1 commit 73c496d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 24 deletions.
14 changes: 0 additions & 14 deletions bin/src/command/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,20 +204,6 @@ impl CommandServer {
}
offset = buffer.data().offset(i);

/*
TODO: maybe we should put on WorkerRequest the version field we had on CommandRequest: a u32 to track versionning
if requests.iter().any(|o| {
if o.version > PROTOCOL_VERSION {
error!("configuration protocol version mismatch: Sōzu handles up to version {}, the message uses version {}", PROTOCOL_VERSION, o.version);
true
} else {
false
}
}) {
break;
}
*/

for request in requests {
message_counter += 1;

Expand Down
1 change: 0 additions & 1 deletion command/assets/answer_metrics.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"version": 0,
"status": "OK",
"message": "",
"content": {
Expand Down
1 change: 0 additions & 1 deletion command/assets/answer_workers_status.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"version": 0,
"status": "OK",
"message": "",
"content": {
Expand Down
2 changes: 0 additions & 2 deletions command/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ use crate::{
response::{HttpFrontend, MessageId},
};

pub const PROTOCOL_VERSION: u8 = 0;

impl Request {
/// determine to which of the three proxies (HTTP, HTTPS, TCP) a request is destined
pub fn get_destinations(&self) -> ProxyDestinations {
Expand Down
7 changes: 1 addition & 6 deletions command/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ use crate::{
RequestHttpFrontend, RequestTcpFrontend, ResponseContent, ResponseStatus, RulePosition,
RunState,
},
request::PROTOCOL_VERSION,
state::ClusterId,
};

/// Responses of the main process to the CLI (or other client)
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Response {
pub version: u8,
pub status: ResponseStatus,
pub message: String,
pub content: Option<ResponseContent>,
Expand All @@ -26,7 +24,6 @@ impl Response {
content: Option<ResponseContent>,
) -> Response {
Response {
version: PROTOCOL_VERSION,
status,
message,
content,
Expand Down Expand Up @@ -328,7 +325,7 @@ fn socketaddr_cmp(a: &SocketAddr, b: &SocketAddr) -> Ordering {
mod tests {
use crate::proto::command::{
filtered_metrics, response_content::ContentType, AggregatedMetrics, BackendMetrics,
ClusterMetrics, FilteredMetrics, Percentiles, WorkerInfo, WorkerMetrics, WorkerInfos,
ClusterMetrics, FilteredMetrics, Percentiles, WorkerInfo, WorkerInfos, WorkerMetrics,
};

use super::*;
Expand Down Expand Up @@ -365,7 +362,6 @@ mod tests {
answer_workers_status,
"../assets/answer_workers_status.json",
Response {
version: 0,
status: ResponseStatus::Ok,
message: String::from(""),
content: Some(ResponseContent {
Expand All @@ -391,7 +387,6 @@ mod tests {
answer_metrics,
"../assets/answer_metrics.json",
Response {
version: 0,
status: ResponseStatus::Ok,
message: String::from(""),
content: Some(ResponseContent {
Expand Down

0 comments on commit 73c496d

Please sign in to comment.