Skip to content

Commit b5218a3

Browse files
authored
Merge pull request #1122 from sozu-proxy/bump-prost
bump prost and prost-build to 0.13.1
2 parents 1a611cb + 1ad059c commit b5218a3

File tree

5 files changed

+19
-25
lines changed

5 files changed

+19
-25
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ nom = "^7.1.3"
2929
paw = "^1.0.0"
3030
serde = { version = "^1.0.203", features = ["derive"] }
3131
serde_json = "^1.0.117"
32-
prost = "^0.12.6"
32+
prost = "^0.13.1"
3333
tempfile = "^3.10.1"
3434
termion = "^4.0.0"
3535
thiserror = "^1.0.61"

command/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ memchr = "^2.7.2"
3636
mio = { version = "^1.0.0", features = ["os-poll", "net"] }
3737
nix = { version = "^0.29.0", features = ["socket", "uio"] }
3838
nom = "^7.1.3"
39-
prost = "^0.12.6"
39+
prost = "^0.13.1"
4040
rand = "^0.8.5"
4141
rusty_ulid = "^2.0.0"
4242
serde = { version = "^1.0.203", features = ["derive"] }
@@ -58,4 +58,4 @@ logs-trace = []
5858
travis-ci = { repository = "sozu-proxy/sozu" }
5959

6060
[build-dependencies]
61-
prost-build = { version = "^0.12.6" }
61+
prost-build = { version = "^0.13.1" }

command/src/proto/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use command::{
44
filtered_metrics::Inner, AggregatedMetrics, BackendMetrics, Bucket, FilteredHistogram,
55
FilteredMetrics,
66
};
7-
use prost::DecodeError;
7+
use prost::UnknownEnumValue;
88

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

2929
// Simple helper to build ResponseContent from ContentType

command/src/state.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::{
1010
net::SocketAddr,
1111
};
1212

13-
use prost::{DecodeError, Message};
13+
use prost::{Message, UnknownEnumValue};
1414

1515
use crate::{
1616
certificate::{calculate_fingerprint, CertificateError, Fingerprint},
@@ -44,8 +44,8 @@ pub enum StateError {
4444
NotFound { kind: ObjectKind, id: String },
4545
#[error("{kind:?} '{id}' already exists")]
4646
Exists { kind: ObjectKind, id: String },
47-
#[error("Wrong request: {0}")]
48-
WrongRequest(String),
47+
#[error("Wrong field value: {0}")]
48+
WrongFieldValue(UnknownEnumValue),
4949
#[error("Could not add certificate: {0}")]
5050
AddCertificate(CertificateError),
5151
#[error("Could not remove certificate: {0}")]
@@ -60,12 +60,6 @@ pub enum StateError {
6060
FileError(std::io::Error),
6161
}
6262

63-
impl From<DecodeError> for StateError {
64-
fn from(decode_error: DecodeError) -> Self {
65-
Self::WrongRequest(format!("Wrong field value: {decode_error}"))
66-
}
67-
}
68-
6963
/// The `ConfigState` represents the state of Sōzu's business, which is to forward traffic
7064
/// from frontends to backends. Hence, it contains all details about:
7165
///
@@ -223,7 +217,7 @@ impl ConfigState {
223217
}
224218

225219
fn remove_listener(&mut self, remove: &RemoveListener) -> Result<(), StateError> {
226-
match ListenerType::try_from(remove.proxy)? {
220+
match ListenerType::try_from(remove.proxy).map_err(StateError::WrongFieldValue)? {
227221
ListenerType::Http => self.remove_http_listener(&remove.address.clone().into()),
228222
ListenerType::Https => self.remove_https_listener(&remove.address.clone().into()),
229223
ListenerType::Tcp => self.remove_tcp_listener(&remove.address.clone().into()),
@@ -252,7 +246,7 @@ impl ConfigState {
252246
}
253247

254248
fn activate_listener(&mut self, activate: &ActivateListener) -> Result<(), StateError> {
255-
match ListenerType::try_from(activate.proxy)? {
249+
match ListenerType::try_from(activate.proxy).map_err(StateError::WrongFieldValue)? {
256250
ListenerType::Http => self
257251
.http_listeners
258252
.get_mut(&activate.address.clone().into())
@@ -281,7 +275,7 @@ impl ConfigState {
281275
}
282276

283277
fn deactivate_listener(&mut self, deactivate: &DeactivateListener) -> Result<(), StateError> {
284-
match ListenerType::try_from(deactivate.proxy)? {
278+
match ListenerType::try_from(deactivate.proxy).map_err(StateError::WrongFieldValue)? {
285279
ListenerType::Http => self
286280
.http_listeners
287281
.get_mut(&deactivate.address.clone().into())

0 commit comments

Comments
 (0)