aboutsummaryrefslogtreecommitdiff
path: root/src/model/bucket_table.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-12-22 18:50:08 +0100
committerAlex Auvolat <alex@adnab.me>2022-01-04 12:47:28 +0100
commitd8ab5bdc3e20759e5ba8a6844393757da3539372 (patch)
tree7fc9abc578bb4185691313889ed94aedca09dbc4 /src/model/bucket_table.rs
parentc7d5c732442c5802058b46205d450d4620772b7b (diff)
downloadgarage-d8ab5bdc3e20759e5ba8a6844393757da3539372.tar.gz
garage-d8ab5bdc3e20759e5ba8a6844393757da3539372.zip
New buckets for 0.6.0: fix model and migration
Diffstat (limited to 'src/model/bucket_table.rs')
-rw-r--r--src/model/bucket_table.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs
index 00e03899..8dcf6913 100644
--- a/src/model/bucket_table.rs
+++ b/src/model/bucket_table.rs
@@ -1,5 +1,4 @@
use serde::{Deserialize, Serialize};
-use serde_bytes::ByteBuf;
use garage_table::crdt::Crdt;
use garage_table::*;
@@ -8,8 +7,6 @@ use garage_util::time::*;
use crate::permission::BucketKeyPerm;
-pub const DEFAULT_WEBSITE_CONFIGURATION: &[u8] = b""; // TODO (an XML WebsiteConfiguration document per the AWS spec)
-
/// A bucket is a collection of objects
///
/// Its parameters are not directly accessible as:
@@ -33,7 +30,7 @@ pub struct BucketParams {
/// Whether this bucket is allowed for website access
/// (under all of its global alias names),
/// and if so, the website configuration XML document
- pub website_config: crdt::Lww<Option<ByteBuf>>,
+ pub website_config: crdt::Lww<Option<WebsiteConfig>>,
/// Map of aliases that are or have been given to this bucket
/// in the global namespace
/// (not authoritative: this is just used as an indication to
@@ -45,6 +42,18 @@ pub struct BucketParams {
pub local_aliases: crdt::LwwMap<(String, String), bool>,
}
+#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
+pub enum WebsiteConfig {
+ RedirectAll {
+ hostname: String,
+ protocol: String,
+ },
+ Website {
+ index_document: String,
+ error_document: Option<String>,
+ },
+}
+
impl BucketParams {
/// Create an empty BucketParams with no authorized keys and no website accesss
pub fn new() -> Self {