docs: add missing backticks in documentation

this improve readability of documentation.
enable associated clippy lint `doc_markdown`
This commit is contained in:
Gwen Lg
2026-01-25 23:46:05 +01:00
committed by Alex
parent 6cde00073f
commit 08fd6e659f
58 changed files with 175 additions and 174 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ pub struct WorkerInfo {
pub last_error: Option<(String, u64)>,
}
/// WorkerStatus is a struct returned by the worker with a bunch of canonical
/// `WorkerStatus` is a struct returned by the worker with a bunch of canonical
/// fields to indicate their status to CLI users. All fields are optional.
#[derive(Clone, Debug, Default)]
pub struct WorkerStatus {
@@ -39,7 +39,7 @@ pub struct WorkerStatus {
}
impl BackgroundRunner {
/// Create a new BackgroundRunner
/// Create a new `BackgroundRunner`
pub fn new(stop_signal: watch::Receiver<bool>) -> (Arc<Self>, tokio::task::JoinHandle<()>) {
let (send_worker, worker_out) = mpsc::unbounded_channel::<Box<dyn Worker>>();
+2 -2
View File
@@ -34,11 +34,11 @@ pub trait Worker: Send {
}
/// Work: do a basic unit of work, if one is available (otherwise, should return
/// WorkerState::Idle immediately). We will do our best to not interrupt this future in the
/// `WorkerState::Idle` immediately). We will do our best to not interrupt this future in the
/// middle of processing, it will only be interrupted at the last minute when Garage is trying
/// to exit and this hasn't returned yet. This function may return an error to indicate that
/// its unit of work could not be processed due to an error: the error will be logged and
/// .work() will be called again after a short delay.
/// .`work()` will be called again after a short delay.
async fn work(&mut self, must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error>;
/// Wait for work: await for some task to become available. This future can be interrupted in
+4 -4
View File
@@ -47,7 +47,7 @@ pub struct Config {
/// Maximum number of parallel block writes per PUT request
/// Higher values improve throughput but increase memory usage
/// Default: 3, Recommended: 10-30 for NVMe, 3-10 for HDD
/// Default: 3, Recommended: 10-30 for `NVMe`, 3-10 for HDD
#[serde(default = "default_block_max_concurrent_writes_per_request")]
pub block_max_concurrent_writes_per_request: usize,
/// Number of replicas. Can be any positive integer, but uneven numbers are more favorable.
@@ -95,7 +95,7 @@ pub struct Config {
pub rpc_secret_file: Option<PathBuf>,
/// Address to bind for RPC
pub rpc_bind_addr: SocketAddr,
/// Bind outgoing sockets to rpc_bind_addr's IP address as well
/// Bind outgoing sockets to `rpc_bind_addr`'s IP address as well
#[serde(default)]
pub rpc_bind_outgoing: bool,
/// Public IP address of this node
@@ -154,7 +154,7 @@ pub struct Config {
pub allow_punycode: bool,
}
/// Value for data_dir: either a single directory or a list of dirs with attributes
/// Value for `data_dir`: either a single directory or a list of dirs with attributes
#[derive(Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum DataDirEnum {
@@ -166,7 +166,7 @@ pub enum DataDirEnum {
pub struct DataDir {
/// Path to the data directory
pub path: PathBuf,
/// Capacity of the drive (required if read_only is false)
/// Capacity of the drive (required if `read_only` is false)
#[serde(default)]
pub capacity: Option<String>,
/// Whether this is a legacy read-only path (capacity should be None)
+4 -4
View File
@@ -29,10 +29,10 @@ pub trait Crdt {
/// `Option<T>` implements Crdt for any type T, even if T doesn't implement CRDT itself: when
/// different values are detected, they are always merged to None. This can be used for value
/// types which shoulnd't be merged, instead of trying to merge things when we know we don't want
/// to merge them (which is what the AutoCrdt trait is used for most of the time). This cases
/// arises very often, for example with a Lww or a LwwMap: the value type has to be a CRDT so that
/// to merge them (which is what the `AutoCrdt` trait is used for most of the time). This cases
/// arises very often, for example with a Lww or a `LwwMap`: the value type has to be a CRDT so that
/// we have a rule for what to do when timestamps aren't enough to disambiguate (in a distributed
/// system, anything can happen!), and with AutoCrdt the rule is to make an arbitrary (but
/// system, anything can happen!), and with `AutoCrdt` the rule is to make an arbitrary (but
/// deterministic) choice between the two. When using an `Option<T>` instead with this impl, ambiguity
/// cases are explicitly stored as None, which allows us to detect the ambiguity and handle it in
/// the way we want. (this can only work if we are happy with losing the value when an ambiguity
@@ -52,7 +52,7 @@ where
/// defined by the merge rule: `a ⊔ b = max(a, b)`. Implement this trait for your type
/// to enable this behavior.
pub trait AutoCrdt: Ord + Clone + std::fmt::Debug {
/// WARN_IF_DIFFERENT: emit a warning when values differ. Set this to true if
/// `WARN_IF_DIFFERENT`: emit a warning when values differ. Set this to true if
/// different values in your application should never happen. Set this to false
/// if you are actually relying on the semantics of `a ⊔ b = max(a, b)`.
const WARN_IF_DIFFERENT: bool;
+1 -1
View File
@@ -19,7 +19,7 @@ use crate::crdt::crdt::*;
/// Internally, the map is stored as a vector of keys and values, sorted by ascending key order.
/// This is why the key type `K` must implement `Ord` (and also to ensure a unique serialization,
/// such that two values can be compared for equality based on their hashes). As a consequence,
/// insertions take `O(n)` time. This means that LWWMap should be used for reasonably small maps.
/// insertions take `O(n)` time. This means that `LWWMap` should be used for reasonably small maps.
/// However, note that even if we were using a more efficient data structure such as a `BTreeMap`,
/// the serialization cost `O(n)` would still have to be paid at each modification, so we are
/// actually not losing anything here.
+1 -1
View File
@@ -73,7 +73,7 @@ impl FixedBytes32 {
pub fn to_vec(self) -> Vec<u8> {
self.0.to_vec()
}
/// Try building a FixedBytes32 from a slice
/// Try building a `FixedBytes32` from a slice
/// Return None if the slice is not 32 bytes long
pub fn try_from(by: &[u8]) -> Option<Self> {
if by.len() != 32 {
+4 -4
View File
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
/// Serialize to MessagePack, without versioning
/// (see garage_util::migrate for functions that manage versioned
/// Serialize to `MessagePack`, without versioning
/// (see `garage_util::migrate` for functions that manage versioned
/// data formats)
pub fn nonversioned_encode<T>(val: &T) -> Result<Vec<u8>, rmp_serde::encode::Error>
where
@@ -13,8 +13,8 @@ where
Ok(wr)
}
/// Deserialize from MessagePack, without versioning
/// (see garage_util::migrate for functions that manage versioned
/// Deserialize from `MessagePack`, without versioning
/// (see `garage_util::migrate` for functions that manage versioned
/// data formats)
pub fn nonversioned_decode<T>(bytes: &[u8]) -> Result<T, rmp_serde::decode::Error>
where
+1 -1
View File
@@ -129,7 +129,7 @@ where
}
}
/// Trait to map any error type to Error::Message
/// Trait to map any error type to `Error::Message`
pub trait OkOrMessage {
type S;
fn ok_or_message<M: Into<String>>(self, message: M) -> Result<Self::S, Error>;
+1 -1
View File
@@ -54,7 +54,7 @@ impl<T: InitialFormat> Migrate for T {
}
}
/// Internal type used by InitialFormat, not meant for general use.
/// Internal type used by `InitialFormat`, not meant for general use.
#[derive(Serialize, Deserialize)]
pub enum NoPrevious {}