diff options
author | Trinity Pointard <trinity.pointard@gmail.com> | 2021-05-02 23:13:08 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-05-03 22:15:09 +0200 |
commit | e4b9e4e24d006373a20cfcbdac9dba5e399ee182 (patch) | |
tree | 620e24d182e6db4ad7ddca274eb8071d8241a1d6 /src/util | |
parent | 6644df6b969df3f7ff0516ab7acd9b600dff0a54 (diff) | |
download | garage-e4b9e4e24d006373a20cfcbdac9dba5e399ee182.tar.gz garage-e4b9e4e24d006373a20cfcbdac9dba5e399ee182.zip |
rename types to CamelCase
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/data.rs | 4 | ||||
-rw-r--r-- | src/util/error.rs | 28 | ||||
-rw-r--r-- | src/util/lib.rs | 1 |
3 files changed, 16 insertions, 17 deletions
diff --git a/src/util/data.rs b/src/util/data.rs index 56c7ab56..6df51cd0 100644 --- a/src/util/data.rs +++ b/src/util/data.rs @@ -88,7 +88,7 @@ impl FixedBytes32 { } /// A 32 bytes UUID -pub type UUID = FixedBytes32; +pub type Uuid = FixedBytes32; /// A 256 bit cryptographic hash, can be sha256 or blake2 depending on provenance pub type Hash = FixedBytes32; @@ -127,7 +127,7 @@ pub fn fasthash(data: &[u8]) -> FastHash { } /// Generate a random 32 bytes UUID -pub fn gen_uuid() -> UUID { +pub fn gen_uuid() -> Uuid { rand::thread_rng().gen::<[u8; 32]>().into() } diff --git a/src/util/error.rs b/src/util/error.rs index 2b862269..c3d84e63 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -7,24 +7,24 @@ use crate::data::*; /// RPC related errors #[derive(Debug, Error)] -pub enum RPCError { +pub enum RpcError { #[error(display = "Node is down: {:?}.", _0)] - NodeDown(UUID), + NodeDown(Uuid), #[error(display = "Timeout: {}", _0)] Timeout(#[error(source)] tokio::time::error::Elapsed), #[error(display = "HTTP error: {}", _0)] - HTTP(#[error(source)] http::Error), + Http(#[error(source)] http::Error), #[error(display = "Hyper error: {}", _0)] Hyper(#[error(source)] hyper::Error), #[error(display = "Messagepack encode error: {}", _0)] - RMPEncode(#[error(source)] rmp_serde::encode::Error), + RmpEncode(#[error(source)] rmp_serde::encode::Error), #[error(display = "Messagepack decode error: {}", _0)] - RMPDecode(#[error(source)] rmp_serde::decode::Error), + RmpDecode(#[error(source)] rmp_serde::decode::Error), #[error(display = "Too many errors: {:?}", _0)] TooManyErrors(Vec<String>), @@ -40,26 +40,26 @@ pub enum Error { Hyper(#[error(source)] hyper::Error), #[error(display = "HTTP error: {}", _0)] - HTTP(#[error(source)] http::Error), + Http(#[error(source)] http::Error), #[error(display = "Invalid HTTP header value: {}", _0)] - HTTPHeader(#[error(source)] http::header::ToStrError), + HttpHeader(#[error(source)] http::header::ToStrError), #[error(display = "TLS error: {}", _0)] - TLS(#[error(source)] rustls::TLSError), + Tls(#[error(source)] rustls::TLSError), #[error(display = "PKI error: {}", _0)] - PKI(#[error(source)] webpki::Error), + Pki(#[error(source)] webpki::Error), #[error(display = "Sled error: {}", _0)] Sled(#[error(source)] sled::Error), #[error(display = "Messagepack encode error: {}", _0)] - RMPEncode(#[error(source)] rmp_serde::encode::Error), + RmpEncode(#[error(source)] rmp_serde::encode::Error), #[error(display = "Messagepack decode error: {}", _0)] - RMPDecode(#[error(source)] rmp_serde::decode::Error), + RmpDecode(#[error(source)] rmp_serde::decode::Error), #[error(display = "JSON error: {}", _0)] - JSON(#[error(source)] serde_json::error::Error), + Json(#[error(source)] serde_json::error::Error), #[error(display = "TOML decode error: {}", _0)] TomlDecode(#[error(source)] toml::de::Error), @@ -67,13 +67,13 @@ pub enum Error { TokioJoin(#[error(source)] tokio::task::JoinError), #[error(display = "RPC call error: {}", _0)] - RPC(#[error(source)] RPCError), + Rpc(#[error(source)] RpcError), #[error(display = "Remote error: {} (status code {})", _0, _1)] RemoteError(String, StatusCode), #[error(display = "Bad RPC: {}", _0)] - BadRPC(String), + BadRpc(String), #[error(display = "Corrupt data: does not match hash {:?}", _0)] CorruptData(Hash), diff --git a/src/util/lib.rs b/src/util/lib.rs index 15d020cc..c080e3a3 100644 --- a/src/util/lib.rs +++ b/src/util/lib.rs @@ -1,4 +1,3 @@ -#![allow(clippy::upper_case_acronyms)] //! Crate containing common functions and types used in Garage #[macro_use] |