CompressionConfig

Struct CompressionConfig 

Source
pub struct CompressionConfig {
    pub algorithm: CompressionAlgorithm,
    pub level: CompressionLevel,
    pub dictionary: Option<Vec<u8>>,
    pub window_size: Option<u32>,
    pub parallel_processing: bool,
}
Expand description

Compression configuration that encapsulates all parameters for compression operations

This configuration struct provides comprehensive control over compression behavior, allowing fine-tuning of compression parameters for optimal performance in different scenarios. The configuration is immutable and thread-safe.

§Configuration Parameters

  • Algorithm: The compression algorithm to use
  • Level: Compression level balancing speed vs. ratio
  • Dictionary: Optional pre-trained dictionary for better compression
  • Window Size: Sliding window size for compression algorithms
  • Parallel Processing: Enable multi-threaded compression when supported

§Examples

§Performance Considerations

  • Dictionary: Pre-trained dictionaries can significantly improve compression ratios for similar data patterns but require additional memory
  • Window Size: Larger windows generally improve compression but use more memory
  • Parallel Processing: Can improve throughput on multi-core systems but may increase memory usage and complexity

Fields§

§algorithm: CompressionAlgorithm

The compression algorithm to use for processing

§level: CompressionLevel

Compression level balancing speed vs. compression ratio

§dictionary: Option<Vec<u8>>

Optional pre-trained dictionary for improved compression of similar data

§window_size: Option<u32>

Optional sliding window size for compression algorithms (algorithm-specific)

§parallel_processing: bool

Enable parallel processing for supported algorithms

Implementations§

Source§

impl CompressionConfig

Source

pub fn new(algorithm: CompressionAlgorithm) -> Self

Creates a new compression configuration

Source

pub fn with_level(self, level: CompressionLevel) -> Self

Sets compression level

Source

pub fn with_dictionary(self, dictionary: Vec<u8>) -> Self

Sets dictionary

Source

pub fn with_window_size(self, size: u32) -> Self

Sets window size

Source

pub fn with_parallel_processing(self, enabled: bool) -> Self

Sets parallel processing

Source

pub fn for_speed(algorithm: CompressionAlgorithm) -> Self

Creates a speed-optimized configuration

Source

pub fn for_ratio(algorithm: CompressionAlgorithm) -> Self

Creates a ratio-optimized configuration

Trait Implementations§

Source§

impl Clone for CompressionConfig

Source§

fn clone(&self) -> CompressionConfig

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 CompressionConfig

Source§

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

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

impl Default for CompressionConfig

Source§

fn default() -> Self

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

impl FromParameters for CompressionConfig

Implementation of FromParameters for type-safe config extraction.

This implementation converts StageConfiguration.parameters HashMap into a typed CompressionConfig object.

§Expected Parameters
  • algorithm (required): Compression algorithm name

    • Valid values: “brotli”, “gzip”, “zstd”, “lz4”
    • Example: "algorithm" => "brotli"
  • level (optional): Compression level (1-19 depending on algorithm)

    • Default: 6 (balanced)
    • Example: "level" => "9"
  • parallel_processing (optional): Enable parallel compression

    • Valid values: “true”, “false”
    • Default: false
    • Example: "parallel_processing" => "true"
§Usage Example
use adaptive_pipeline_domain::services::{CompressionConfig, FromParameters};
use std::collections::HashMap;

let mut params = HashMap::new();
params.insert("algorithm".to_string(), "brotli".to_string());
params.insert("level".to_string(), "9".to_string());

let config = CompressionConfig::from_parameters(&params).unwrap();
Source§

fn from_parameters( params: &HashMap<String, String>, ) -> Result<Self, PipelineError>

Converts HashMap parameters to typed configuration. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V