alldata-peer-server-http
Stability: 1 - Experimental
Peer Server HTTP module for AllData, a distributed master-less write-once immutable event store database implementing "All Data" part of Lambda Architecture.
Usage
var AllDataPeerServer = ;var allDataPeerServer = hostname: 'localhost' port: 8080; allDataPeerServer; allDataPeerServer;
Test
npm test
Overview
AllDataPeerServer will listen to HTTP POST
requests containing the _put
request key and event encoded as a JSON string in the POST body.
Documentation
AllDataServer
Public API
- AllDataPeerServer.listen(options, [callback])
- new AllDataPeerServer(options)
- allDataPeerServer.close([callback])
- allDataPeerServer.listen([callback])
- Event '_put'
AllDataPeerServer.listen(options, [callback])
options
: Seenew AllDataPeerServer(options)
options
.callback
: SeeallDataPeerServer.listen(callback)
callback
.- Return: Object An instance of AllDataPeerServer with server running.
Creates new AllDataPeerServer and starts the server.
new AllDataPeerServer(options)
options
: Objecthostname
: String (Default: undefined) Hostname for the server to listen on. If not specified, the server will accept connections directed to any IPv4 address (INADDR_ANY
).port
: Integer (Default: 8080) Port number for the server to listen on.
Creates a new AllDataPeerServer instance.
allDataPeerServer.close([callback])
callback
: Function (Default: undefined)function () {}
Optional callback to call once the server is stopped.
Stops the server from accepting new connections.
allDataPeerServer.listen([callback])
callback
: Function (Default: undefined)function () {}
Optional callback to call once the server is up.
Starts the server to listen to new connections.
_put
Event function (key, event, callback) {}
key
: String AllData key generated for theevent
.event
: Object JavaScript object representation of the event to_put
.callback
: Functionfunction (error) {}
The callback to call with an error or success of the_put
operation.
Emitted when the server receives a new _put
request from a peer client.
Signal error via callback(true)
and success via callback()
.
allDataPeerServer;