garage/src/table/replication/parameters.rs

22 lines
627 B
Rust
Raw Normal View History

2021-03-16 11:18:03 +00:00
use garage_rpc::ring::*;
2021-03-11 15:54:15 +00:00
use garage_util::data::*;
pub trait TableReplication: Send + Sync {
// See examples in table_sharded.rs and table_fullcopy.rs
// To understand various replication methods
// Which nodes to send reads from
2021-03-16 10:14:27 +00:00
fn read_nodes(&self, hash: &Hash) -> Vec<UUID>;
2021-03-11 15:54:15 +00:00
fn read_quorum(&self) -> usize;
// Which nodes to send writes to
2021-03-16 10:14:27 +00:00
fn write_nodes(&self, hash: &Hash) -> Vec<UUID>;
fn write_quorum(&self) -> usize;
2021-03-11 15:54:15 +00:00
fn max_write_errors(&self) -> usize;
2021-03-16 11:18:03 +00:00
// Accessing partitions, for Merkle tree & sync
fn partition_of(&self, hash: &Hash) -> Partition;
fn partitions(&self) -> Vec<(Partition, Hash)>;
2021-03-11 15:54:15 +00:00
}