close :: HasLogFunc e => FilePath -> EventLog -> RIO e ()
close dir (EventLog env meta events effects _ _) = do
    logDebug $ display (pack @Text $ "Closing LMDB database: " <> dir)
    io $ do mdb_dbi_close env meta
            mdb_dbi_close env events
            mdb_dbi_close env effects
            mdb_env_sync_flush env
            mdb_env_close env


-- Create a new event log or open an existing one. -----------------------------
close :: HasLogFunc e => FilePath -> EventLog -> RIO e ()
close dir (EventLog env meta events effects _ _) = do
    logDebug $ display (pack @Text $ "Closing LMDB database: " <> dir)
    io $ do mdb_dbi_close env meta
            mdb_dbi_close env events
            mdb_dbi_close env effects
            mdb_env_sync_flush env
            mdb_env_close env


-- Create a new event log or open an existing one. -----------------------------
close dir (EventLog env meta events effects _ _) = do
    logDebug $ display (pack @Text $ "Closing LMDB database: " <> dir)
    io $ do mdb_dbi_close env meta
            mdb_dbi_close env events
            mdb_dbi_close env effects
            mdb_env_sync_flush env
            mdb_env_close env


-- Create a new event log or open an existing one. -----------------------------