mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-11 14:56:53 +00:00
Merge branch 'main' into 1686a/s3-redirects
This commit is contained in:
@@ -20,9 +20,7 @@ garage_net.workspace = true
|
||||
arc-swap.workspace = true
|
||||
async-trait.workspace = true
|
||||
blake2.workspace = true
|
||||
bytes.workspace = true
|
||||
bytesize.workspace = true
|
||||
digest.workspace = true
|
||||
err-derive.workspace = true
|
||||
hexdump.workspace = true
|
||||
xxhash-rust.workspace = true
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::background::{WorkerInfo, WorkerStatus};
|
||||
use crate::error::Error;
|
||||
use crate::time::now_msec;
|
||||
|
||||
// All workers that haven't exited for this time after an exit signal was recieved
|
||||
// All workers that haven't exited for this time after an exit signal was received
|
||||
// will be interrupted in the middle of whatever they are doing.
|
||||
const EXIT_DEADLINE: Duration = Duration::from_secs(8);
|
||||
|
||||
@@ -54,7 +54,7 @@ pub trait Worker: Send {
|
||||
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
|
||||
/// the middle for any reason, for example if an interrupt signal was recieved.
|
||||
/// the middle for any reason, for example if an interrupt signal was received.
|
||||
async fn wait_for_work(&mut self) -> WorkerState;
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -31,6 +31,9 @@ pub struct Config {
|
||||
#[serde(default)]
|
||||
pub use_local_tz: bool,
|
||||
|
||||
/// Optional directory where metadata snapshots will be store
|
||||
pub metadata_snapshots_dir: Option<PathBuf>,
|
||||
|
||||
/// Automatic snapshot interval for metadata
|
||||
#[serde(default)]
|
||||
pub metadata_auto_snapshot_interval: Option<String>,
|
||||
@@ -93,12 +96,12 @@ pub struct Config {
|
||||
/// the addresses announced to other peers to a specific subnet.
|
||||
pub rpc_public_addr_subnet: Option<String>,
|
||||
|
||||
/// Timeout for Netapp's ping messagess
|
||||
/// Timeout for Netapp's ping messages
|
||||
pub rpc_ping_timeout_msec: Option<u64>,
|
||||
/// Timeout for Netapp RPC calls
|
||||
pub rpc_timeout_msec: Option<u64>,
|
||||
|
||||
// -- Bootstraping and discovery
|
||||
// -- Bootstrapping and discovery
|
||||
/// Bootstrap peers RPC address
|
||||
#[serde(default)]
|
||||
pub bootstrap_peers: Vec<String>,
|
||||
|
||||
@@ -33,8 +33,8 @@ pub trait Crdt {
|
||||
/// 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
|
||||
/// determinstic) choice between the two. When using an Option<T> instead with this impl, ambiguity
|
||||
/// cases are explicitely stored as None, which allows us to detect the ambiguity and handle it in
|
||||
/// 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
|
||||
/// arises)
|
||||
impl<T> Crdt for Option<T>
|
||||
|
||||
@@ -16,7 +16,7 @@ use crate::crdt::crdt::*;
|
||||
/// In our case, we add the constraint that the value that is wrapped inside the LWW CRDT must
|
||||
/// itself be a CRDT: in the case when the timestamp does not allow us to decide on which value to
|
||||
/// keep, the merge rule of the inner CRDT is applied on the wrapped values. (Note that all types
|
||||
/// that implement the `Ord` trait get a default CRDT implemetnation that keeps the maximum value.
|
||||
/// that implement the `Ord` trait get a default CRDT implementation that keeps the maximum value.
|
||||
/// This enables us to use LWW directly with primitive data types such as numbers or strings. It is
|
||||
/// generally desirable in this case to never explicitly produce LWW values with the same timestamp
|
||||
/// but different inner values, as the rule to keep the maximum value isn't generally the desired
|
||||
@@ -28,9 +28,9 @@ use crate::crdt::crdt::*;
|
||||
///
|
||||
/// Given that clocks are not too desynchronized, this assumption
|
||||
/// is enough for most cases, as there is few chance that two humans
|
||||
/// coordonate themself faster than the time difference between two NTP servers.
|
||||
/// coordinate themself faster than the time difference between two NTP servers.
|
||||
///
|
||||
/// As a more concret example, let's suppose you want to upload a file
|
||||
/// As a more concrete example, let's suppose you want to upload a file
|
||||
/// with the same key (path) in the same bucket at the very same time.
|
||||
/// For each request, the file will be timestamped by the receiving server
|
||||
/// and may differ from what you observed with your atomic clock!
|
||||
@@ -94,16 +94,16 @@ where
|
||||
&self.v
|
||||
}
|
||||
|
||||
/// Take the value inside the CRDT (discards the timesamp)
|
||||
/// Take the value inside the CRDT (discards the timestamp)
|
||||
pub fn take(self) -> T {
|
||||
self.v
|
||||
}
|
||||
|
||||
/// Get a mutable reference to the CRDT's value
|
||||
///
|
||||
/// This is usefull to mutate the inside value without changing the LWW timestamp.
|
||||
/// This is useful to mutate the inside value without changing the LWW timestamp.
|
||||
/// When such mutation is done, the merge between two LWW values is done using the inner
|
||||
/// CRDT's merge operation. This is usefull in the case where the inner CRDT is a large
|
||||
/// CRDT's merge operation. This is useful in the case where the inner CRDT is a large
|
||||
/// data type, such as a map, and we only want to change a single item in the map.
|
||||
/// To do this, we can produce a "CRDT delta", i.e. a LWW that contains only the modification.
|
||||
/// This delta consists in a LWW with the same timestamp, and the map
|
||||
|
||||
@@ -109,7 +109,7 @@ where
|
||||
}
|
||||
|
||||
/// Takes all of the values of the map and returns them. The current map is reset to the
|
||||
/// empty map. This is very usefull to produce in-place a new map that contains only a delta
|
||||
/// empty map. This is very useful to produce in-place a new map that contains only a delta
|
||||
/// that modifies a certain value:
|
||||
///
|
||||
/// ```ignore
|
||||
@@ -162,7 +162,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets a reference to all of the items, as a slice. Usefull to iterate on all map values.
|
||||
/// Gets a reference to all of the items, as a slice. Useful to iterate on all map values.
|
||||
/// In most case you will want to ignore the timestamp (second item of the tuple).
|
||||
pub fn items(&self) -> &[(K, u64, V)] {
|
||||
&self.vals[..]
|
||||
|
||||
@@ -57,7 +57,7 @@ where
|
||||
Err(_) => None,
|
||||
}
|
||||
}
|
||||
/// Gets a reference to all of the items, as a slice. Usefull to iterate on all map values.
|
||||
/// Gets a reference to all of the items, as a slice. Useful to iterate on all map values.
|
||||
pub fn items(&self) -> &[(K, V)] {
|
||||
&self.vals[..]
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Serialize to MessagePacki, without versionning
|
||||
/// (see garage_util::migrate for functions that manage versionned
|
||||
/// 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 MessagePacki, without versionning
|
||||
/// (see garage_util::migrate for functions that manage versionned
|
||||
/// 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
|
||||
|
||||
Reference in New Issue
Block a user