Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 30 fields pub target: StoragePath, pub show_no_progress: bool, pub target_client_config: Option<ClientConfig>, pub force_retry_config: ForceRetryConfig, pub tracing_config: Option<TracingConfig>, pub worker_size: u16, pub warn_as_error: bool, pub dry_run: bool, pub rate_limit_objects: Option<u32>, pub max_parallel_listings: u16, pub object_listing_queue_size: u32, pub max_parallel_listing_max_depth: u16, pub allow_parallel_listings_in_express_one_zone: bool, pub filter_config: FilterConfig, pub max_keys: i32, pub auto_complete_shell: Option<Shell>, pub event_callback_lua_script: Option<String>, pub filter_callback_lua_script: Option<String>, pub allow_lua_os_library: bool, pub allow_lua_unsafe_vm: bool, pub lua_vm_memory_limit: usize, pub lua_callback_timeout_milliseconds: u64, pub if_match: bool, pub max_delete: Option<u64>, pub filter_manager: FilterManager, pub event_manager: EventManager, pub batch_size: u16, pub delete_all_versions: bool, pub force: bool, pub test_user_defined_callback: bool,
}
Expand description

Main configuration for the s3rm-rs deletion pipeline.

Holds all settings needed to configure and run a DeletionPipeline: target bucket/prefix, AWS credentials, worker pool size, filter rules, safety flags (dry-run, force, max-delete), and callback registrations.

Adapted from s3sync’s Config, removing source-specific and sync-specific options. Only target-related configuration is retained since s3rm-rs operates on a single S3 target.

§Quick Start

The recommended way to build a Config is build_config_from_args, which performs all CLI-level validation (conflicting flags, rate-limit vs batch-size, etc.):

let config = s3rm_rs::build_config_from_args([
    "s3rm", "s3://my-bucket/logs/2024/", "--dry-run", "--force",
]).expect("invalid arguments");

Alternatively, Config::for_target creates a minimal configuration with sensible defaults, but command-line validation checks are not performed:

use s3rm_rs::Config;

let config = Config::for_target("my-bucket", "logs/2024/");
assert_eq!(config.worker_size, 16);
assert_eq!(config.batch_size, 200);

Then customize fields as needed:

use s3rm_rs::Config;

let mut config = Config::for_target("my-bucket", "logs/2024/");
config.dry_run = true;
config.force = true;
config.worker_size = 100;
config.max_delete = Some(10_000);

§Default

Config::default() creates a configuration targeting an empty bucket/prefix. You must set the target field before running a pipeline.

use s3rm_rs::Config;
use s3rm_rs::types::StoragePath;

let mut config = Config::default();
config.target = StoragePath::S3 {
    bucket: "my-bucket".into(),
    prefix: "prefix/".into(),
};

Fields§

§target: StoragePath§show_no_progress: bool§target_client_config: Option<ClientConfig>§force_retry_config: ForceRetryConfig§tracing_config: Option<TracingConfig>§worker_size: u16§warn_as_error: bool§dry_run: bool§rate_limit_objects: Option<u32>§max_parallel_listings: u16§object_listing_queue_size: u32§max_parallel_listing_max_depth: u16§allow_parallel_listings_in_express_one_zone: bool§filter_config: FilterConfig§max_keys: i32§auto_complete_shell: Option<Shell>§event_callback_lua_script: Option<String>§filter_callback_lua_script: Option<String>§allow_lua_os_library: bool§allow_lua_unsafe_vm: bool§lua_vm_memory_limit: usize§lua_callback_timeout_milliseconds: u64§if_match: bool§max_delete: Option<u64>§filter_manager: FilterManager§event_manager: EventManager§batch_size: u16§delete_all_versions: bool§force: bool§test_user_defined_callback: bool

Implementations§

Source§

impl Config

Source

pub fn for_target(bucket: &str, prefix: &str) -> Self

Create a Config with sensible defaults for the given S3 bucket and prefix.

All fields are set to production-ready defaults matching the CLI defaults (16 workers, batch size 200, etc.). The force flag is set to true to skip interactive confirmation prompts, which is appropriate for programmatic use.

Note: This bypasses CLI-level validation (conflicting flags, rate-limit vs batch-size, etc.). Prefer build_config_from_args when possible.

§Examples
use s3rm_rs::Config;

let config = Config::for_target("my-bucket", "logs/");
assert_eq!(config.batch_size, 200);
assert!(config.force); // no interactive prompts

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Create a Config with sensible defaults.

The target defaults to an empty bucket/prefix — set it before running a pipeline. All other fields use production defaults matching the CLI.

Source§

impl TryFrom<CLIArgs> for Config

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(args: CLIArgs) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T
where T: Send,