| Safe Haskell | None |
|---|
Database.Monarch
Description
This module provide TokyoTyrant monadic access interface.
TokyoTyrant Original Binary Protocol(http://fallabs.com/tokyotyrant/spex.html#protocol) is implemented.
- data Monarch a
- runMonarch :: MonadIO m => String -> Int -> Monarch a -> m (Either Code a)
- data ExtOption
- data RestoreOption = ConsistencyChecking
- data MiscOption = NoUpdateLog
- data Code
- put :: ByteString -> ByteString -> Monarch ()
- putKeep :: ByteString -> ByteString -> Monarch ()
- putCat :: ByteString -> ByteString -> Monarch ()
- putShiftLeft :: ByteString -> ByteString -> Int -> Monarch ()
- putNoResponse :: ByteString -> ByteString -> Monarch ()
- out :: ByteString -> Monarch ()
- get :: ByteString -> Monarch (Maybe ByteString)
- multipleGet :: [ByteString] -> Monarch [(ByteString, ByteString)]
- valueSize :: ByteString -> Monarch (Maybe Int)
- iterInit :: Monarch ()
- iterNext :: Monarch (Maybe ByteString)
- forwardMatchingKeys :: ByteString -> Int -> Monarch [ByteString]
- addInt :: ByteString -> Int -> Monarch Int
- addDouble :: ByteString -> Double -> Monarch Double
- ext :: ByteString -> [ExtOption] -> ByteString -> ByteString -> Monarch ByteString
- sync :: Monarch ()
- optimize :: ByteString -> Monarch ()
- vanish :: Monarch ()
- copy :: ByteString -> Monarch ()
- restore :: Integral a => ByteString -> a -> [RestoreOption] -> Monarch ()
- setMaster :: Integral a => ByteString -> Int -> a -> [RestoreOption] -> Monarch ()
- recordNum :: Monarch Int64
- size :: Monarch Int64
- status :: Monarch ByteString
- misc :: ByteString -> [MiscOption] -> [ByteString] -> Monarch [ByteString]
Documentation
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.
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 |
Error code
Arguments
| :: ByteString | key |
| -> ByteString | value |
| -> Monarch () |
Store a record. If a record with the same key exists in the database, it is overwritten.
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.
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.
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.
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.
Arguments
| :: [ByteString] | keys |
| -> Monarch [(ByteString, ByteString)] |
Retrieve records.
Arguments
| :: ByteString | key |
| -> Monarch (Maybe Int) |
Get the size of the value of a record.
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.
Arguments
| :: ByteString | key prefix |
| -> Int | maximum number of keys to be fetched |
| -> Monarch [ByteString] |
Get forward matching keys.
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.
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.
Arguments
| :: ByteString | function |
| -> [ExtOption] | option flags |
| -> ByteString | key |
| -> ByteString | value |
| -> Monarch ByteString |
Call a function of the script language extension.
Arguments
| :: Integral a | |
| => ByteString | path |
| -> a | beginning time stamp in microseconds |
| -> [RestoreOption] | option flags |
| -> Monarch () |
Restore the database file from the update log.
Arguments
| :: Integral a | |
| => ByteString | host |
| -> Int | port |
| -> a | beginning time stamp in microseconds |
| -> [RestoreOption] | option flags |
| -> Monarch () |
Set the replication master.
status :: Monarch ByteStringSource
Get the status string of the database.
Arguments
| :: ByteString | function name |
| -> [MiscOption] | option flags |
| -> [ByteString] | arguments |
| -> Monarch [ByteString] |
Call a versatile function for miscellaneous operations.