Skip to content

Commit

Permalink
write ResponseStatus in protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Apr 28, 2023
1 parent aff4168 commit 582d285
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
5 changes: 3 additions & 2 deletions bin/src/acme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ use sozu_command_lib::{
config::Config,
proto::command::{
request::RequestType, AddBackend, AddCertificate, CertificateAndKey, PathRule,
RemoveBackend, ReplaceCertificate, Request, RequestHttpFrontend, TlsVersion,
RemoveBackend, ReplaceCertificate, Request, RequestHttpFrontend, ResponseStatus,
TlsVersion,
},
response::{Response, ResponseStatus},
response::Response,
};

use crate::util;
Expand Down
6 changes: 4 additions & 2 deletions bin/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ use serde::{Deserialize, Serialize};

use sozu_command_lib::{
config::Config,
proto::command::{request::RequestType, MetricsConfiguration, Request, RunState, Status},
proto::command::{
request::RequestType, MetricsConfiguration, Request, ResponseStatus, RunState, Status,
},
request::WorkerRequest,
response::{Response, ResponseContent, ResponseStatus, WorkerResponse},
response::{Response, ResponseContent, WorkerResponse},
scm_socket::{Listeners, ScmSocket},
state::ConfigState,
};
Expand Down
5 changes: 3 additions & 2 deletions bin/src/command/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ use sozu_command_lib::{
parser::parse_several_commands,
proto::command::{
request::RequestType, AggregatedMetrics, AvailableMetrics, FrontendFilters, ListenersList,
MetricsConfiguration, Request, ReturnListenSockets, RunState, SoftStop, Status, WorkerInfo,
MetricsConfiguration, Request, ResponseStatus, ReturnListenSockets, RunState, SoftStop,
Status, WorkerInfo,
},
request::WorkerRequest,
response::{ListedFrontends, Response, ResponseContent, ResponseStatus},
response::{ListedFrontends, Response, ResponseContent},
scm_socket::Listeners,
state::get_cluster_ids_by_domain,
};
Expand Down
5 changes: 3 additions & 2 deletions bin/src/ctl/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ use serde::Serialize;
use sozu_command_lib::{
proto::command::{
request::RequestType, ListWorkers, QueryAllCertificates, QueryClusterByDomain,
QueryClustersHashes, QueryMetricsOptions, Request, RunState, UpgradeMain, WorkerInfo,
QueryClustersHashes, QueryMetricsOptions, Request, ResponseStatus, RunState, UpgradeMain,
WorkerInfo,
},
response::{Response, ResponseContent, ResponseStatus},
response::{Response, ResponseContent},
};

use crate::ctl::{
Expand Down
6 changes: 6 additions & 0 deletions command/src/command.proto
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,12 @@ enum MetricsConfiguration {
CLEAR = 2;
}

enum ResponseStatus {
OK = 0;
PROCESSING = 1;
FAILURE = 2;
}

message WorkerInfo {
required uint32 id = 1;
required int32 pid = 2;
Expand Down
11 changes: 2 additions & 9 deletions command/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use crate::{
proto::command::{
AddBackend, AggregatedMetrics, AvailableMetrics, CertificateSummary, Cluster,
FilteredTimeSerie, ListenersList, LoadBalancingParams, PathRule, PathRuleKind,
RequestHttpFrontend, RequestTcpFrontend, RulePosition, RunState, WorkerInfo, WorkerMetrics,
RequestHttpFrontend, RequestTcpFrontend, ResponseStatus, RulePosition, RunState,
WorkerInfo, WorkerMetrics,
},
request::PROTOCOL_VERSION,
state::{ClusterId, ConfigState},
Expand Down Expand Up @@ -43,14 +44,6 @@ impl Response {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum ResponseStatus {
Ok,
Processing,
Failure,
}

/// details of a response sent by the main process to the client
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "type", content = "data", rename_all = "SCREAMING_SNAKE_CASE")]
Expand Down
3 changes: 1 addition & 2 deletions lib/src/https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ use sozu_command::{
logging,
proto::command::{
request::RequestType, AddCertificate, CertificateSummary, Cluster, HttpsListenerConfig,
RemoveCertificate, RemoveListener, ReplaceCertificate, Request, RequestHttpFrontend,
TlsVersion,
RemoveCertificate, RemoveListener, ReplaceCertificate, RequestHttpFrontend, TlsVersion,
},
ready::Ready,
request::WorkerRequest,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ use sozu_command::{
proto::command::{
request::RequestType, ActivateListener, AddBackend, Cluster, DeactivateListener,
HttpListenerConfig, HttpsListenerConfig, ListenerType, LoadBalancingAlgorithms, LoadMetric,
MetricsConfiguration, RemoveBackend, Request, TcpListenerConfig as CommandTcpListener,
RemoveBackend, ResponseStatus, TcpListenerConfig as CommandTcpListener, MetricsConfiguration,
},
ready::Ready,
request::WorkerRequest,
response::{Event, MessageId, ResponseContent, ResponseStatus, WorkerResponse},
response::{Event, MessageId, ResponseContent, WorkerResponse},
scm_socket::{Listeners, ScmSocket},
state::{get_certificate, get_cluster_ids_by_domain, ConfigState},
};
Expand Down

0 comments on commit 582d285

Please sign in to comment.