mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 09:38:24 -05:00
16 lines
501 B
Rust
16 lines
501 B
Rust
//! Utils crate for `db`.
|
|
|
|
/// Returns the default page size that can be used in this OS.
|
|
pub(crate) fn default_page_size() -> usize {
|
|
let os_page_size = page_size::get();
|
|
|
|
// source: https://gitflic.ru/project/erthink/libmdbx/blob?file=mdbx.h#line-num-821
|
|
let libmdbx_max_page_size = 0x10000;
|
|
|
|
// May lead to errors if it's reduced further because of the potential size of the
|
|
// data.
|
|
let min_page_size = 4096;
|
|
|
|
os_page_size.clamp(min_page_size, libmdbx_max_page_size)
|
|
}
|