use opendal::Operator;
use opendal::layers::{RetryLayer, TimeoutLayer};
use crate::TransferConfig;
pub(crate) fn with_policies(operator: Operator, config: &TransferConfig) -> Operator {
operator
.layer(
TimeoutLayer::new()
.with_timeout(config.timeout.operation)
.with_io_timeout(config.timeout.io),
)
.layer(
RetryLayer::new()
.with_max_times(config.retry.max_retries)
.with_min_delay(config.retry.delay)
.with_max_delay(config.retry.max_delay),
)
}