Berkeley DB binding. All IO monad functions can throw DbException.
- data DbFlag
- = DB_CREATE
- | DB_DURABLE_UNKNOWN
- | DB_FORCE
- | DB_MULTIVERSION
- | DB_NOMMAP
- | DB_RDONLY
- | DB_RECOVER
- | DB_THREAD
- | DB_TRUNCATE
- | DB_TXN_NOSYNC
- | DB_TXN_NOWAIT
- | DB_TXN_NOT_DURABLE
- | DB_TXN_WRITE_NOSYNC
- | DB_SPARE_FLAG
- | DB_TXN_SYNC
- | DB_TXN_WAIT
- | DB_IGNORE_LEASE
- | DB_AUTO_COMMIT
- | DB_READ_COMMITTED
- | DB_DEGREE_2
- | DB_READ_UNCOMMITTED
- | DB_DIRTY_READ
- | DB_TXN_SNAPSHOT
- | DB_CXX_NO_EXCEPTIONS
- | DB_XA_CREATE
- | DB_USE_ENVIRON
- | DB_USE_ENVIRON_ROOT
- | DB_INIT_CDB
- | DB_INIT_LOCK
- | DB_INIT_LOG
- | DB_INIT_MPOOL
- | DB_INIT_REP
- | DB_INIT_TXN
- | DB_LOCKDOWN
- | DB_PRIVATE
- | DB_RECOVER_FATAL
- | DB_REGISTER
- | DB_SYSTEM_MEM
- | DB_EXCL
- | DB_FCNTL_LOCKING
- | DB_NO_AUTO_COMMIT
- | DB_RDWRMASTER
- | DB_WRITEOPEN
- | DB_MULTIPLE
- | DB_MULTIPLE_KEY
- | DB_RMW
- | DB_LOCK_NOWAIT
- data DbError
- = DB_BUFFER_SMALL
- | DB_DONOTINDEX
- | DB_KEYEMPTY
- | DB_KEYEXIST
- | DB_LOCK_DEADLOCK
- | DB_LOCK_NOTGRANTED
- | DB_LOG_BUFFER_FULL
- | DB_NOSERVER
- | DB_NOSERVER_HOME
- | DB_NOSERVER_ID
- | DB_NOTFOUND
- | DB_OLD_VERSION
- | DB_PAGE_NOTFOUND
- | DB_REP_DUPMASTER
- | DB_REP_HANDLE_DEAD
- | DB_REP_HOLDELECTION
- | DB_REP_IGNORE
- | DB_REP_ISPERM
- | DB_REP_JOIN_FAILURE
- | DB_REP_LEASE_EXPIRED
- | DB_REP_LOCKOUT
- | DB_REP_NEWSITE
- | DB_REP_NOTPERM
- | DB_REP_UNAVAIL
- | DB_RUNRECOVERY
- | DB_SECONDARY_BAD
- | DB_VERIFY_BAD
- | DB_VERSION_MISMATCH
- | DB_ACCESSED_DB_ENV_AFTER_CLOSE
- | DB_ACCESSED_DB_AFTER_CLOSE
- | DB_ACCESSED_DB_TXN_AFTER_CLOSE
- | SYSTEM_ERROR Int
- data DbException = DbException String DbError
- type DbEnv = ForeignPtr DbEnv_struct
- dbEnv_close :: [DbFlag] -> DbEnv -> IO ()
- data DbEnvCreateFlag
- dbEnv_create :: [DbEnvCreateFlag] -> IO DbEnv
- dbEnv_get_cache_size :: DbEnv -> IO (Int, Int, Int)
- dbEnv_get_lg_regionmax :: DbEnv -> IO Int
- dbEnv_get_lk_max_lockers :: DbEnv -> IO Int
- dbEnv_get_lk_max_locks :: DbEnv -> IO Int
- dbEnv_get_lk_max_objects :: DbEnv -> IO Int
- dbEnv_get_tx_max :: DbEnv -> IO Int
- type DbLock = ForeignPtr DbLock_struct
- data DbLocker
- data DbLockMode
- dbEnv_lock_get :: [DbFlag] -> DbLockMode -> ByteString -> DbEnv -> DbLocker -> IO DbLock
- dbEnv_lock_put :: DbLock -> IO ()
- dbEnv_withLock :: [DbFlag] -> DbLockMode -> ByteString -> DbEnv -> DbLocker -> IO () -> IO ()
- dbEnv_open :: [DbFlag] -> Int -> DbEnv -> FilePath -> IO ()
- dbEnv_set_cache_size :: DbEnv -> Int -> Int -> Int -> IO ()
- dbEnv_set_lg_regionmax :: DbEnv -> Int -> IO ()
- data DbLockFlag
- dbEnv_set_lk_detect :: DbEnv -> DbLockFlag -> IO ()
- dbEnv_set_lk_max_lockers :: DbEnv -> Int -> IO ()
- dbEnv_set_lk_max_locks :: DbEnv -> Int -> IO ()
- dbEnv_set_lk_max_objects :: DbEnv -> Int -> IO ()
- dbEnv_set_tx_max :: DbEnv -> Int -> IO ()
- dbEnv_txn_begin :: [DbFlag] -> DbEnv -> Maybe DbTxn -> IO DbTxn
- dbEnv_txn_checkpoint :: [DbFlag] -> DbEnv -> CUInt -> CUInt -> IO ()
- dbEnv_withTxn :: [DbFlag] -> [DbFlag] -> DbEnv -> Maybe DbTxn -> (DbTxn -> IO ()) -> IO ()
- type DbTxn = ForeignPtr DbTxn_struct
- dbTxn_abort :: DbTxn -> IO ()
- dbTxn_commit :: [DbFlag] -> DbTxn -> IO ()
- dbTxn_id :: DbTxn -> DbLocker
- type Db = ForeignPtr Db_struct
- db_close :: [DbFlag] -> Db -> IO ()
- db_create :: [DbFlag] -> DbEnv -> IO Db
- db_del :: [DbFlag] -> Db -> Maybe DbTxn -> ByteString -> IO ()
- db_get :: [DbFlag] -> Db -> Maybe DbTxn -> ByteString -> IO (Maybe ByteString)
- data DbType
- = DB_BTREE
- | DB_HASH
- | DB_RECNO
- | DB_QUEUE
- | DB_UNKNOWN
- db_open :: [DbFlag] -> DbType -> Int -> Db -> Maybe DbTxn -> FilePath -> Maybe String -> IO ()
- db_put :: [DbFlag] -> Db -> Maybe DbTxn -> ByteString -> ByteString -> IO ()
- db_set_pagesize :: Db -> Int -> IO ()
- dbToNum :: DbFlag -> CUInt
- dbErrFromNum :: Int -> DbError
- data DbEnv_struct
- data DbTxn_struct
Common
DB_BUFFER_SMALL | User memory too small for return. |
DB_DONOTINDEX | "Null" return from 2ndary callbk. |
DB_KEYEMPTY | Key/data deleted or never created. |
DB_KEYEXIST | The key/data pair already exists. |
DB_LOCK_DEADLOCK | Deadlock. |
DB_LOCK_NOTGRANTED | Lock unavailable. |
DB_LOG_BUFFER_FULL | In-memory log buffer full. |
DB_NOSERVER | Server panic return. |
DB_NOSERVER_HOME | Bad home sent to server. |
DB_NOSERVER_ID | Bad ID sent to server. |
DB_NOTFOUND | Key/data pair not found (EOF). |
DB_OLD_VERSION | Out-of-date version. |
DB_PAGE_NOTFOUND | Requested page not found. |
DB_REP_DUPMASTER | There are two masters. |
DB_REP_HANDLE_DEAD | Rolled back a commit. |
DB_REP_HOLDELECTION | Time to hold an election. |
DB_REP_IGNORE | This msg should be ignored. |
DB_REP_ISPERM | Cached not written perm written. |
DB_REP_JOIN_FAILURE | Unable to join replication group. |
DB_REP_LEASE_EXPIRED | Master lease has expired. |
DB_REP_LOCKOUT | API/Replication lockout now. |
DB_REP_NEWSITE | New site entered system. |
DB_REP_NOTPERM | Permanent log record not written. |
DB_REP_UNAVAIL | Site cannot currently be reached. |
DB_RUNRECOVERY | Panic return. |
DB_SECONDARY_BAD | Secondary index corrupt. |
DB_VERIFY_BAD | Verify failed; bad format. |
DB_VERSION_MISMATCH | Environment version mismatch. |
DB_ACCESSED_DB_ENV_AFTER_CLOSE | Haskell binding: Attempted to use a DbEnv handle after it was closed |
DB_ACCESSED_DB_AFTER_CLOSE | Haskell binding: Attempted to use a Db handle after it was closed |
DB_ACCESSED_DB_TXN_AFTER_CLOSE | Haskell binding: Attempted to use a DbTxn handle after it was closed |
SYSTEM_ERROR Int | An errno value returned by the operating system |
data DbException Source
An exception indicating an error in a Berkeley DB operation.
DbEnv
type DbEnv = ForeignPtr DbEnv_structSource
data DbEnvCreateFlag Source
dbEnv_create :: [DbEnvCreateFlag] -> IO DbEnvSource
dbEnv_get_tx_max :: DbEnv -> IO IntSource
type DbLock = ForeignPtr DbLock_structSource
:: [DbFlag] | |
-> DbLockMode | |
-> ByteString | Object, which is a key that identifies this lock |
-> DbEnv | |
-> DbLocker | |
-> IO DbLock |
Acquire a DbLock. dbTxn_id
converts a DbTxn to a DbLocker.
dbEnv_lock_put :: DbLock -> IO ()Source
Release a DbLock acquired by dbEnv_lock_get.
:: [DbFlag] | |
-> DbLockMode | |
-> ByteString | Object, which is an environment-wide key that identifies this lock |
-> DbEnv | |
-> DbLocker | |
-> IO () | Computation to perform under lock |
-> IO () |
Wrap dbEnv_lock_get / dbEnv_lock_put around the specified computation.
dbTxn_id
converts a DbTxn to a DbLocker.
data DbLockFlag Source
dbEnv_set_lk_detect :: DbEnv -> DbLockFlag -> IO ()Source
:: [DbFlag] | dbEnv_txn_begin flags |
-> [DbFlag] | dbTxn_commit flags |
-> DbEnv | |
-> Maybe DbTxn | Optional parent transaction |
-> (DbTxn -> IO ()) | The computation to run within a transactional context |
-> IO () |
Execute a computation within a transaction.
DbTxn
type DbTxn = ForeignPtr DbTxn_structSource
dbTxn_abort :: DbTxn -> IO ()Source
Db
type Db = ForeignPtr Db_structSource
db_get :: [DbFlag] -> Db -> Maybe DbTxn -> ByteString -> IO (Maybe ByteString)Source
:: [DbFlag] | |
-> Db | |
-> Maybe DbTxn | |
-> ByteString | Key |
-> ByteString | Value |
-> IO () |
Private
Needed for BerkeleyDBXML: Binary representation of a DbFlag
dbErrFromNum :: Int -> DbErrorSource
Needed for BerkeleyDBXML: Convert an error code to a DbError
data DbEnv_struct Source
Needed for BerkeleyDBXML: C pointer type for a DbEnv
data DbTxn_struct Source
Needed for BerkeleyDBXML: C pointer type for a DbTxn