#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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

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.

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.

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.

Set the size of the parts the download is split into in bytes

Set the maximum concurrency of a download

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.

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.

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.

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.

Set the size of the buffer for each download task.

Set the maximum delay in case all task buffers are full before a retry to enqueue the next downlod part is made.

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

Enables retries with the given configuration

Configure retries

Uses the currently configured RetryConfig or the default of RetryConfig if none is configured

Configure retries starting with the default

Disables retries

Retries are enabled by default.

Validate this Config

Validate this Config

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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