Skip to main content

LogConfig

Struct LogConfig 

Source
pub struct LogConfig {
    pub segment_bytes: u64,
    pub segment_ms: Duration,
    pub retention_ms: Option<Duration>,
    pub retention_bytes: Option<u64>,
    pub index_interval_bytes: u32,
    pub flush_on_append: bool,
    pub validate_on_open: bool,
    pub cleanup_policy: CleanupPolicy,
    pub compression_type: Option<CompressionType>,
    pub remote_storage_enable: bool,
    pub local_retention_ms: Option<Duration>,
    pub local_retention_bytes: Option<u64>,
}
Expand description

Tunables for Log behavior.

Defaults match Apache Kafka 4.2 (segment.bytes, segment.ms, retention.ms, index.interval.bytes, etc.). The Default impl is the recommended starting point; most production deployments will only override retention_ms and retention_bytes.

Fields§

§segment_bytes: u64

Roll the active segment when it exceeds this many bytes. Kafka default: 1 GiB.

§segment_ms: Duration

Roll the active segment when its first record is older than this. Kafka default: 7 days.

§retention_ms: Option<Duration>

Delete sealed segments older than this. None = unlimited. Kafka default: 7 days.

§retention_bytes: Option<u64>

Delete oldest sealed segments until the total .log size fits. None = unlimited.

§index_interval_bytes: u32

Write one .index/.timeindex entry per N bytes of .log. Kafka default: 4 KiB.

§flush_on_append: bool

fsync after every append. Default off; broker manages fsync separately.

§validate_on_open: bool

On open, CRC every batch in the active segment from the last index entry to EOF.

§cleanup_policy: CleanupPolicy

Cleanup policy. Defaults to Delete. See CleanupPolicy.

§compression_type: Option<CompressionType>

Broker-side recompression target. None is Kafka’s compression.type=producer (pass-through — store the batch exactly as the producer sent it). Some(c) forces every batch the broker accepts on this partition to be re-encoded to c before write. Matches Kafka’s per-topic compression.type config: gzip / snappy / lz4 / zstd / uncompressed map to Some(_); producer (the default) maps to None.

§remote_storage_enable: bool

When true, this partition’s sealed segments (KIP-405) are eligible to be copied to the remote tier by the broker’s RemoteLogManager. Maps to Kafka’s per-topic remote.storage.enable. Default false (Kafka’s default — tiered storage is opt-in per topic).

§local_retention_ms: Option<Duration>

Local-disk time-retention window for tiered partitions (KIP-405). None inherits retention_ms. Default None.

§local_retention_bytes: Option<u64>

Local-disk size budget for tiered partitions (KIP-405). None inherits retention_bytes. Default None.

Trait Implementations§

Source§

impl Clone for LogConfig

Source§

fn clone(&self) -> LogConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for LogConfig

Source§

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

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

impl Default for LogConfig

Source§

fn default() -> Self

Returns the “default value” for a type. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.