Make table name a const in trait

This commit is contained in:
Alex Auvolat
2021-12-14 12:34:01 +01:00
parent 945b75dbf1
commit 8f6026de5e
13 changed files with 70 additions and 70 deletions
+2
View File
@@ -44,6 +44,8 @@ pub struct BlockRefTable {
}
impl TableSchema for BlockRefTable {
const TABLE_NAME: &'static str = "block_ref";
type P = Hash;
type S = Uuid;
type E = BlockRef;
+2
View File
@@ -114,6 +114,8 @@ impl Crdt for Bucket {
pub struct BucketTable;
impl TableSchema for BucketTable {
const TABLE_NAME: &'static str = "bucket";
type P = EmptyKey;
type S = String;
type E = Bucket;
+2 -17
View File
@@ -93,7 +93,6 @@ impl Garage {
meta_rep_param.clone(),
system.clone(),
&db,
"block_ref".to_string(),
);
info!("Initialize version_table...");
@@ -105,7 +104,6 @@ impl Garage {
meta_rep_param.clone(),
system.clone(),
&db,
"version".to_string(),
);
info!("Initialize object_table...");
@@ -117,26 +115,13 @@ impl Garage {
meta_rep_param,
system.clone(),
&db,
"object".to_string(),
);
info!("Initialize bucket_table...");
let bucket_table = Table::new(
BucketTable,
control_rep_param.clone(),
system.clone(),
&db,
"bucket".to_string(),
);
let bucket_table = Table::new(BucketTable, control_rep_param.clone(), system.clone(), &db);
info!("Initialize key_table_table...");
let key_table = Table::new(
KeyTable,
control_rep_param,
system.clone(),
&db,
"key".to_string(),
);
let key_table = Table::new(KeyTable, control_rep_param, system.clone(), &db);
info!("Initialize Garage...");
let garage = Arc::new(Self {
+2
View File
@@ -120,6 +120,8 @@ pub enum KeyFilter {
}
impl TableSchema for KeyTable {
const TABLE_NAME: &'static str = "key";
type P = EmptyKey;
type S = String;
type E = Key;
+2
View File
@@ -217,6 +217,8 @@ pub struct ObjectTable {
}
impl TableSchema for ObjectTable {
const TABLE_NAME: &'static str = "object";
type P = String;
type S = String;
type E = Object;
+2
View File
@@ -114,6 +114,8 @@ pub struct VersionTable {
}
impl TableSchema for VersionTable {
const TABLE_NAME: &'static str = "version";
type P = Hash;
type S = EmptyKey;
type E = Version;