diff options
Diffstat (limited to 'rola-bucket/src/bucket/config.rs')
| -rw-r--r-- | rola-bucket/src/bucket/config.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/rola-bucket/src/bucket/config.rs b/rola-bucket/src/bucket/config.rs new file mode 100644 index 0000000..559db15 --- /dev/null +++ b/rola-bucket/src/bucket/config.rs @@ -0,0 +1,30 @@ +use serde::Deserialize; + +/// Configuration for a bucket. +/// +/// This struct defines how a bucket should be configured, including its type. +#[derive(Default, Deserialize)] +pub struct BucketConfig { + /// The type of the bucket, e.g., client bucket or normal bucket. + /// + /// When deserializing from TOML, this is expected to be under the key `"type"`. + #[serde(rename = "type")] + pub bucket_type: BucketType, +} + +/// Enum for bucket types, used to distinguish different types of buckets. +/// +/// When deserializing, field names are mapped to string values in TOML via `serde(rename)`. +#[derive(Default, Deserialize)] +pub enum BucketType { + /// Client bucket + /// Uses local ID, mapped to remote ID via IDMAP + #[serde(rename = "client")] + ClientBucket, + + /// Normal bucket + /// Uses global ID + #[default] + #[serde(rename = "bucket")] + Bucket, +} |
