| Maintainer | Toshio Ito <debug.ito@gmail.com> |
|---|---|
| Safe Haskell | None |
| Language | Haskell2010 |
Network.Greskell.WebSocket.Client
Description
Synopsis
- connect :: Host -> Port -> IO Client
- connectWith :: Options -> Host -> Port -> IO Client
- close :: Client -> IO ()
- data Client
- type Host = String
- type Port = Int
- module Network.Greskell.WebSocket.Client.Options
- submit :: (ToGreskell g, r ~ GreskellReturn g, AsIterator r, v ~ IteratorItem r, FromGraphSON v) => Client -> g -> Maybe Object -> IO (ResultHandle v)
- submitPair :: (ToGreskell g, r ~ GreskellReturn g, AsIterator r, v ~ IteratorItem r, FromGraphSON v) => Client -> (g, Object) -> IO (ResultHandle v)
- submitRaw :: Client -> Text -> Maybe Object -> IO (ResultHandle GValue)
- data ResultHandle v
- nextResult :: ResultHandle v -> IO (Maybe v)
- nextResultSTM :: ResultHandle v -> STM (Maybe v)
- slurpResults :: ResultHandle v -> IO (Vector v)
- drainResults :: ResultHandle v -> IO ()
- data SubmitException
Make a Client
close :: Client -> IO () Source #
Close the connection to the server and release other resources of
the Client.
A client that establishes a connection to the Gremlin Server. You
can send Gremlin expression for evaluation by submit function.
Options for Client
Submit evaluation requests
Arguments
| :: (ToGreskell g, r ~ GreskellReturn g, AsIterator r, v ~ IteratorItem r, FromGraphSON v) | |
| => Client | |
| -> g | Gremlin script |
| -> Maybe Object | bindings |
| -> IO (ResultHandle v) |
Submit a Gremlin script to the server. You can get its results by
ResultHandle. The result type v is determined by the script
type g.
Usually this function does not throw any exception. Exceptions
about sending requests are reported when you operate on
ResultHandle.
submitPair :: (ToGreskell g, r ~ GreskellReturn g, AsIterator r, v ~ IteratorItem r, FromGraphSON v) => Client -> (g, Object) -> IO (ResultHandle v) Source #
Submit a pair of Gremlin script and variable binding. It's just a
simple wrapper around submit.
Since: 0.1.2.0
Less type-safe version of submit.
data ResultHandle v Source #
A handle to receive the result of evaluation of a Gremlin script from the server.
nextResult :: ResultHandle v -> IO (Maybe v) Source #
Get the next value from the ResultHandle. If you have got all
values, it returns Nothing. This function may block for a new
response to come.
On error, it may throw all sorts of exceptions including
SubmitException and RequestException. For example, if the
submitted Gremlin script throws an exception, nextResult throws
ResponseError with ResponseCode of ScriptEvaluationError.
nextResultSTM :: ResultHandle v -> STM (Maybe v) Source #
STM version of nextResult.
slurpResults :: ResultHandle v -> IO (Vector v) Source #
Get all remaining results from ResultHandle.
drainResults :: ResultHandle v -> IO () Source #
Similar to slurpResults, but this function discards the
results. Useful to execute a script whose side-effect is the only
thing you care.
Since: 0.1.1.0
Exceptions
data SubmitException Source #
Exception about submit operation and getting its result.
Constructors
| ResponseError (ResponseMessage GValue) | The server returns a |
| ParseError (ResponseMessage GValue) String | The client fails to parse the "data" field of the
|
Instances
| Show SubmitException Source # | |
Defined in Network.Greskell.WebSocket.Client.Impl Methods showsPrec :: Int -> SubmitException -> ShowS # show :: SubmitException -> String # showList :: [SubmitException] -> ShowS # | |
| Exception SubmitException Source # | |
Defined in Network.Greskell.WebSocket.Client.Impl Methods toException :: SubmitException -> SomeException # | |