aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-14 12:34:01 +0100
committerAlex Auvolat <alex@adnab.me>2021-12-15 15:39:10 +0100
commit8f6026de5ecd44cbe0fc0bcd47638a1ece860439 (patch)
tree5adf96c2218aa27b59eeb66cda676895979d4257 /src/model
parent945b75dbf1de8bb22ebf9824727a2c45561bfcf4 (diff)
downloadgarage-8f6026de5ecd44cbe0fc0bcd47638a1ece860439.tar.gz
garage-8f6026de5ecd44cbe0fc0bcd47638a1ece860439.zip
Make table name a const in trait
Diffstat (limited to 'src/model')
-rw-r--r--src/model/block_ref_table.rs2
-rw-r--r--src/model/bucket_table.rs2
-rw-r--r--src/model/garage.rs19
-rw-r--r--src/model/key_table.rs2
-rw-r--r--src/model/object_table.rs2
-rw-r--r--src/model/version_table.rs2
6 files changed, 12 insertions, 17 deletions
diff --git a/src/model/block_ref_table.rs b/src/model/block_ref_table.rs
index f8f529c4..7dc973d5 100644
--- a/src/model/block_ref_table.rs
+++ b/src/model/block_ref_table.rs
@@ -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;
diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs
index 168ed713..2cb206ce 100644
--- a/src/model/bucket_table.rs
+++ b/src/model/bucket_table.rs
@@ -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;
diff --git a/src/model/garage.rs b/src/model/garage.rs
index d12c781f..a874cca8 100644
--- a/src/model/garage.rs
+++ b/src/model/garage.rs
@@ -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 {
diff --git a/src/model/key_table.rs b/src/model/key_table.rs
index a6186aa9..225f51c7 100644
--- a/src/model/key_table.rs
+++ b/src/model/key_table.rs
@@ -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;
diff --git a/src/model/object_table.rs b/src/model/object_table.rs
index d743a2b6..9eec47ff 100644
--- a/src/model/object_table.rs
+++ b/src/model/object_table.rs
@@ -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;
diff --git a/src/model/version_table.rs b/src/model/version_table.rs
index bff7d4bb..18ec8e1d 100644
--- a/src/model/version_table.rs
+++ b/src/model/version_table.rs
@@ -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;