Module: server

The Rodney for Gabbo external request server.
Source:

Requires

Methods

(inner) handleRequest(data, st, socket) → {boolean}

Handle an incoming request. A single message may span multiple requests, and the first request for a message will include size/checksum headers in addition to the message being sent. The existing message state is maintained by the calling scope and must be passed as a paramter.
Parameters:
Name Type Description
data object the Buffer containing incoming data
st object processing state of current request
socket object the server socket for sending responses
Source:
Returns:
true if message was completed, false to keep going
Type
boolean

(inner) resetState(state)

Reset the current request state to its starting values. This state object will read the headers in the first request object, then append subsequent requests to a message buffer until the entire request has been received. At that time the message will be passed off to handleRequest and the request state should be reset.
Parameters:
Name Type Description
state object processing state of current request
Properties
Name Type Description
buffer object the Buffer containing partial message received so far
cursor number the current position in the message
size number the total size of the message
checksum string the md5 checksum of the message
Source:

(inner) runQuery(query, onFulfilled, onRjected) → {boolean}

Execute the specified query with onFulfilled and onRejected callbacks.
Parameters:
Name Type Description
query string the query to run
onFulfilled function called with result if query is successful
onRjected function called with error if query fails
Source:
Returns:
true for valid query string, false otherwise
Type
boolean

(inner) sendResponse(socket, transactionId, data)

Serialize data to JSON and send to client over socket.
Parameters:
Name Type Description
socket object the socket to send the response over
transactionId string the transactionId for this response
data object the data to serialize and send
Source:

(inner) startServer() → {object}

Start up the Rodney for Gabbo server.
Source:
Returns:
the newly started server instance
Type
object