aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/Cargo.toml8
-rw-r--r--src/model/key_table.rs9
2 files changed, 13 insertions, 4 deletions
diff --git a/src/model/Cargo.toml b/src/model/Cargo.toml
index 98656ea9..4025f8d0 100644
--- a/src/model/Cargo.toml
+++ b/src/model/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "garage_model"
-version = "0.1.1"
+version = "0.2.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "GPL-3.0"
@@ -13,9 +13,9 @@ path = "lib.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-garage_util = { version = "0.1.1", path = "../util" }
-garage_rpc = { version = "0.1.1", path = "../rpc" }
-garage_table = { version = "0.1.1", path = "../table" }
+garage_util = { version = "0.2.0", path = "../util" }
+garage_rpc = { version = "0.2.0", path = "../rpc" }
+garage_table = { version = "0.2.0", path = "../table" }
rand = "0.8"
hex = "0.4"
diff --git a/src/model/key_table.rs b/src/model/key_table.rs
index 02dcf68c..fcca3835 100644
--- a/src/model/key_table.rs
+++ b/src/model/key_table.rs
@@ -34,6 +34,15 @@ impl Key {
authorized_buckets: crdt::LWWMap::new(),
}
}
+ pub fn import(key_id: &str, secret_key: &str, name: &str) -> Self {
+ Self {
+ key_id: key_id.to_string(),
+ secret_key: secret_key.to_string(),
+ name: crdt::LWW::new(name.to_string()),
+ deleted: crdt::Bool::new(false),
+ authorized_buckets: crdt::LWWMap::new(),
+ }
+ }
pub fn delete(key_id: String) -> Self {
Self {
key_id,