module Test.Ouroboros.Storage.LedgerDB.V1.LMDB (testLMDBLimits) where

import qualified Ouroboros.Consensus.Storage.LedgerDB.V1.BackingStore.Impl.LMDB as LMDB

testLMDBLimits :: Int -> LMDB.LMDBLimits
testLMDBLimits :: Int -> LMDBLimits
testLMDBLimits Int
maxReaders =
  LMDB.LMDBLimits
    { -- 100 MiB should be more than sufficient for the tests we're running here.
      -- If the database were to grow beyond 100 Mebibytes, resulting in a test
      -- error, then something in the LMDB backing store or tests has changed and
      -- we should reconsider this value.
      lmdbMapSize :: Int
LMDB.lmdbMapSize = Int
100 Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
1024 Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
1024
    , -- 3 internal databases: 1 for the settings, 1 for the state, and 1 for the
      -- ledger tables.
      lmdbMaxDatabases :: Int
LMDB.lmdbMaxDatabases = Int
3
    , lmdbMaxReaders :: Int
LMDB.lmdbMaxReaders = Int
maxReaders
    }