diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-19 01:40:38 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-19 01:40:38 +0800 |
| commit | 1e9c97c21f8a4e55420712b054895ff8b4f9a849 (patch) | |
| tree | c6bd37889deb54c024f974f368a9a7d654cad822 /rola-bucket/src/bucket/config.rs | |
| parent | e078163c7cdbbf226c18d3e3afa7268a2878e18b (diff) | |
Implement bucket bind CRUD operations and config loading, along with
CLI integration for listing, setting, and removing bucket bindings.
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, +} |
