BerkeleyDB-0.6: Berkeley DB binding

Database.Berkeley.Db

Contents

Description

Berkeley DB binding. All IO monad functions can throw DbException.

Synopsis

Common

data DbError Source

Constructors

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

Instances

data DbException Source

An exception indicating an error in a Berkeley DB operation.

Constructors

DbException String DbError 

DbEnv

type DbLock = ForeignPtr DbLock_structSource

dbEnv_lock_getSource

Arguments

:: [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.

dbEnv_withLockSource

Arguments

:: [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.

dbEnv_openSource

Arguments

:: [DbFlag] 
-> Int

UNIX file creation mode, or 0, meaning readable and writable by both owner and group

-> DbEnv 
-> FilePath

Database environment's home directory

-> IO () 

dbEnv_txn_beginSource

Arguments

:: [DbFlag] 
-> DbEnv 
-> Maybe DbTxn

Optional parent transaction

-> IO DbTxn 

dbEnv_txn_checkpointSource

Arguments

:: [DbFlag] 
-> DbEnv 
-> CUInt

kbyte

-> CUInt

min

-> IO () 

dbEnv_withTxnSource

Arguments

:: [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

Db

type Db = ForeignPtr Db_structSource

db_openSource

Arguments

:: [DbFlag] 
-> DbType 
-> Int

Unix file creation mode, or 0, meaning readable and writable by both owner and group

-> Db 
-> Maybe DbTxn 
-> FilePath

Filename

-> Maybe String

Optional name of database within the file

-> IO () 

db_putSource

Arguments

:: [DbFlag] 
-> Db 
-> Maybe DbTxn 
-> ByteString

Key

-> ByteString

Value

-> IO () 

Private

Needed for BerkeleyDBXML: Binary representation of a DbFlag

Needed for BerkeleyDBXML: Convert an error code to a DbError

Needed for BerkeleyDBXML: C pointer type for a DbEnv

Needed for BerkeleyDBXML: C pointer type for a DbTxn