1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use crate::manifest::listing::Listing;
use crate::repository::ChunkID;
use chrono::prelude::*;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Copy, Clone, Eq, PartialEq, Debug)]
pub struct ChunkLocation {
pub id: ChunkID,
pub start: u64,
pub length: u64,
}
impl PartialOrd for ChunkLocation {
fn partial_cmp(&self, other: &ChunkLocation) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for ChunkLocation {
fn cmp(&self, other: &ChunkLocation) -> Ordering {
self.start.cmp(&other.start)
}
}
#[derive(Serialize, Deserialize)]
pub struct Archive {
pub name: String,
pub objects: HashMap<String, Vec<ChunkLocation>>,
pub namespace: Vec<String>,
pub timestamp: DateTime<FixedOffset>,
pub listing: Listing,
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct Extent {
pub start: u64,
pub end: u64,
}