greskell-websocket-0.1.2.4: Haskell client for Gremlin Server using WebSocket serializer

MaintainerToshio Ito <debug.ito@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Network.Greskell.WebSocket.Client

Contents

Description

 
Synopsis

Make a Client

connect :: Host -> Port -> IO Client Source #

Create a Client to a Gremlin Server, with the default Options.

connectWith :: Options -> Host -> Port -> IO Client Source #

Create a Client to a Gremlin Server.

close :: Client -> IO () Source #

Close the connection to the server and release other resources of the Client.

data Client Source #

A client that establishes a connection to the Gremlin Server. You can send Gremlin expression for evaluation by submit function.

type Host = String Source #

Host name or an IP address.

type Port = Int Source #

TCP port number.

Options for Client

Submit evaluation requests

submit Source #

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

submitRaw Source #

Arguments

:: Client 
-> Text

Gremlin script

-> Maybe Object

bindings

-> IO (ResultHandle GValue) 

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.

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 ResponseMessage with error ResponseCode.

ParseError (ResponseMessage GValue) String

The client fails to parse the "data" field of the ResponseMessage. The error message is kept in the String field.