storage-transfer-lib 0.3.0

Bounded S3 and local directory transfers using Apache OpenDAL
Documentation
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),
        )
}