garage_table/replication/
parameters.rs1use std::time::Duration;
2
3use garage_rpc::layout::*;
4use garage_util::data::*;
5use garage_util::error::Error;
6
7pub trait TableReplication: Send + Sync + 'static {
9 type WriteSets: AsRef<Vec<Vec<Uuid>>> + AsMut<Vec<Vec<Uuid>>> + Send + Sync + 'static;
10
11 const ANTI_ENTROPY_INTERVAL: Duration;
12
13 fn storage_nodes(&self, hash: &Hash) -> Result<Vec<Uuid>, Error>;
18
19 fn read_nodes(&self, hash: &Hash) -> Result<Vec<Uuid>, Error>;
21 fn read_quorum(&self) -> Result<usize, Error>;
23
24 fn write_sets(&self, hash: &Hash) -> Result<Self::WriteSets, Error>;
26 fn write_quorum(&self) -> Result<usize, Error>;
28
29 fn partition_of(&self, hash: &Hash) -> Result<Partition, Error>;
32 fn sync_partitions(&self) -> Result<SyncPartitions, Error>;
34}
35
36#[derive(Debug)]
37pub struct SyncPartitions {
38 pub layout_version: u64,
39 pub partitions: Vec<SyncPartition>,
40}
41
42#[derive(Debug)]
43pub struct SyncPartition {
44 pub partition: Partition,
45 pub first_hash: Hash,
46 pub last_hash: Hash,
47 pub storage_sets: Vec<Vec<Uuid>>,
48}