From 44dba0e53c7bae0fa16bf48e6022faa95d1159aa Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 8 Jul 2020 17:34:37 +0200 Subject: cargo fmt --- src/table/lib.rs | 2 +- src/table/schema.rs | 11 +++++------ src/table/table.rs | 23 ++++++++++------------- 3 files changed, 16 insertions(+), 20 deletions(-) (limited to 'src/table') diff --git a/src/table/lib.rs b/src/table/lib.rs index e30a6665..ac129146 100644 --- a/src/table/lib.rs +++ b/src/table/lib.rs @@ -9,5 +9,5 @@ pub mod table_fullcopy; pub mod table_sharded; pub mod table_sync; -pub use table::*; pub use schema::*; +pub use table::*; diff --git a/src/table/schema.rs b/src/table/schema.rs index cedaacac..1914320e 100644 --- a/src/table/schema.rs +++ b/src/table/schema.rs @@ -4,7 +4,6 @@ use serde::{Deserialize, Serialize}; use garage_util::data::*; use garage_util::error::Error; - pub trait PartitionKey { fn hash(&self) -> Hash; } @@ -64,11 +63,11 @@ pub trait TableSchema: Send + Sync { type E: Entry; type Filter: Clone + Serialize + for<'de> Deserialize<'de> + Send + Sync; - // Action to take if not able to decode current version: - // try loading from an older version - fn try_migrate(_bytes: &[u8]) -> Option { - None - } + // Action to take if not able to decode current version: + // try loading from an older version + fn try_migrate(_bytes: &[u8]) -> Option { + None + } async fn updated(&self, old: Option, new: Option) -> Result<(), Error>; fn matches_filter(_entry: &Self::E, _filter: &Self::Filter) -> bool { diff --git a/src/table/table.rs b/src/table/table.rs index 7a5caf4f..9d43a475 100644 --- a/src/table/table.rs +++ b/src/table/table.rs @@ -14,8 +14,8 @@ use garage_rpc::membership::{Ring, System}; use garage_rpc::rpc_client::*; use garage_rpc::rpc_server::*; -use crate::table_sync::*; use crate::schema::*; +use crate::table_sync::*; const TABLE_RPC_TIMEOUT: Duration = Duration::from_secs(10); @@ -48,7 +48,6 @@ pub enum TableRPC { impl RpcMessage for TableRPC {} - pub trait TableReplication: Send + Sync { // See examples in table_sharded.rs and table_fullcopy.rs // To understand various replication methods @@ -456,15 +455,13 @@ where ret } - fn decode_entry(bytes: &[u8]) -> Result { - match rmp_serde::decode::from_read_ref::<_, F::E>(bytes) { - Ok(x) => Ok(x), - Err(e) => { - match F::try_migrate(bytes) { - Some(x) => Ok(x), - None => Err(e.into()), - } - } - } - } + fn decode_entry(bytes: &[u8]) -> Result { + match rmp_serde::decode::from_read_ref::<_, F::E>(bytes) { + Ok(x) => Ok(x), + Err(e) => match F::try_migrate(bytes) { + Some(x) => Ok(x), + None => Err(e.into()), + }, + } + } } -- cgit v1.2.3