monarch-0.2.0.0: Monadic interface for TokyoTyrant.

Safe HaskellNone

Database.Monarch

Description

This module provide TokyoTyrant monadic access interface.

TokyoTyrant Original Binary Protocol(http://fallabs.com/tokyotyrant/spex.html#protocol) is implemented.

Synopsis

Documentation

data Monarch a Source

A monad supporting TokyoTyrant access.

runMonarch :: MonadIO m => String -> Int -> Monarch a -> m (Either Code a)Source

Run Monarch with TokyoTyrant at target host and port.

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

:: ByteString

key

-> ByteString

value

-> Monarch () 

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

putKeepSource

Arguments

:: ByteString

key

-> ByteString

value

-> Monarch () 

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

-> Monarch () 

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

-> Monarch () 

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

-> Monarch () 

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

outSource

Arguments

:: ByteString

key

-> Monarch () 

Remove a record.

getSource

Arguments

:: ByteString

key

-> Monarch (Maybe ByteString) 

Retrieve a record.

multipleGetSource

Arguments

:: [ByteString]

keys

-> Monarch [(ByteString, ByteString)] 

Retrieve records.

valueSizeSource

Arguments

:: ByteString

key

-> Monarch (Maybe Int) 

Get the size of the value of a record.

iterInit :: Monarch ()Source

Initialize the iterator.

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

-> Int

maximum number of keys to be fetched

-> Monarch [ByteString] 

Get forward matching keys.

addIntSource

Arguments

:: ByteString

key

-> Int

value

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

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

-> Monarch ByteString 

Call a function of the script language extension.

sync :: Monarch ()Source

Synchronize updated contents with the file and the device.

optimizeSource

Arguments

:: ByteString

parameter

-> Monarch () 

Optimize the storage.

vanish :: Monarch ()Source

Remove all records.

copySource

Arguments

:: ByteString

path

-> Monarch () 

Copy the database file.

restoreSource

Arguments

:: Integral a 
=> ByteString

path

-> a

beginning time stamp in microseconds

-> [RestoreOption]

option flags

-> Monarch () 

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

-> Monarch () 

Set the replication master.

recordNum :: Monarch Int64Source

Get the number of records.

size :: Monarch Int64Source

Get the size of the database.

status :: Monarch ByteStringSource

Get the status string of the database.

miscSource

Arguments

:: ByteString

function name

-> [MiscOption]

option flags

-> [ByteString]

arguments

-> Monarch [ByteString] 

Call a versatile function for miscellaneous operations.