Struct condow_rusoto::config::Config
source · [−]#[non_exhaustive]pub struct Config {
pub part_size_bytes: PartSizeBytes,
pub max_concurrency: MaxConcurrency,
pub min_parts_for_concurrent_download: MinPartsForConcurrentDownload,
pub min_bytes_for_concurrent_download: MinBytesForConcurrentDownload,
pub sequential_download_mode: SequentialDownloadMode,
pub ensure_active_pull: EnsureActivePull,
pub buffer_size: BufferSize,
pub max_buffers_full_delay_ms: MaxBuffersFullDelayMs,
pub log_download_messages_as_debug: LogDownloadMessagesAsDebug,
pub retries: Option<RetryConfig>,
}
Expand description
A configuration for Condow.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.part_size_bytes: PartSizeBytes
Size in bytes of the parts the download is split into
Default is 4 Mebi.
max_concurrency: MaxConcurrency
The maximum concurrency for a single download.
Actual concurrency can be lower if less parts
than max_concurrency
are to be
downloaded
min_parts_for_concurrent_download: MinPartsForConcurrentDownload
The minimum number of parts a download must consist of for the parts to be downloaded concurrently.
Depending on the part sizes it might be more efficient to set a number higer than 2. Downloading concurrently has an overhead.
This setting plays together with MinBytesForConcurrentDownload
.
Setting this value to 0 or 1 makes no sense and has no effect.
The default is 2.
min_bytes_for_concurrent_download: MinBytesForConcurrentDownload
The minimum number of bytes a download must consist of for the parts to be downloaded concurrently.
Downloading concurrently has an overhead so it can make sens to set this value greater that PART_SIZE_BYTES
.
This setting plays together with MinPartsForConcurrentDownload
.
The default is 0.
sequential_download_mode: SequentialDownloadMode
Define how parts for a sequential download should be treated.
A sequential download can not only be triggered by just one part being requested but also by the MinBytesForConcurrentDownload and MinPartsForConcurrentDownload configuration values.
The default is [SequentialDownloadMode::SingleDownload].
ensure_active_pull: EnsureActivePull
Make sure that the network stream is always actively pulled into an intermediate buffer.
This is not always the case since some low concurrency downloads require the strem to be actively pulled. This also allows for detection of panics.
The default is false
which means this feature is turned off.
buffer_size: BufferSize
Size of the buffer for each download task.
If set to 0 (not advised) there will be now buffer at all. This should be configured so that none of the tasks runs ever empty
Default is 2
max_buffers_full_delay_ms: MaxBuffersFullDelayMs
If all buffers of all download tasks are full, this is the maximum time to pause until the next attempt.
Default is 10ms
log_download_messages_as_debug: LogDownloadMessagesAsDebug
If set to true
download related messages are logged at DEBUG
level. Otherwise at INFO
level.
The affectd messages are:
Download started
Download completed
Download failed
retries: Option<RetryConfig>
Configures retries if there.
Otherwise there won’t be any retry attempts made
Retries are turned on by default
Implementations
sourceimpl Config
impl Config
sourcepub fn from_env() -> Result<Option<Config>, Error>
pub fn from_env() -> Result<Option<Config>, Error>
Tries to initialize all fields from environment variables prefixed with “CONDOW_”
If no env variables were found None
is returned.
Otherwise thise found will be set and the rest will be initialized with their defaults.
sourcepub fn from_env_type_names() -> Result<Option<Config>, Error>
pub fn from_env_type_names() -> Result<Option<Config>, Error>
Tries to initialize all fields from environment variables without any prefix
If no env variables were found None
is returned.
Otherwise thise found will be set and the rest will be initialized with their defaults.
sourcepub fn from_env_prefixed<T>(prefix: T) -> Result<Option<Config>, Error> where
T: AsRef<str>,
pub fn from_env_prefixed<T>(prefix: T) -> Result<Option<Config>, Error> where
T: AsRef<str>,
Tries to initialize all fields from environment variables prefixed with “[prefix]_”
The underscore is omitted if prefix
is empty
If no env variables were found None
is returned.
Otherwise thise found will be set and the rest will be initialized with their defaults.
sourcepub fn part_size_bytes<T>(self, part_size_bytes: T) -> Config where
T: Into<PartSizeBytes>,
pub fn part_size_bytes<T>(self, part_size_bytes: T) -> Config where
T: Into<PartSizeBytes>,
Set the size of the parts the download is split into in bytes
sourcepub fn max_concurrency<T>(self, max_concurrency: T) -> Config where
T: Into<MaxConcurrency>,
pub fn max_concurrency<T>(self, max_concurrency: T) -> Config where
T: Into<MaxConcurrency>,
Set the maximum concurrency of a download
sourcepub fn min_parts_for_concurrent_download<T>(
self,
min_parts_for_concurrent_download: T
) -> Config where
T: Into<MinPartsForConcurrentDownload>,
pub fn min_parts_for_concurrent_download<T>(
self,
min_parts_for_concurrent_download: T
) -> Config where
T: Into<MinPartsForConcurrentDownload>,
The minimum number of parts a download must consist of for the parts to be downloaded concurrently.
Depending on the part sizes it might be more efficient to set a number higer than 2. Downloading concurrently has an overhead.
This setting plays together with MinBytesForConcurrentDownload
.
Setting this value to 0 or 1 makes no sense and has no effect.
The default is 2.
sourcepub fn min_bytes_for_concurrent_download<T>(
self,
min_bytes_for_concurrent_download: T
) -> Config where
T: Into<MinBytesForConcurrentDownload>,
pub fn min_bytes_for_concurrent_download<T>(
self,
min_bytes_for_concurrent_download: T
) -> Config where
T: Into<MinBytesForConcurrentDownload>,
The minimum number of bytes a download must consist of for the parts to be downloaded concurrently.
Downloading concurrently has an overhead so it can make sens to set this value greater that PART_SIZE_BYTES
.
This setting plays together with MinPartsForConcurrentDownload
.
The default is 0.
sourcepub fn sequential_download_mode<T>(self, sequential_download_mode: T) -> Config where
T: Into<SequentialDownloadMode>,
pub fn sequential_download_mode<T>(self, sequential_download_mode: T) -> Config where
T: Into<SequentialDownloadMode>,
The minimum number of bytes a download must consist of for the parts to be downloaded concurrently.
Downloading concurrently has an overhead so it can make sens to set this value greater that PART_SIZE_BYTES
.
This setting plays together with MinPartsForConcurrentDownload
.
The default is 0.
sourcepub fn ensure_active_pull<T>(self, ensure_active_pull: T) -> Config where
T: Into<EnsureActivePull>,
pub fn ensure_active_pull<T>(self, ensure_active_pull: T) -> Config where
T: Into<EnsureActivePull>,
Make sure that the network stream is always actively pulled into an intermediate buffer.
This is not always the case since some low concurrency downloads require the strem to be actively pulled. This also allows for detection of panics.
The default is false
which means this feature is turned off.
sourcepub fn buffer_size<T>(self, buffer_size: T) -> Config where
T: Into<BufferSize>,
pub fn buffer_size<T>(self, buffer_size: T) -> Config where
T: Into<BufferSize>,
Set the size of the buffer for each download task.
sourcepub fn max_buffers_full_delay_ms<T>(
self,
max_buffers_full_delay_ms: T
) -> Config where
T: Into<MaxBuffersFullDelayMs>,
pub fn max_buffers_full_delay_ms<T>(
self,
max_buffers_full_delay_ms: T
) -> Config where
T: Into<MaxBuffersFullDelayMs>,
Set the maximum delay in case all task buffers are full before a retry to enqueue the next downlod part is made.
sourcepub fn log_download_messages_as_debug<T>(
self,
log_download_messages_as_debug: T
) -> Config where
T: Into<LogDownloadMessagesAsDebug>,
pub fn log_download_messages_as_debug<T>(
self,
log_download_messages_as_debug: T
) -> Config where
T: Into<LogDownloadMessagesAsDebug>,
If set to true
download related messages are logged at DEBUG
level. Otherwise at INFO
level.
The affectd messages are:
download started
download completed
download failed
sourcepub fn retries(self, config: RetryConfig) -> Config
pub fn retries(self, config: RetryConfig) -> Config
Enables retries with the given configuration
sourcepub fn configure_retries<F>(self, f: F) -> Config where
F: FnMut(RetryConfig) -> RetryConfig,
pub fn configure_retries<F>(self, f: F) -> Config where
F: FnMut(RetryConfig) -> RetryConfig,
Configure retries
Uses the currently configured RetryConfig or the default of RetryConfig if none is configured
sourcepub fn configure_retries_from_default<F>(self, f: F) -> Config where
F: FnMut(RetryConfig) -> RetryConfig,
pub fn configure_retries_from_default<F>(self, f: F) -> Config where
F: FnMut(RetryConfig) -> RetryConfig,
Configure retries starting with the default
sourcepub fn disable_retries(self) -> Config
pub fn disable_retries(self) -> Config
Disables retries
Retries are enabled by default.
Trait Implementations
impl StructuralPartialEq for Config
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more