From e331f88c8596863821708c18108d3f0befa6e5dd Mon Sep 17 00:00:00 2001 From: Gwen Lg Date: Tue, 27 Jan 2026 17:11:31 +0100 Subject: [PATCH] chore: fix typos in rust code comment or error message --- src/api/admin/api.rs | 6 +++--- src/api/admin/openapi.rs | 4 ++-- src/api/common/common_error.rs | 2 +- src/api/common/cors.rs | 2 +- src/api/common/router_macros.rs | 2 +- src/api/s3/get.rs | 2 +- src/api/s3/router.rs | 4 ++-- src/api/s3/website.rs | 6 +++--- src/block/manager.rs | 2 +- src/db/fjall_adapter.rs | 2 +- src/db/lib.rs | 2 +- src/net/lib.rs | 2 +- src/net/message.rs | 2 +- src/rpc/layout/mod.rs | 2 +- src/rpc/rpc_helper.rs | 12 ++++++------ src/web/web_server.rs | 2 +- 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/api/admin/api.rs b/src/api/admin/api.rs index da25b6a2..83d456a4 100644 --- a/src/api/admin/api.rs +++ b/src/api/admin/api.rs @@ -262,7 +262,7 @@ pub struct GetClusterHealthResponse { pub status: String, /// the number of nodes this Garage node has had a TCP connection to since the daemon started pub known_nodes: usize, - /// the nubmer of nodes this Garage node currently has an open connection to + /// the number of nodes this Garage node currently has an open connection to pub connected_nodes: usize, /// the number of storage nodes currently registered in the cluster layout pub storage_nodes: usize, @@ -387,7 +387,7 @@ pub struct UpdateAdminTokenRequestBody { /// `GetClusterStatus`, etc), or the special value `*` to allow all /// admin endpoints. **WARNING:** Granting a scope of `CreateAdminToken` or /// `UpdateAdminToken` trivially allows for privilege escalation, and is thus - /// functionnally equivalent to granting a scope of `*`. + /// functionally equivalent to granting a scope of `*`. pub scope: Option>, } @@ -841,7 +841,7 @@ pub struct GetBucketInfoResponse { pub created: DateTime, /// List of global aliases for this bucket pub global_aliases: Vec, - /// Whether website acces is enabled for this bucket + /// Whether website access is enabled for this bucket pub website_access: bool, #[serde(default)] /// Website configuration for this bucket diff --git a/src/api/admin/openapi.rs b/src/api/admin/openapi.rs index 285d499c..c40e7c62 100644 --- a/src/api/admin/openapi.rs +++ b/src/api/admin/openapi.rs @@ -878,9 +878,9 @@ impl Modify for SecurityAddon { info( version = "v2.2.0", title = "Garage administration API", - description = "Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks. + description = "Administrate your Garage cluster programmatically, including status, layout, keys, buckets, and maintenance tasks. -*Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is early stage and can contain bugs, so be careful and please report any issues on our issue tracker.*", +*Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionally, this specification is early stage and can contain bugs, so be careful and please report any issues on our issue tracker.*", contact( name = "The Garage team", email = "garagehq@deuxfleurs.fr", diff --git a/src/api/common/common_error.rs b/src/api/common/common_error.rs index e596a6e9..e110b1d6 100644 --- a/src/api/common/common_error.rs +++ b/src/api/common/common_error.rs @@ -150,7 +150,7 @@ impl TryFrom for CommonError { pub fn pass_helper_error(err: HelperError) -> CommonError { match CommonError::try_from(err) { Ok(e) => e, - Err(e) => panic!("Helper error `{}` should hot have happenned here", e), + Err(e) => panic!("Helper error `{}` should hot have happened here", e), } } diff --git a/src/api/common/cors.rs b/src/api/common/cors.rs index a0ba6e48..6f524bf4 100644 --- a/src/api/common/cors.rs +++ b/src/api/common/cors.rs @@ -88,7 +88,7 @@ pub fn handle_options_api( // the same name, its CORS rules won't be applied // and will be shadowed by the rules of the globally // existing bucket (but this is inevitable because - // OPTIONS calls are not auhtenticated). + // OPTIONS calls are not authenticated). if let Some(bn) = bucket_name { let helper = garage.bucket_helper(); let bucket_opt = helper.resolve_global_bucket_fast(&bn)?; diff --git a/src/api/common/router_macros.rs b/src/api/common/router_macros.rs index 79b40e80..79749955 100644 --- a/src/api/common/router_macros.rs +++ b/src/api/common/router_macros.rs @@ -191,7 +191,7 @@ macro_rules! router_match { }}; (@@parse_param $query:expr, parse_default($default:expr), $param:ident) => {{ // extract and parse optional query parameter - // using provided value as default if paramter is missing + // using provided value as default if parameter is missing $query.$param.take().map(|x| x .parse() .map_err(|_| Error::bad_request("Failed to parse query parameter"))) diff --git a/src/api/s3/get.rs b/src/api/s3/get.rs index 16e7a3da..26565d50 100644 --- a/src/api/s3/get.rs +++ b/src/api/s3/get.rs @@ -378,7 +378,7 @@ pub async fn handle_get_without_ctx( pub(crate) fn check_version_not_deleted(version: &Version) -> Result<(), Error> { if version.deleted.get() { // the version was deleted between when the object_table was consulted - // and now, this could mean the object was deleted, or overriden. + // and now, this could mean the object was deleted, or overridden. // Rather than say the key doesn't exist, return a transient error // to signal the client to try again. return Err(CommonError::InternalError(UtilError::Message( diff --git a/src/api/s3/router.rs b/src/api/s3/router.rs index e3f58490..6616c47f 100644 --- a/src/api/s3/router.rs +++ b/src/api/s3/router.rs @@ -355,7 +355,7 @@ impl Endpoint { if let Some(x_id) = query.x_id.take() { if x_id != res.name() { // I think AWS ignores the x-id parameter. - // Let's make this at least be a warnin to help debugging. + // Let's make this at least be a warning to help debugging. warn!( "x-id ({}) does not match parsed endpoint ({})", x_id, @@ -949,7 +949,7 @@ mod tests { GET "/?uploads&delimiter=/&prefix=photos/2006/" => ListMultipartUploads GET "/?uploads&delimiter=D&encoding-type=EncodingType&key-marker=KeyMarker&max-uploads=1&prefix=Prefix&upload-id-marker=UploadIdMarker" => ListMultipartUploads GET "/" => ListObjects - GET "/?prefix=N&marker=Ned&max-keys=40" => ListObjects + GET "/?prefix=N&marker=Need&max-keys=40" => ListObjects GET "/?delimiter=/" => ListObjects GET "/?prefix=photos/2006/&delimiter=/" => ListObjects diff --git a/src/api/s3/website.rs b/src/api/s3/website.rs index 4dbc2aa8..c984ce2a 100644 --- a/src/api/s3/website.rs +++ b/src/api/s3/website.rs @@ -213,7 +213,7 @@ impl WebsiteConfiguration { } if self.routing_rules.rules.len() > 1000 { // we will do linear scans, best to avoid overly long configuration. The - // limit was choosen arbitrarily + // limit was chosen arbitrarily return Err(Error::bad_request( "Bad XML: RoutingRules can't have more than 1000 child elements", )); @@ -225,7 +225,7 @@ impl WebsiteConfiguration { pub fn into_garage_website_config(self) -> Result { if self.redirect_all_requests_to.is_some() { Err(Error::NotImplemented( - "RedirectAllRequestsTo is not currently implemented in Garage, however its effect can be emulated using a single inconditional RoutingRule.".into(), + "RedirectAllRequestsTo is not currently implemented in Garage, however its effect can be emulated using a single unconditional RoutingRule.".into(), )) } else { Ok(WebsiteConfig { @@ -251,7 +251,7 @@ impl WebsiteConfiguration { hostname: rule.redirect.hostname.map(|h| h.0), protocol: rule.redirect.protocol.map(|p| p.0), // aws default to 301, which i find punitive in case of - // missconfiguration (can be permanently cached on the + // misconfiguration (can be permanently cached on the // user agent) http_redirect_code: rule .redirect diff --git a/src/block/manager.rs b/src/block/manager.rs index 5c62d3f8..b84cb9d1 100644 --- a/src/block/manager.rs +++ b/src/block/manager.rs @@ -344,7 +344,7 @@ impl BlockManager { /// Returns the set of nodes that should store a copy of a given block. /// These are the nodes assigned to the block's hash in the current /// layout version only: since blocks are immutable, we don't need to - /// do complex logic when several layour versions are active at once, + /// do complex logic when several layout versions are active at once, /// just move them directly to the new nodes. pub(crate) fn storage_nodes_of(&self, hash: &Hash) -> Result, Error> { let cluster_layout = self.system.cluster_layout(); diff --git a/src/db/fjall_adapter.rs b/src/db/fjall_adapter.rs index 25913a1f..ecdece4b 100644 --- a/src/db/fjall_adapter.rs +++ b/src/db/fjall_adapter.rs @@ -272,7 +272,7 @@ impl<'a> FjallTx<'a> { fn get_tree(&self, i: usize) -> TxOpResult<&TransactionalPartitionHandle> { self.trees.get(i).map(|tup| &tup.1).ok_or_else(|| { TxOpError(Error( - "invalid tree id (it might have been openned after the transaction started)".into(), + "invalid tree id (it might have been opened after the transaction started)".into(), )) }) } diff --git a/src/db/lib.rs b/src/db/lib.rs index 2a467c7c..42f49b6f 100644 --- a/src/db/lib.rs +++ b/src/db/lib.rs @@ -133,7 +133,7 @@ impl Db { Err(TxError::Db(tx_e)) } (Err(TxError::Db(tx_e)), Some(Ok(_))) => { - // Transaction encounterred a DB error when commiting the transaction, + // Transaction encounterred a DB error when committing the transaction, // after user code was called Err(TxError::Db(tx_e)) } diff --git a/src/net/lib.rs b/src/net/lib.rs index 8e30e40f..47cac5d6 100644 --- a/src/net/lib.rs +++ b/src/net/lib.rs @@ -10,7 +10,7 @@ //! //! Of particular interest, read the documentation for the `netapp::NetApp` type, //! the `message::Message` trait, and `proto::RequestPriority` to learn more -//! about message priorization. +//! about message prioritization. //! Also check out the examples to learn how to use this crate. pub mod bytes_buf; diff --git a/src/net/message.rs b/src/net/message.rs index 59afb058..bbd9cede 100644 --- a/src/net/message.rs +++ b/src/net/message.rs @@ -14,7 +14,7 @@ use crate::util::*; /// Priority of a request (click to read more about priorities). /// -/// This priority value is used to priorize messages +/// This priority value is used to prioritize messages /// in the send queue of the client, and their responses in the send queue of the /// server. Lower values mean higher priority. /// diff --git a/src/rpc/layout/mod.rs b/src/rpc/layout/mod.rs index cfd576a7..d18c603d 100644 --- a/src/rpc/layout/mod.rs +++ b/src/rpc/layout/mod.rs @@ -293,7 +293,7 @@ mod v010 { pub roles: LwwMap, } - /// The tracker of acknowlegments and data syncs around the cluster + /// The tracker of acknowledgments and data syncs around the cluster #[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq)] pub struct UpdateTrackers { /// The highest layout version number each node has ack'ed diff --git a/src/rpc/rpc_helper.rs b/src/rpc/rpc_helper.rs index 3d56957e..35d0670b 100644 --- a/src/rpc/rpc_helper.rs +++ b/src/rpc/rpc_helper.rs @@ -336,14 +336,14 @@ impl RpcHelper { { // Once quorum is reached, other requests don't matter. // What we do here is only send the required number of requests - // to reach a quorum, priorizing nodes with the lowest latency. + // to reach a quorum, prioritizing nodes with the lowest latency. // When there are errors, we start new requests to compensate. // TODO: this could be made more aggressive, e.g. if after 2x the // average ping of a given request, the response is not yet received, // preemptively send an additional request to any remaining nodes. - // Reorder requests to priorize closeness / low latency + // Reorder requests to prioritize closeness / low latency let request_order = self.request_order(self.0.layout.read().unwrap().current()?, to.iter().copied()); let send_all_at_once = strategy.rs_send_all_at_once.unwrap_or(false); @@ -558,7 +558,7 @@ impl RpcHelper { /// /// 1. ask first all nodes of all currently active layout versions /// -> ask the preferred node in all layout versions (older to newer), - /// then the second preferred onde in all verions, etc. + /// then the second preferred onde in all versions, etc. /// -> we start by the oldest active layout version first, because a majority /// of blocks will have been saved before the layout change /// 2. ask all nodes of historical layout versions, for blocks which have not @@ -635,8 +635,8 @@ impl RpcHelper { // The tuples are as follows: // (is another node?, is another zone?, latency, node ID, request future) // We store all of these tuples in a vec that we can sort. - // By sorting this vec, we priorize ourself, then nodes in the same zone, - // and within a same zone we priorize nodes with the lowest latency. + // By sorting this vec, we prioritize ourself, then nodes in the same zone, + // and within a same zone we prioritize nodes with the lowest latency. let mut nodes = nodes .map(|to| { let peer_zone = layout.get_node_zone(&to).unwrap_or(""); @@ -654,7 +654,7 @@ impl RpcHelper { }) .collect::>(); - // Sort requests by (priorize ourself, priorize same zone, priorize low latency) + // Sort requests by (prioritize ourself, prioritize same zone, prioritize low latency) nodes.sort_by_key(|(diffnode, diffzone, ping, _to)| (*diffnode, *diffzone, *ping)); nodes diff --git a/src/web/web_server.rs b/src/web/web_server.rs index beb01c2d..dffd84d9 100644 --- a/src/web/web_server.rs +++ b/src/web/web_server.rs @@ -644,7 +644,7 @@ fn path_to_keys( } else { Ok(RoutingResult::LoadOrRedirect { redirect_if_exists: Some(format!("{key}/{index}")), - // we can't use `path` because key might have changed substentially in case of + // we can't use `path` because key might have changed substantially in case of // routing rules redirect_url: percent_encoding::percent_encode( format!("/{key}/").as_bytes(),