aboutsummaryrefslogtreecommitdiff
path: root/src/model/bucket_alias_table.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-01-03 17:22:40 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-04 12:52:46 +0100
commite59c23a69df116737c428ccbfbe4dfeff4d956d5 (patch)
tree04e758a80943ba3bba9ea1e8b89867ed18dea242 /src/model/bucket_alias_table.rs
parent2140cd72054ac6e3a94cbe5931727159de20a97f (diff)
downloadgarage-e59c23a69df116737c428ccbfbe4dfeff4d956d5.tar.gz
garage-e59c23a69df116737c428ccbfbe4dfeff4d956d5.zip
Refactor logic for setting/unsetting aliases
Diffstat (limited to 'src/model/bucket_alias_table.rs')
-rw-r--r--src/model/bucket_alias_table.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/model/bucket_alias_table.rs b/src/model/bucket_alias_table.rs
index caae76f1..45807178 100644
--- a/src/model/bucket_alias_table.rs
+++ b/src/model/bucket_alias_table.rs
@@ -1,7 +1,6 @@
use serde::{Deserialize, Serialize};
use garage_util::data::*;
-use garage_util::time::*;
use garage_table::crdt::*;
use garage_table::*;
@@ -24,10 +23,7 @@ impl AutoCrdt for AliasParams {
}
impl BucketAlias {
- pub fn new(name: String, bucket_id: Uuid) -> Option<Self> {
- Self::raw(name, now_msec(), bucket_id)
- }
- pub fn raw(name: String, ts: u64, bucket_id: Uuid) -> Option<Self> {
+ pub fn new(name: String, ts: u64, bucket_id: Uuid) -> Option<Self> {
if !is_valid_bucket_name(&name) {
None
} else {
@@ -101,3 +97,6 @@ pub fn is_valid_bucket_name(n: &str) -> bool {
// Bucket names must not end with "-s3alias"
&& !n.ends_with("-s3alias")
}
+
+/// Error message to return for invalid bucket names
+pub const INVALID_BUCKET_NAME_MESSAGE: &str = "Invalid bucket name. See AWS documentation for constraints on S3 bucket names:\nhttps://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html";