| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Database.Franz.Client
Synopsis
- data FranzPath
- = FranzPath { }
- | LocalFranzPath !FilePath
- fromFranzPath :: (Monoid a, IsString a) => FranzPath -> a
- toFranzPath :: String -> Either String FranzPath
- defaultPort :: PortNumber
- data Connection
- withConnection :: FranzPath -> (Connection -> IO r) -> IO r
- connect :: FranzPath -> IO Connection
- disconnect :: Connection -> IO ()
- newtype StreamName = StreamName {}
- data Query = Query {
- reqStream :: !StreamName
- reqFrom :: !ItemRef
- reqTo :: !ItemRef
- reqType :: !RequestType
- data ItemRef
- data RequestType
- defQuery :: StreamName -> Query
- type Response = Either Contents (STM Contents)
- awaitResponse :: STM (Either a (STM a)) -> STM a
- data Contents
- fetch :: Connection -> Query -> (STM Response -> IO r) -> IO r
- fetchSimple :: Connection -> Int -> Query -> IO (Maybe Contents)
- atomicallyWithin :: Int -> STM a -> IO (Maybe a)
- data FranzException
Documentation
Constructors
| FranzPath | |
| LocalFranzPath !FilePath | |
Instances
| Eq FranzPath Source # | |
| Ord FranzPath Source # | |
| Show FranzPath Source # | |
toFranzPath :: String -> Either String FranzPath Source #
Parse a franz URI (franz:/host:portpath or franz-local:path).
data Connection Source #
withConnection :: FranzPath -> (Connection -> IO r) -> IO r Source #
disconnect :: Connection -> IO () Source #
newtype StreamName Source #
Constructors
| StreamName | |
Fields | |
Instances
| Eq StreamName Source # | |
Defined in Database.Franz.Internal.Protocol | |
| Ord StreamName Source # | |
Defined in Database.Franz.Internal.Protocol Methods compare :: StreamName -> StreamName -> Ordering # (<) :: StreamName -> StreamName -> Bool # (<=) :: StreamName -> StreamName -> Bool # (>) :: StreamName -> StreamName -> Bool # (>=) :: StreamName -> StreamName -> Bool # max :: StreamName -> StreamName -> StreamName # min :: StreamName -> StreamName -> StreamName # | |
| Show StreamName Source # | |
Defined in Database.Franz.Internal.Protocol Methods showsPrec :: Int -> StreamName -> ShowS # show :: StreamName -> String # showList :: [StreamName] -> ShowS # | |
| IsString StreamName Source # | UTF-8 encoded |
Defined in Database.Franz.Internal.Protocol Methods fromString :: String -> StreamName # | |
| Serialize StreamName Source # | |
Defined in Database.Franz.Internal.Protocol | |
| Hashable StreamName Source # | |
Defined in Database.Franz.Internal.Protocol | |
Constructors
| Query | |
Fields
| |
Instances
| Show Query Source # | |
| Generic Query Source # | |
| Serialize Query Source # | |
| type Rep Query Source # | |
Defined in Database.Franz.Internal.Protocol type Rep Query = D1 ('MetaData "Query" "Database.Franz.Internal.Protocol" "franz-0.5-KxXJcuIWnOq5voPsLQF7IG" 'False) (C1 ('MetaCons "Query" 'PrefixI 'True) ((S1 ('MetaSel ('Just "reqStream") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 StreamName) :*: S1 ('MetaSel ('Just "reqFrom") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ItemRef)) :*: (S1 ('MetaSel ('Just "reqTo") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ItemRef) :*: S1 ('MetaSel ('Just "reqType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RequestType)))) | |
Instances
| Show ItemRef Source # | |
| Generic ItemRef Source # | |
| Serialize ItemRef Source # | |
| type Rep ItemRef Source # | |
Defined in Database.Franz.Internal.Protocol type Rep ItemRef = D1 ('MetaData "ItemRef" "Database.Franz.Internal.Protocol" "franz-0.5-KxXJcuIWnOq5voPsLQF7IG" 'False) (C1 ('MetaCons "BySeqNum" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :+: C1 ('MetaCons "ByIndex" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 IndexName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))) | |
data RequestType Source #
Instances
| Show RequestType Source # | |
Defined in Database.Franz.Internal.Protocol Methods showsPrec :: Int -> RequestType -> ShowS # show :: RequestType -> String # showList :: [RequestType] -> ShowS # | |
| Generic RequestType Source # | |
Defined in Database.Franz.Internal.Protocol Associated Types type Rep RequestType :: Type -> Type # | |
| Serialize RequestType Source # | |
Defined in Database.Franz.Internal.Protocol | |
| type Rep RequestType Source # | |
Defined in Database.Franz.Internal.Protocol | |
defQuery :: StreamName -> Query Source #
type Response = Either Contents (STM Contents) Source #
When it is Right, it might block until the content arrives.
Arguments
| :: Connection | |
| -> Query | |
| -> (STM Response -> IO r) | Wait for the response in a blocking manner. You should only run
the continuation inside a |
| -> IO r |
Fetch requested data from the server.
Termination of fetch continuation cancels the request, allowing
flexible control of its lifetime.
Send a single query and wait for the result.
data FranzException Source #
Constructors
| MalformedRequest !String | |
| StreamNotFound !FilePath | |
| IndexNotFound !IndexName ![IndexName] | |
| InternalError !String | |
| ClientError !String |