pub struct Options {
pub log_format_version: u8,
pub max_segment_size: u64,
pub max_records_in_commit: NonZeroU16,
pub offset_index_interval_bytes: NonZeroU64,
pub offset_index_require_segment_fsync: bool,
}Expand description
Commitlog options.
Fields§
§log_format_version: u8Set the log format version to write, and the maximum supported version.
Choosing a payload format T of Commitlog should usually result in
updating the DEFAULT_LOG_FORMAT_VERSION of this crate. Sometimes it
may however be useful to set the version at runtime, e.g. to experiment
with new or very old versions.
Default: DEFAULT_LOG_FORMAT_VERSION
max_segment_size: u64The maximum size in bytes to which log segments should be allowed to grow.
Default: 1GiB
max_records_in_commit: NonZeroU16The maximum number of records in a commit.
If this number is exceeded, the commit is flushed to disk even without
explicitly calling Commitlog::flush.
Default: 65,535
offset_index_interval_bytes: NonZeroU64Whenever at least this many bytes have been written to the currently active segment, an entry is added to its offset index.
Default: 4096
offset_index_require_segment_fsync: boolIf true, require that the segment must be synced to disk before an
index entry is added.
Setting this to false (the default) will update the index every
offset_index_interval_bytes, even if the commitlog wasn’t synced.
This means that the index could contain non-existent entries in the
event of a crash.
Setting it to true will update the index when the commitlog is synced,
and offset_index_interval_bytes have been written.
This means that the index could contain fewer index entries than
strictly every offset_index_interval_bytes.
Default: false
Implementations§
Source§impl Options
impl Options
pub const DEFAULT_MAX_SEGMENT_SIZE: u64 = 1_073_741_824u64
pub const DEFAULT_MAX_RECORDS_IN_COMMIT: NonZeroU16 = NonZeroU16::MAX
pub const DEFAULT_OFFSET_INDEX_INTERVAL_BYTES: NonZeroU64
pub const DEFAULT_OFFSET_INDEX_REQUIRE_SEGMENT_FSYNC: bool = false
pub const DEFAULT: Self
pub const fn default_log_format_version() -> u8
pub const fn default_max_segment_size() -> u64
pub const fn default_max_records_in_commit() -> NonZeroU16
pub const fn default_offset_index_interval_bytes() -> NonZeroU64
pub const fn default_offset_index_require_segment_fsync() -> bool
Sourcepub fn offset_index_len(&self) -> u64
pub fn offset_index_len(&self) -> u64
Compute the length in bytes of an offset index based on the settings in
self.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Options
impl<'de> Deserialize<'de> for Options
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>,
impl Copy for Options
impl StructuralPartialEq for Options
Auto Trait Implementations§
impl Freeze for Options
impl RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl UnwindSafe for Options
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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