aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/layout/schema.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-11-27 16:17:41 +0100
committerAlex Auvolat <alex@adnab.me>2023-11-27 16:22:25 +0100
commit11e6fef93ce3ca56584fc99223b71da77d320dd7 (patch)
tree247fbb731db2e3ba76c83c57bec594d7861900a0 /src/rpc/layout/schema.rs
parent539a920313fff010b8a4291aeef58ec9a14ee635 (diff)
downloadgarage-11e6fef93ce3ca56584fc99223b71da77d320dd7.tar.gz
garage-11e6fef93ce3ca56584fc99223b71da77d320dd7.zip
cli: add layout history and layout assume-sync commands
Diffstat (limited to 'src/rpc/layout/schema.rs')
-rw-r--r--src/rpc/layout/schema.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rpc/layout/schema.rs b/src/rpc/layout/schema.rs
index 08db44ca..cb36297d 100644
--- a/src/rpc/layout/schema.rs
+++ b/src/rpc/layout/schema.rs
@@ -391,7 +391,10 @@ impl UpdateTracker {
changed
}
- pub(crate) fn set_max(&mut self, peer: Uuid, value: u64) -> bool {
+ /// This bumps the update tracker for a given node up to the specified value.
+ /// This has potential impacts on the correctness of Garage and should only
+ /// be used in very specific circumstances.
+ pub fn set_max(&mut self, peer: Uuid, value: u64) -> bool {
match self.0.get_mut(&peer) {
Some(e) if *e < value => {
*e = value;
@@ -412,6 +415,10 @@ impl UpdateTracker {
.min()
.unwrap_or(min_version)
}
+
+ pub fn get(&self, node: &Uuid) -> u64 {
+ self.0.get(node).copied().unwrap_or(0)
+ }
}
impl UpdateTrackers {