summaryrefslogtreecommitdiff
path: root/rola-bucket/src/bucket/config.rs
blob: 559db15787477c619b00cfdb2cd386a6368535c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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,
}