monarch-0.9.0.0: Monadic interface for TokyoTyrant.

Portabilityunknown
Stabilityexperimental
Maintainern.ohkawa@gmail.com
Safe HaskellNone

Database.Monarch

Description

Provide TokyoTyrant monadic access interface.

Synopsis

Documentation

type Monarch = MonarchT IOSource

IO Specialized

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

data RestoreOption Source

Options for restore

Constructors

ConsistencyChecking

consistency checking

data MiscOption Source

Options for miscellaneous operation

Constructors

NoUpdateLog

omission of update log

class MonadMonarch m whereSource

Monad Monarch interfaces

Methods

putSource

Arguments

:: ByteString

key

-> ByteString

value

-> m () 

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

multiplePutSource

Arguments

:: [(ByteString, ByteString)]

key & value pairs

-> m () 

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

putKeepSource

Arguments

:: ByteString

key

-> ByteString

value

-> m () 

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

putCatSource

Arguments

:: ByteString

key

-> ByteString

value

-> m () 

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

putShiftLeftSource

Arguments

:: ByteString

key

-> ByteString

value

-> Int

width

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

putNoResponseSource

Arguments

:: ByteString

key

-> ByteString

value

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

-> m () 

Remove a record.

multipleOutSource

Arguments

:: [ByteString]

keys

-> m () 

Remove records.

getSource

Arguments

:: ByteString

key

-> m (Maybe ByteString) 

Retrieve a record.

multipleGetSource

Arguments

:: [ByteString]

keys

-> m [(ByteString, ByteString)] 

Retrieve records.

valueSizeSource

Arguments

:: ByteString

key

-> m (Maybe Int) 

Get the size of the value of a record.

iterInit :: m ()Source

Initialize the iterator.

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

:: ByteString

key prefix

-> Maybe Int

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

-> m [ByteString] 

Get forward matching keys.

addIntSource

Arguments

:: ByteString

key

-> Int

value

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

:: ByteString

key

-> Double

value

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

:: ByteString

function

-> [ExtOption]

option flags

-> ByteString

key

-> ByteString

value

-> m ByteString 

Call a function of the script language extension.

sync :: m ()Source

Synchronize updated contents with the file and the device.

optimizeSource

Arguments

:: ByteString

parameter

-> m () 

Optimize the storage.

vanish :: m ()Source

Remove all records.

copySource

Arguments

:: ByteString

path

-> m () 

Copy the database file.

restoreSource

Arguments

:: Integral a 
=> ByteString

path

-> a

beginning time stamp in microseconds

-> [RestoreOption]

option flags

-> m () 

Restore the database file from the update log.

setMasterSource

Arguments

:: Integral a 
=> ByteString

host

-> Int

port

-> a

beginning time stamp in microseconds

-> [RestoreOption]

option flags

-> m () 

Set the replication master.

recordNum :: m Int64Source

Get the number of records.

size :: m Int64Source

Get the size of the database.

status :: m ByteStringSource

Get the status string of the database.

miscSource

Arguments

:: ByteString

function name

-> [MiscOption]

option flags

-> [ByteString]

arguments

-> m [ByteString] 

Call a versatile function for miscellaneous operations.