mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-07-26 07:58:14 +00:00
chore: fix typos in rust code comment or error message
This commit is contained in:
@@ -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<Vec<String>>,
|
||||
}
|
||||
|
||||
@@ -841,7 +841,7 @@ pub struct GetBucketInfoResponse {
|
||||
pub created: DateTime<Utc>,
|
||||
/// List of global aliases for this bucket
|
||||
pub global_aliases: Vec<String>,
|
||||
/// 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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -150,7 +150,7 @@ impl TryFrom<HelperError> 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),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)?;
|
||||
|
||||
@@ -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")))
|
||||
|
||||
+1
-1
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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<WebsiteConfig, Error> {
|
||||
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
|
||||
|
||||
@@ -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<Vec<Uuid>, Error> {
|
||||
let cluster_layout = self.system.cluster_layout();
|
||||
|
||||
@@ -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(),
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
+1
-1
@@ -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))
|
||||
}
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+1
-1
@@ -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.
|
||||
///
|
||||
|
||||
@@ -293,7 +293,7 @@ mod v010 {
|
||||
pub roles: LwwMap<Uuid, NodeRoleV>,
|
||||
}
|
||||
|
||||
/// 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
|
||||
|
||||
@@ -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::<Vec<_>>();
|
||||
|
||||
// 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
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user