api: admin/config: introduce sync direction as job config parameter

Add the sync direction for the sync job as optional config parameter
and refrain from using the config section type for conditional
direction check, as they are now the same (see previous commit).

Use the configured sync job parameter instead of passing it to the
various methods as function parameter and only filter based on sync
direction if an optional api parameter to distingush/filter based on
direction is given.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Christian Ebner 2024-11-25 18:40:10 +01:00 committed by Thomas Lamprecht
parent efc45db20c
commit d70f6d9f09

View File

@ -597,7 +597,11 @@ pub const RESYNC_CORRUPT_SCHEMA: Schema =
"resync-corrupt": { "resync-corrupt": {
schema: RESYNC_CORRUPT_SCHEMA, schema: RESYNC_CORRUPT_SCHEMA,
optional: true, optional: true,
} },
"sync-direction": {
type: SyncDirection,
optional: true,
},
} }
)] )]
#[derive(Serialize, Deserialize, Clone, Updater, PartialEq)] #[derive(Serialize, Deserialize, Clone, Updater, PartialEq)]
@ -633,6 +637,8 @@ pub struct SyncJobConfig {
pub transfer_last: Option<usize>, pub transfer_last: Option<usize>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub resync_corrupt: Option<bool>, pub resync_corrupt: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_direction: Option<SyncDirection>,
} }
impl SyncJobConfig { impl SyncJobConfig {