-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A memcached client library. -- -- A client library for a memcached cluster. It is aimed at full binary -- protocol support, ease of use and speed. @package memcache @version 0.0.0 -- | Stores the various types needed by memcache. Mostly concerned with the -- representation of the protocol. module Database.Memcache.Types data Q Loud :: Q Quiet :: Q data K NoKey :: K IncludeKey :: K type Key = ByteString type Value = ByteString type Extras = ByteString type Initial = Word64 type Delta = Word64 type Expiration = Word32 type Flags = Word32 type Version = Word64 mEMCACHE_HEADER_SIZE :: Int data Header Header :: Word8 -> Word16 -> Word8 -> Status -> Word32 -> Word32 -> Version -> Header op :: Header -> Word8 keyLen :: Header -> Word16 extraLen :: Header -> Word8 status :: Header -> Status bodyLen :: Header -> Word32 opaque :: Header -> Word32 cas :: Header -> Version data Request Req :: OpRequest -> Word32 -> Version -> Request reqOp :: Request -> OpRequest reqOpaque :: Request -> Word32 reqCas :: Request -> Version data OpRequest ReqGet :: Q -> K -> Key -> OpRequest ReqSet :: Q -> Key -> Value -> SESet -> OpRequest ReqAdd :: Q -> Key -> Value -> SESet -> OpRequest ReqReplace :: Q -> Key -> Value -> SESet -> OpRequest ReqDelete :: Q -> Key -> OpRequest ReqIncrement :: Q -> Key -> SEIncr -> OpRequest ReqDecrement :: Q -> Key -> SEIncr -> OpRequest ReqAppend :: Q -> Key -> Value -> OpRequest ReqPrepend :: Q -> Key -> Value -> OpRequest ReqTouch :: Key -> SETouch -> OpRequest ReqGAT :: Q -> K -> Key -> SETouch -> OpRequest ReqFlush :: Q -> (Maybe SETouch) -> OpRequest ReqNoop :: OpRequest ReqVersion :: OpRequest ReqStat :: (Maybe Key) -> OpRequest ReqQuit :: Q -> OpRequest ReqSASLList :: OpRequest ReqSASLStart :: Key -> Value -> OpRequest ReqSASLStep :: Key -> Value -> OpRequest data SESet SESet :: Flags -> Expiration -> SESet data SEIncr SEIncr :: Initial -> Delta -> Expiration -> SEIncr data SETouch SETouch :: Expiration -> SETouch emptyReq :: Request data Response Res :: OpResponse -> Status -> Word32 -> Version -> Response resOp :: Response -> OpResponse resStatus :: Response -> Status resOpaque :: Response -> Word32 resCas :: Response -> Version data OpResponse ResGet :: Q -> Value -> Flags -> OpResponse ResGetK :: Q -> Key -> Value -> Flags -> OpResponse ResSet :: Q -> OpResponse ResAdd :: Q -> OpResponse ResReplace :: Q -> OpResponse ResDelete :: Q -> OpResponse ResIncrement :: Q -> Word64 -> OpResponse ResDecrement :: Q -> Word64 -> OpResponse ResAppend :: Q -> OpResponse ResPrepend :: Q -> OpResponse ResTouch :: OpResponse ResGAT :: Q -> Value -> Flags -> OpResponse ResGATK :: Q -> Key -> Value -> Flags -> OpResponse ResFlush :: Q -> OpResponse ResNoop :: OpResponse ResVersion :: Value -> OpResponse ResStat :: Key -> Value -> OpResponse ResQuit :: Q -> OpResponse ResSASLList :: Value -> OpResponse ResSASLStart :: OpResponse ResSASLStep :: OpResponse data Status NoError :: Status ErrKeyNotFound :: Status ErrKeyExists :: Status ErrValueTooLarge :: Status ErrInvalidArgs :: Status ErrItemNotStored :: Status ErrValueNonNumeric :: Status ErrUnknownCommand :: Status ErrOutOfMemory :: Status SaslAuthFail :: Status SaslAuthContinue :: Status data ProtocolError ProtocolError :: String -> Maybe Header -> [String] -> ProtocolError protocolMessage :: ProtocolError -> String protocolHeader :: ProtocolError -> Maybe Header protocolParams :: ProtocolError -> [String] data IncorrectResponse IncorrectResponse :: String -> Response -> IncorrectResponse increspMessage :: IncorrectResponse -> String increspActual :: IncorrectResponse -> Response instance Typeable Q instance Typeable K instance Typeable SESet instance Typeable SEIncr instance Typeable SETouch instance Typeable OpRequest instance Typeable Request instance Typeable OpResponse instance Typeable Status instance Typeable Response instance Typeable Header instance Typeable ProtocolError instance Typeable IncorrectResponse instance Eq Q instance Show Q instance Eq K instance Show K instance Eq SESet instance Show SESet instance Eq SEIncr instance Show SEIncr instance Eq SETouch instance Show SETouch instance Eq OpRequest instance Show OpRequest instance Eq Request instance Show Request instance Eq OpResponse instance Show OpResponse instance Eq Status instance Show Status instance Eq Response instance Show Response instance Eq Header instance Show Header instance Eq ProtocolError instance Show ProtocolError instance Eq IncorrectResponse instance Show IncorrectResponse instance Exception IncorrectResponse instance Exception ProtocolError -- | Deals with serializing and parsing memcached requests and responses. module Database.Memcache.Wire -- | Serialize a request to a ByteString Builder. szRequest :: Request -> Builder -- | Serialize a request to a ByteString. szRequest' :: Request -> ByteString -- | Deserialize a Response. dzResponse :: Get Response -- | Deserialize a Response from a ByteString. dzResponse' :: ByteString -> Response -- | Deserialize a Header. dzHeader :: Get Header -- | Deserialize a Header from a ByteString. dzHeader' :: ByteString -> Header -- | Deserialize a Response body. dzBody :: Header -> Get Response -- | Deserialize a Response body from a ByteString. dzBody' :: Header -> ByteString -> Response -- | Handles the connections between a memcache client and the various -- servers that make up the cluster. module Database.Memcache.Server -- | A Memcache connection handle. XXX: Should make abstract data Connection Conn :: MVar Socket -> Connection conn :: Connection -> MVar Socket -- | Establish a new connection to a memcache backend. newMemcacheClient :: HostName -> PortNumber -> IO Connection -- | Send a request to the memcache cluster. send :: Socket -> Request -> IO () -- | Send a receieve a single request/response pair to the memcache -- cluster. sendRecv :: Connection -> Request -> IO Response -- | Retrieve a single response from the memcache cluster. recv :: Socket -> IO Response -- | Memcache related errors and exception handling. module Database.Memcache.Errors -- | Exceptions that may be thrown by Memcache. data MemcacheError MemErrNoKey :: MemcacheError MemErrKeyExists :: MemcacheError MemErrValueTooLarge :: MemcacheError MemErrInvalidArgs :: MemcacheError MemErrStoreFailed :: MemcacheError MemErrValueNonNumeric :: MemcacheError MemErrUnknownCmd :: MemcacheError MemErrOutOfMemory :: MemcacheError -- | Convert a status to an error. Note, not all status's are errors and so -- this is a partial function! statusToError :: Status -> MemcacheError -- | Convert a status to an exception. Note, not all status's are errors -- and so this is not a complete function! throwStatus :: Response -> IO a -- | Throw an IncorrectResponse exception for a wrong received response. throwIncorrectRes :: Response -> String -> IO a instance Typeable MemcacheError instance Eq MemcacheError instance Show MemcacheError instance Exception MemcacheError -- | A raw, low level interface to the memcache protocol. -- -- The various operations are represented in full as they appear at the -- protocol level and so aren't generaly well suited for application use. -- Instead, applications should use Database.Memcache.Client which -- presents a higher level API suited for application use. module Database.Memcache.Protocol get :: Connection -> Key -> IO (Maybe (Value, Flags, Version)) gat :: Connection -> Key -> Expiration -> IO (Maybe (Value, Flags, Version)) touch :: Connection -> Key -> Expiration -> IO (Maybe Version) set :: Connection -> Key -> Value -> Flags -> Expiration -> IO Version set' :: Connection -> Key -> Value -> Flags -> Expiration -> Version -> IO (Maybe Version) add :: Connection -> Key -> Value -> Flags -> Expiration -> IO (Maybe Version) replace :: Connection -> Key -> Value -> Flags -> Expiration -> Version -> IO (Maybe Version) delete :: Connection -> Key -> Version -> IO Bool increment :: Connection -> Key -> Initial -> Delta -> Expiration -> Version -> IO (Maybe (Word64, Version)) decrement :: Connection -> Key -> Initial -> Delta -> Expiration -> Version -> IO (Maybe (Word64, Version)) append :: Connection -> Key -> Value -> Version -> IO (Maybe Version) prepend :: Connection -> Key -> Value -> Version -> IO (Maybe Version) flush :: Connection -> Maybe Expiration -> IO () noop :: Connection -> IO () version :: Connection -> IO ByteString stats :: Connection -> Maybe Key -> IO (Maybe [(ByteString, ByteString)]) quit :: Connection -> IO () -- | SASL authentication support for memcached. module Database.Memcache.SASL -- | Perform SASL authentication with the server. authenticate :: Connection -> Username -> Password -> IO Bool -- | Username for authentication. type Username = ByteString -- | Password for authentication. type Password = ByteString -- | A memcache client. module Database.Memcache.Client