aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-01-11 17:31:09 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-13 13:58:47 +0100
commit6617a72220f2890fba0c0b7c099baf56142c494c (patch)
treee344b5db14fa1035cd4c19ad70cae1983fb143e0 /src/model
parent3770a34e3d3e861c91f60ec6e997f47a746c0040 (diff)
downloadgarage-6617a72220f2890fba0c0b7c099baf56142c494c.tar.gz
garage-6617a72220f2890fba0c0b7c099baf56142c494c.zip
Implement UploadPartCopy
Diffstat (limited to 'src/model')
-rw-r--r--src/model/version_table.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/model/version_table.rs b/src/model/version_table.rs
index e0b99770..839b1f4f 100644
--- a/src/model/version_table.rs
+++ b/src/model/version_table.rs
@@ -47,6 +47,20 @@ impl Version {
key,
}
}
+
+ pub fn has_part_number(&self, part_number: u64) -> bool {
+ let case1 = self
+ .parts_etags
+ .items()
+ .binary_search_by(|(k, _)| k.cmp(&part_number))
+ .is_ok();
+ let case2 = self
+ .blocks
+ .items()
+ .binary_search_by(|(k, _)| k.part_number.cmp(&part_number))
+ .is_ok();
+ case1 || case2
+ }
}
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]