| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Core.Listen.Driver
Description
A ListenConn and an interruptible connect over any libpq-shaped driver.
This is the API for backend authors.
Synopsis
- data ConnectDriver conn = ConnectDriver {
- connectStart :: ByteString -> IO conn
- connectPoll :: conn -> IO Polling
- connectStatus :: conn -> IO ConnStatus
- connectFinish :: conn -> IO ()
- connectErrorMessage :: conn -> IO (Maybe ByteString)
- data ConnStatus
- = ConnOk
- | ConnBad
- | ConnPending
- data Polling
- execOutcome :: (Eq status, Show status) => status -> (result -> IO status) -> Maybe result -> IO (Either Text ())
- withDriverListenConn :: ConnectDriver conn -> (conn -> ListenConn) -> ByteString -> (ListenConn -> IO a) -> IO a
Documentation
data ConnectDriver connSource #
The driver calls that open, inspect and close a connection.
Constructors
| ConnectDriver | |
Fields
| |
data ConnStatusSource #
Where an asynchronous connect stands.
Constructors
| ConnOk | The connection is open. |
| ConnBad | The connect failed. |
| ConnPending | The connect is still in progress. |
Instances
| Eq ConnStatus Source # | |
Defined in Arbiter.Core.Listen.Driver | |
| Show ConnStatus Source # | |
Defined in Arbiter.Core.Listen.Driver Methods showsPrec :: Int -> ConnStatus -> ShowS# show :: ConnStatus -> String# showList :: [ConnStatus] -> ShowS# | |
Wait target from a connection poll.
Constructors
| PollReading | Wait until the socket is readable. |
| PollWriting | Wait until the socket is writable. |
| PollDone | The connect has finished. |
Instances
execOutcome :: (Eq status, Show status) => status -> (result -> IO status) -> Maybe result -> IO (Either Text ())Source #
Check command status against the driver's success status. A missing result is Left.
withDriverListenConn :: ConnectDriver conn -> (conn -> ListenConn) -> ByteString -> (ListenConn -> IO a) -> IO aSource #
Run an action on a connection of its own, opened from a connection string.