From 6617a72220f2890fba0c0b7c099baf56142c494c Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 11 Jan 2022 17:31:09 +0100 Subject: Implement UploadPartCopy --- src/model/version_table.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/model') 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)] -- cgit v1.2.3