Skip to main content

JournalConfig

Struct JournalConfig 

Source
pub struct JournalConfig {
Show 16 fields pub max_object_size_bytes: u64, pub max_decompressed_bytes: usize, pub max_field_name_len: usize, pub max_fields_per_entry: usize, pub max_journal_files: usize, pub max_open_files: usize, pub mmap_policy: MmapPolicy, pub max_object_chain_steps: usize, pub max_query_terms: usize, pub allow_mmap_online: bool, pub include_journal_tilde: bool, pub poll_interval: Duration, pub live_channel_capacity: usize, pub max_live_batch_entries: usize, pub max_live_replay_entries: Option<usize>, pub live_queue_full_policy: LiveQueueFullPolicy,
}
Expand description

Runtime configuration for crate::Journal.

These limits are primarily defensive: they bound memory use and traversal work when reading malformed, truncated, or unexpectedly large journal files.

Defaults are conservative for general-purpose readers. Increase limits only for known-good deployments with unusually large entries or many journal files. Lower JournalConfig::poll_interval when live tail latency matters and a platform watcher is not available.

Fields§

§max_object_size_bytes: u64

Maximum object size accepted from the journal file.

This bounds allocation when reading ENTRY, DATA, and related objects.

§max_decompressed_bytes: usize

Maximum bytes allowed after decompressing a DATA payload.

This protects callers from compressed payloads that expand unexpectedly.

§max_field_name_len: usize

Maximum length of a field name.

systemd field names are normally short uppercase identifiers such as MESSAGE or _SYSTEMD_UNIT.

§max_fields_per_entry: usize

Maximum number of fields accepted per entry.

Entries exceeding this limit are treated as malformed or unsupported for this reader.

§max_journal_files: usize

Maximum number of journal files included from a single scan.

Discovery fails with crate::SdJournalError::LimitExceeded if this limit is exceeded.

§max_open_files: usize

Maximum journal files kept open by one reader.

Queries switch to a low-memory streaming merge when discovery finds more files than this limit. Set this to 1 for the lowest file-descriptor and mmap footprint.

§mmap_policy: MmapPolicy

Runtime mmap policy.

MmapPolicy::Never forces bounded file I/O even when the mmap feature is enabled.

§max_object_chain_steps: usize

Maximum number of steps when traversing any next_* chain.

This bounds work when following linked object chains in corrupt or adversarial files.

§max_query_terms: usize

Maximum number of query terms (matches) accepted per query.

Unit helpers and OR groups can expand into several internal terms.

§allow_mmap_online: bool

Whether to allow mmap for STATE_ONLINE journal files that may still be written.

The default is false because concurrently modified files are safer to read through explicit file I/O. Offline and archived files may still use mmap when the mmap feature is enabled, unless JournalConfig::mmap_policy is MmapPolicy::Never.

§include_journal_tilde: bool

Whether to include *.journal~ temporary or incomplete files during discovery.

Keep this disabled unless the application explicitly wants best-effort access to temporary journal files.

§poll_interval: Duration

Polling interval used as fallback when inotify is unavailable or unreliable.

This affects crate::LiveJournal latency only on fallback polling paths.

§live_channel_capacity: usize

Maximum queued live entries per subscription.

Live subscriptions use bounded queues. This prevents slow consumers from growing memory without limit.

§max_live_batch_entries: usize

Maximum entries decoded or dispatched by one live-engine cycle.

Replay, topology refresh, and modified-file reads are split across multiple crate::LiveJournal::poll_once cycles when more entries remain.

§max_live_replay_entries: Option<usize>

Optional maximum matching historical entries replayed for a single subscription.

None means the replay has no total entry cap, but work is still batched by JournalConfig::max_live_batch_entries and delivered through bounded subscription queues.

Set this to Some(n) to fail with crate::SdJournalError::LimitExceeded after n matching replay entries for a subscription.

§live_queue_full_policy: LiveQueueFullPolicy

Behavior when a subscription queue is full.

Trait Implementations§

Source§

impl Clone for JournalConfig

Source§

fn clone(&self) -> JournalConfig

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 JournalConfig

Source§

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

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

impl Default for JournalConfig

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<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> 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.