aboutsummaryrefslogtreecommitdiff
path: root/src/table/schema.rs
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/table/schema.rs
parent945b75dbf1de8bb22ebf9824727a2c45561bfcf4 (diff)
downloadgarage-8f6026de5ecd44cbe0fc0bcd47638a1ece860439.tar.gz
garage-8f6026de5ecd44cbe0fc0bcd47638a1ece860439.zip
Make table name a const in trait
Diffstat (limited to 'src/table/schema.rs')
-rw-r--r--src/table/schema.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/table/schema.rs b/src/table/schema.rs
index 4d6050e8..fa51fa84 100644
--- a/src/table/schema.rs
+++ b/src/table/schema.rs
@@ -57,12 +57,19 @@ pub trait Entry<P: PartitionKey, S: SortKey>:
/// Trait for the schema used in a table
pub trait TableSchema: Send + Sync {
+ /// The name of the table in the database
+ const TABLE_NAME: &'static str;
+
/// The partition key used in that table
type P: PartitionKey + Clone + PartialEq + Serialize + for<'de> Deserialize<'de> + Send + Sync;
/// The sort key used int that table
type S: SortKey + Clone + Serialize + for<'de> Deserialize<'de> + Send + Sync;
+
/// They type for an entry in that table
type E: Entry<Self::P, Self::S>;
+
+ /// The type for a filter that can be applied to select entries
+ /// (e.g. filter out deleted entries)
type Filter: Clone + Serialize + for<'de> Deserialize<'de> + Send + Sync;
// Action to take if not able to decode current version: