monarch-0.8.1.3: Monadic interface for TokyoTyrant.

Safe HaskellNone

Database.Monarch

Description

This module provide TokyoTyrant monadic access interface.

Synopsis

Documentation

data MonarchT m a Source

The Monarch monad transformer to provide TokyoTyrant access.

data Connection Source

Connection with TokyoTyrant

Instances

type ConnectionPool = Pool ConnectionSource

Connection pool with TokyoTyrant

withMonarchConnSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> String

host

-> Int

port

-> (Connection -> m a) 
-> m a 

Create a TokyoTyrant connection and run the given action. Don't use the given Connection outside the action.

withMonarchPoolSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> String

host

-> Int

port

-> Int

number of connections

-> (ConnectionPool -> m a) 
-> m a 

Create a TokyoTyrant connection pool and run the given action. Don't use the given ConnectionPool outside the action.

runMonarchConnSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> MonarchT m a

action

-> Connection

connection

-> m (Either Code a) 

Run action with a connection.

runMonarchPoolSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> MonarchT m a

action

-> ConnectionPool

connection pool

-> m (Either Code a) 

Run action with a unused connection from the pool.

data ExtOption Source

Options for scripting extension

Constructors

RecordLocking

record locking

GlobalLocking

global locking

Instances

BitFlag32 ExtOption 

data RestoreOption Source

Options for restore

Constructors

ConsistencyChecking

consistency checking

Instances

BitFlag32 RestoreOption 

data MiscOption Source

Options for miscellaneous operation

Constructors

NoUpdateLog

omission of update log

Instances

BitFlag32 MiscOption 

putSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> ByteString

value

-> MonarchT m () 

Store a record. If a record with the same key exists in the database, it is overwritten.

putKeepSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> ByteString

value

-> MonarchT m () 

Store a new record. If a record with the same key exists in the database, this function has no effect.

putCatSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> ByteString

value

-> MonarchT m () 

Concatenate a value at the end of the existing record. If there is no corresponding record, a new record is created.

putShiftLeftSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> ByteString

value

-> Int

width

-> MonarchT m () 

Concatenate a value at the end of the existing record and shift it to the left. If there is no corresponding record, a new record is created.

multiplePutSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> [(ByteString, ByteString)]

key & value pairs

-> MonarchT m () 

Store records. If a record with the same key exists in the database, it is overwritten.

putNoResponseSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> ByteString

value

-> MonarchT m () 

Store a record without response. If a record with the same key exists in the database, it is overwritten.

outSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> MonarchT m () 

Remove a record.

multipleOutSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> [ByteString]

keys

-> MonarchT m () 

Remove records.

getSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> MonarchT m (Maybe ByteString) 

Retrieve a record.

multipleGetSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> [ByteString]

keys

-> MonarchT m [(ByteString, ByteString)] 

Retrieve records.

valueSizeSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> MonarchT m (Maybe Int) 

Get the size of the value of a record.

iterInit :: (MonadBaseControl IO m, MonadIO m) => MonarchT m ()Source

Initialize the iterator.

iterNext :: (MonadBaseControl IO m, MonadIO m) => MonarchT m (Maybe ByteString)Source

Get the next key of the iterator. The iterator can be updated by multiple connections and then it is not assured that every record is traversed.

forwardMatchingKeysSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key prefix

-> Maybe Int

maximum number of keys to be fetched. Nothing means unlimited.

-> MonarchT m [ByteString] 

Get forward matching keys.

addIntSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> Int

value

-> MonarchT m Int 

Add an integer to a record. If the corresponding record exists, the value is treated as an integer and is added to. If no record corresponds, a new record of the additional value is stored.

addDoubleSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

key

-> Double

value

-> MonarchT m Double 

Add a real number to a record. If the corresponding record exists, the value is treated as a real number and is added to. If no record corresponds, a new record of the additional value is stored.

extSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

function

-> [ExtOption]

option flags

-> ByteString

key

-> ByteString

value

-> MonarchT m ByteString 

Call a function of the script language extension.

sync :: (MonadBaseControl IO m, MonadIO m) => MonarchT m ()Source

Synchronize updated contents with the file and the device.

optimizeSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

parameter

-> MonarchT m () 

Optimize the storage.

vanish :: (MonadBaseControl IO m, MonadIO m) => MonarchT m ()Source

Remove all records.

copySource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

path

-> MonarchT m () 

Copy the database file.

restoreSource

Arguments

:: (MonadBaseControl IO m, MonadIO m, Integral a) 
=> ByteString

path

-> a

beginning time stamp in microseconds

-> [RestoreOption]

option flags

-> MonarchT m () 

Restore the database file from the update log.

setMasterSource

Arguments

:: (MonadBaseControl IO m, MonadIO m, Integral a) 
=> ByteString

host

-> Int

port

-> a

beginning time stamp in microseconds

-> [RestoreOption]

option flags

-> MonarchT m () 

Set the replication master.

recordNum :: (MonadBaseControl IO m, MonadIO m) => MonarchT m Int64Source

Get the number of records.

size :: (MonadBaseControl IO m, MonadIO m) => MonarchT m Int64Source

Get the size of the database.

status :: (MonadBaseControl IO m, MonadIO m) => MonarchT m ByteStringSource

Get the status string of the database.

miscSource

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> ByteString

function name

-> [MiscOption]

option flags

-> [ByteString]

arguments

-> MonarchT m [ByteString] 

Call a versatile function for miscellaneous operations.