garage/src/table/replication/parameters.rs

24 lines
659 B
Rust
Raw Normal View History

2021-03-11 15:54:15 +00:00
use garage_rpc::ring::Ring;
use garage_util::data::*;
pub trait TableReplication: Send + Sync {
// See examples in table_sharded.rs and table_fullcopy.rs
// To understand various replication methods
2021-03-16 10:14:27 +00:00
// Partition number of data item (for Merkle tree)
fn partition_of(&self, hash: &Hash) -> u16;
2021-03-11 15:54:15 +00:00
// 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 10:14:27 +00:00
// Get partition boundaries
2021-03-11 15:54:15 +00:00
fn split_points(&self, ring: &Ring) -> Vec<Hash>;
}