shardline_xet_adapter/
model.rs1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
7pub struct ReconstructionChunkRange {
8 pub start: u32,
10 pub end: u32,
12}
13
14#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
16pub struct ReconstructionUrlRange {
17 pub start: u64,
19 pub end: u64,
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
25pub struct ReconstructionTerm {
26 pub hash: String,
28 pub unpacked_length: u64,
30 pub range: ReconstructionChunkRange,
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
36pub struct ReconstructionFetchInfo {
37 pub range: ReconstructionChunkRange,
39 pub url: String,
41 pub url_range: ReconstructionUrlRange,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
47pub struct ReconstructionRangeDescriptor {
48 pub chunks: ReconstructionChunkRange,
50 pub bytes: ReconstructionUrlRange,
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
56pub struct ReconstructionMultiRangeFetch {
57 pub url: String,
59 pub ranges: Vec<ReconstructionRangeDescriptor>,
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
65pub struct FileReconstructionResponse {
66 pub offset_into_first_range: u64,
69 pub terms: Vec<ReconstructionTerm>,
71 pub fetch_info: BTreeMap<String, Vec<ReconstructionFetchInfo>>,
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
77pub struct FileReconstructionV2Response {
78 pub offset_into_first_range: u64,
81 pub terms: Vec<ReconstructionTerm>,
83 pub xorbs: BTreeMap<String, Vec<ReconstructionMultiRangeFetch>>,
85}
86
87#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
89pub struct BatchReconstructionResponse {
90 pub files: BTreeMap<String, Vec<ReconstructionTerm>>,
92 pub fetch_info: BTreeMap<String, Vec<ReconstructionFetchInfo>>,
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
98pub struct XorbUploadResponse {
99 pub was_inserted: bool,
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
105pub struct ShardUploadResponse {
106 pub result: u8,
108}