pub struct ArchivalConfig {
pub compression_level: u32,
pub verify_compression: bool,
}Expand description
Configuration for archive storage and compression settings.
Fields§
§compression_level: u32Default compression level (0-9, where 9 is maximum compression).
verify_compression: boolWhether to check every compressed payload before storing it: the compressed bytes are decompressed and compared with the original, and a mismatch fails the archival batch (its transaction is rolled back, so no job is moved).
Implementations§
Source§impl ArchivalConfig
impl ArchivalConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new archival configuration with default settings.
§Examples
use hammerwork::archive::ArchivalConfig;
let config = ArchivalConfig::new();
assert_eq!(config.compression_level, 6);
assert!(config.verify_compression);Sourcepub fn with_compression_level(self, level: u32) -> Self
pub fn with_compression_level(self, level: u32) -> Self
Sets the compression level for archived payloads.
§Arguments
level- Compression level from 0 (no compression) to 9 (maximum compression)
§Examples
use hammerwork::archive::ArchivalConfig;
let config = ArchivalConfig::new()
.with_compression_level(9);
assert_eq!(config.compression_level, 9);
// Values above 9 are clamped to 9
let config = ArchivalConfig::new()
.with_compression_level(15);
assert_eq!(config.compression_level, 9);Sourcepub fn with_compression_verification(self, verify: bool) -> Self
pub fn with_compression_verification(self, verify: bool) -> Self
Sets whether to verify each compressed payload round-trips before it is stored
(see ArchivalConfig::verify_compression).
§Examples
use hammerwork::archive::ArchivalConfig;
let config = ArchivalConfig::new()
.with_compression_verification(false);
assert!(!config.verify_compression);
let config = ArchivalConfig::new()
.with_compression_verification(true);
assert!(config.verify_compression);Trait Implementations§
Source§impl Clone for ArchivalConfig
impl Clone for ArchivalConfig
Source§impl Debug for ArchivalConfig
impl Debug for ArchivalConfig
Source§impl Default for ArchivalConfig
impl Default for ArchivalConfig
Source§impl<'de> Deserialize<'de> for ArchivalConfig
impl<'de> Deserialize<'de> for ArchivalConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ArchivalConfig
impl RefUnwindSafe for ArchivalConfig
impl Send for ArchivalConfig
impl Sync for ArchivalConfig
impl Unpin for ArchivalConfig
impl UnsafeUnpin for ArchivalConfig
impl UnwindSafe for ArchivalConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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