rocksdb-haskell-1.0.1: Haskell bindings to RocksDB
Copyright(c) 2012-2013 The leveldb-haskell Authors
(c) 2014 The rocksdb-haskell Authors
LicenseBSD3
Maintainer[email protected]
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Database.RocksDB.Base

Description

RocksDB Haskell binding.

The API closely follows the C-API of RocksDB. For more information, see: http://agrafix.net

Synopsis

Exported Types

data DB Source #

Database handle

Instances

Instances details
Eq DB Source # 
Instance details

Defined in Database.RocksDB.Internal

Methods

(==) :: DB -> DB -> Bool #

(/=) :: DB -> DB -> Bool #

data BatchOp Source #

Batch operation

Instances

Instances details
Show BatchOp Source # 
Instance details

Defined in Database.RocksDB.Types

Eq BatchOp Source # 
Instance details

Defined in Database.RocksDB.Types

Methods

(==) :: BatchOp -> BatchOp -> Bool #

(/=) :: BatchOp -> BatchOp -> Bool #

newtype Comparator Source #

User-defined comparator

data Compression Source #

Compression setting

Instances

Instances details
Show Compression Source # 
Instance details

Defined in Database.RocksDB.Types

Eq Compression Source # 
Instance details

Defined in Database.RocksDB.Types

data Options Source #

Options when opening a database

Constructors

Options 

Fields

  • comparator :: !(Maybe Comparator)

    Comparator used to defined the order of keys in the table.

    If Nothing, the default comparator is used, which uses lexicographic bytes-wise ordering.

    NOTE: the client must ensure that the comparator supplied here has the same name and orders keys exactly the same as the comparator provided to previous open calls on the same DB.

    Default: Nothing

  • compression :: !Compression

    Compress blocks using the specified compression algorithm.

    This parameter can be changed dynamically.

    Default: EnableCompression

  • createIfMissing :: !Bool

    If true, the database will be created if it is missing.

    Default: False

  • errorIfExists :: !Bool

    It true, an error is raised if the database already exists.

    Default: False

  • maxOpenFiles :: !Int

    Number of open files that can be used by the DB.

    You may need to increase this if your database has a large working set (budget one open file per 2MB of working set).

    Default: 1000

  • paranoidChecks :: !Bool

    If true, the implementation will do aggressive checking of the data it is processing and will stop early if it detects any errors.

    This may have unforeseen ramifications: for example, a corruption of one DB entry may cause a large number of entries to become unreadable or for the entire DB to become unopenable.

    Default: False

  • writeBufferSize :: !Int

    Amount of data to build up in memory (backed by an unsorted log on disk) before converting to a sorted on-disk file.

    Larger values increase performance, especially during bulk loads. Up to to write buffers may be held in memory at the same time, so you may with to adjust this parameter to control memory usage. Also, a larger write buffer will result in a longer recovery time the next time the database is opened.

    Default: 4MB

Instances

Instances details
Default Options Source # 
Instance details

Defined in Database.RocksDB.Types

Methods

def :: Options #

data ReadOptions Source #

Options for read operations

Constructors

ReadOptions 

Fields

  • verifyCheckSums :: !Bool

    If true, all data read from underlying storage will be verified against corresponding checksuyms.

    Default: False

  • fillCache :: !Bool

    Should the data read for this iteration be cached in memory? Callers may with to set this field to false for bulk scans.

    Default: True

  • useSnapshot :: !(Maybe Snapshot)

    If Just, read as of the supplied snapshot (which must belong to the DB that is being read and which must not have been released). If Nothing, use an implicit snapshot of the state at the beginning of this read operation.

    Default: Nothing

Instances

Instances details
Default ReadOptions Source # 
Instance details

Defined in Database.RocksDB.Types

Methods

def :: ReadOptions #

Eq ReadOptions Source # 
Instance details

Defined in Database.RocksDB.Types

data Snapshot Source #

Snapshot handle

Instances

Instances details
Eq Snapshot Source # 
Instance details

Defined in Database.RocksDB.Types

data WriteOptions Source #

Options for write operations

Constructors

WriteOptions 

Fields

  • sync :: !Bool

    If true, the write will be flushed from the operating system buffer cache (by calling WritableFile::Sync()) before the write is considered complete. If this flag is true, writes will be slower.

    If this flag is false, and the machine crashes, some recent writes may be lost. Note that if it is just the process that crashes (i.e., the machine does not reboot), no writes will be lost even if sync==false.

    In other words, a DB write with sync==false has similar crash semantics as the "write()" system call. A DB write with sync==true has similar crash semantics to a "write()" system call followed by "fsync()".

    Default: False

Instances

Instances details
Show WriteOptions Source # 
Instance details

Defined in Database.RocksDB.Types

Default WriteOptions Source # 
Instance details

Defined in Database.RocksDB.Types

Methods

def :: WriteOptions #

Eq WriteOptions Source # 
Instance details

Defined in Database.RocksDB.Types

Defaults

Basic Database Manipulations

open :: MonadIO m => FilePath -> Options -> m DB Source #

Open a database.

The returned handle should be released with close.

openBracket :: MonadResource m => FilePath -> Options -> m (ReleaseKey, DB) Source #

Open a database

The returned handle will automatically be released when the enclosing runResourceT terminates.

close :: MonadIO m => DB -> m () Source #

Close a database.

The handle will be invalid after calling this action and should no longer be used.

put :: MonadIO m => DB -> WriteOptions -> ByteString -> ByteString -> m () Source #

Write a key/value pair.

putBinaryVal :: (MonadIO m, Binary v) => DB -> WriteOptions -> ByteString -> v -> m () Source #

putBinary :: (MonadIO m, Binary k, Binary v) => DB -> WriteOptions -> k -> v -> m () Source #

delete :: MonadIO m => DB -> WriteOptions -> ByteString -> m () Source #

Delete a key/value pair.

write :: MonadIO m => DB -> WriteOptions -> WriteBatch -> m () Source #

Perform a batch mutation.

get :: MonadIO m => DB -> ReadOptions -> ByteString -> m (Maybe ByteString) Source #

Read a value by key.

getBinary :: (MonadIO m, Binary k, Binary v) => DB -> ReadOptions -> k -> m (Maybe v) Source #

withSnapshot :: MonadIO m => DB -> (Snapshot -> IO a) -> m a Source #

Run an action with a Snapshot of the database.

withSnapshotBracket :: MonadResource m => DB -> (Snapshot -> m a) -> m a Source #

Run an action with a snapshot of the database.

The snapshot will be released when the action terminates or throws an exception. Note that this function is provided for convenience and does not prevent the Snapshot handle to escape. It will, however, be invalid after this function returns and should not be used anymore.

createSnapshot :: MonadIO m => DB -> m Snapshot Source #

Create a snapshot of the database.

The returned Snapshot should be released with releaseSnapshot.

releaseSnapshot :: MonadIO m => DB -> Snapshot -> m () Source #

Release a snapshot.

The handle will be invalid after calling this action and should no longer be used.

Filter Policy / Bloom Filter

data FilterPolicy Source #

User-defined filter policy

data BloomFilter Source #

Represents the built-in Bloom Filter

Administrative Functions

data Property Source #

Properties exposed by RocksDB

Instances

Instances details
Show Property Source # 
Instance details

Defined in Database.RocksDB.Types

Eq Property Source # 
Instance details

Defined in Database.RocksDB.Types

getProperty :: MonadIO m => DB -> Property -> m (Maybe ByteString) Source #

Get a DB property.

destroy :: MonadIO m => FilePath -> Options -> m () Source #

Destroy the given RocksDB database.

repair :: MonadIO m => FilePath -> Options -> m () Source #

Repair the given RocksDB database.

approximateSize :: MonadIO m => DB -> Range -> m Int64 Source #

Inspect the approximate sizes of the different levels.

Iteration