Skip to content

Commit

Permalink
Merge pull request #1122 from sozu-proxy/bump-prost
Browse files Browse the repository at this point in the history
bump prost and prost-build to 0.13.1
  • Loading branch information
Keksoj authored Jul 25, 2024
2 parents 1a611cb + 1ad059c commit b5218a3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 25 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ nom = "^7.1.3"
paw = "^1.0.0"
serde = { version = "^1.0.203", features = ["derive"] }
serde_json = "^1.0.117"
prost = "^0.12.6"
prost = "^0.13.1"
tempfile = "^3.10.1"
termion = "^4.0.0"
thiserror = "^1.0.61"
Expand Down
4 changes: 2 additions & 2 deletions command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ memchr = "^2.7.2"
mio = { version = "^1.0.0", features = ["os-poll", "net"] }
nix = { version = "^0.29.0", features = ["socket", "uio"] }
nom = "^7.1.3"
prost = "^0.12.6"
prost = "^0.13.1"
rand = "^0.8.5"
rusty_ulid = "^2.0.0"
serde = { version = "^1.0.203", features = ["derive"] }
Expand All @@ -58,4 +58,4 @@ logs-trace = []
travis-ci = { repository = "sozu-proxy/sozu" }

[build-dependencies]
prost-build = { version = "^0.12.6" }
prost-build = { version = "^0.13.1" }
4 changes: 2 additions & 2 deletions command/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use command::{
filtered_metrics::Inner, AggregatedMetrics, BackendMetrics, Bucket, FilteredHistogram,
FilteredMetrics,
};
use prost::DecodeError;
use prost::UnknownEnumValue;

/// Contains all types received by and sent from Sōzu
pub mod command;
Expand All @@ -23,7 +23,7 @@ pub enum DisplayError {
#[error("Could not format the datetime to ISO 8601")]
DateTime,
#[error("unrecognized protobuf variant: {0}")]
DecodeError(DecodeError),
DecodeError(UnknownEnumValue),
}

// Simple helper to build ResponseContent from ContentType
Expand Down
18 changes: 6 additions & 12 deletions command/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
net::SocketAddr,
};

use prost::{DecodeError, Message};
use prost::{Message, UnknownEnumValue};

use crate::{
certificate::{calculate_fingerprint, CertificateError, Fingerprint},
Expand Down Expand Up @@ -44,8 +44,8 @@ pub enum StateError {
NotFound { kind: ObjectKind, id: String },
#[error("{kind:?} '{id}' already exists")]
Exists { kind: ObjectKind, id: String },
#[error("Wrong request: {0}")]
WrongRequest(String),
#[error("Wrong field value: {0}")]
WrongFieldValue(UnknownEnumValue),
#[error("Could not add certificate: {0}")]
AddCertificate(CertificateError),
#[error("Could not remove certificate: {0}")]
Expand All @@ -60,12 +60,6 @@ pub enum StateError {
FileError(std::io::Error),
}

impl From<DecodeError> for StateError {
fn from(decode_error: DecodeError) -> Self {
Self::WrongRequest(format!("Wrong field value: {decode_error}"))
}
}

/// The `ConfigState` represents the state of Sōzu's business, which is to forward traffic
/// from frontends to backends. Hence, it contains all details about:
///
Expand Down Expand Up @@ -223,7 +217,7 @@ impl ConfigState {
}

fn remove_listener(&mut self, remove: &RemoveListener) -> Result<(), StateError> {
match ListenerType::try_from(remove.proxy)? {
match ListenerType::try_from(remove.proxy).map_err(StateError::WrongFieldValue)? {
ListenerType::Http => self.remove_http_listener(&remove.address.clone().into()),
ListenerType::Https => self.remove_https_listener(&remove.address.clone().into()),
ListenerType::Tcp => self.remove_tcp_listener(&remove.address.clone().into()),
Expand Down Expand Up @@ -252,7 +246,7 @@ impl ConfigState {
}

fn activate_listener(&mut self, activate: &ActivateListener) -> Result<(), StateError> {
match ListenerType::try_from(activate.proxy)? {
match ListenerType::try_from(activate.proxy).map_err(StateError::WrongFieldValue)? {
ListenerType::Http => self
.http_listeners
.get_mut(&activate.address.clone().into())
Expand Down Expand Up @@ -281,7 +275,7 @@ impl ConfigState {
}

fn deactivate_listener(&mut self, deactivate: &DeactivateListener) -> Result<(), StateError> {
match ListenerType::try_from(deactivate.proxy)? {
match ListenerType::try_from(deactivate.proxy).map_err(StateError::WrongFieldValue)? {
ListenerType::Http => self
.http_listeners
.get_mut(&deactivate.address.clone().into())
Expand Down

0 comments on commit b5218a3

Please sign in to comment.