// Copyright (c) The Limenka developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef LIMENKA_NODE_DBCACHE_H #define LIMENKA_NODE_DBCACHE_H #include #include #include #include //! min. -dbcache (bytes) static constexpr uint64_t MIN_DBCACHE_BYTES{4_MiB}; //! Automatic -dbcache floor (bytes) static constexpr uint64_t MIN_DEFAULT_DBCACHE{100_MiB}; //! Automatic -dbcache cap (bytes) static constexpr uint64_t MAX_DEFAULT_DBCACHE{2_GiB}; //! Assumed total RAM when we cannot determine it. static constexpr uint64_t FALLBACK_RAM_BYTES{SIZE_MAX > UINT32_MAX ? 4_GiB : 2_GiB}; //! Reserved non-dbcache memory usage. static constexpr uint64_t RESERVED_RAM{2_GiB}; //! Maximum dbcache size on current architecture. static constexpr uint64_t MAX_DBCACHE_BYTES{SIZE_MAX > UINT32_MAX ? std::numeric_limits::max() : 1_GiB}; namespace node { size_t GetTotalRam() noexcept; size_t GetDefaultDBCache(std::optional total_ram = {}) noexcept; bool ShouldWarnOversizedDbCache(uint64_t dbcache, uint64_t total_ram) noexcept; } // namespace node #endif // LIMENKA_NODE_DBCACHE_H