Copyright | (c) 2015 Călin Ardelean |
---|---|
License | MIT |
Maintainer | Călin Ardelean <calinucs@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Database resource management.
- module Database.Muesli.Types
- module Database.Muesli.Backend.Types
- module Database.Muesli.Backend.File
- data Handle l
- open :: (MonadIO m, LogState l) => Maybe DbPath -> Maybe DbPath -> Maybe (Int, Int, NominalDiffTime) -> Maybe Int -> m (Handle l)
- close :: (MonadIO m, LogState l) => Handle l -> m ()
- performGC :: MonadIO m => Handle l -> m ()
- debug :: (MonadIO m, LogState l) => Handle l -> Bool -> Bool -> m String
Documentation
module Database.Muesli.Types
module Database.Muesli.Backend.File
Handle used for database management operations.
The l
parameter stands for a LogState
backend.
:: (MonadIO m, LogState l) | |
=> Maybe DbPath | Log path. Default is |
-> Maybe DbPath | Data path. Default is |
-> Maybe (Int, Int, NominalDiffTime) |
|
-> Maybe Int | Commit delay in microseconds. Default is 100ms. |
-> m (Handle l) |
Opens a database, reads the transaction log and builds the in-memory indexes.
The l
parameter of the resulting Handle
should be instantiated by the user
in order to specify a backend. For example, to use the file backend:
import qualified Database.Muesli.Handle as DB openDataBase :: FilePath -> FilePath -> IO (DB.Handle DB.FileLogState) openDataBase logPath dataPath = open (Just logPath) (Just dataPath) Nothing Nothing