Stream Cluster

Write a consistent ESDB stream to a cluster of machines. We use the raft protocol for writes, reads are from the local node's log, so it's possible they may be stale.

To start a cluster:

    go run cmd/esdb-node.go -p 4001 tmp/1
    go run cmd/esdb-node.go -p 4002 -join localhost:4001 tmp/2
    go run cmd/esdb-node.go -p 4003 -join localhost:4001 tmp/3

To add events (can be called on any running node):

    curl -XPOST -i localhost:4001/events -d "{\"body\":\"ab\",\"indexes\":{\"a\":\"b\"}}"
    curl -XPOST -i localhost:4001/events -d "{\"body\":\"ac\",\"indexes\":{\"a\":\"c\"}}"

To iterate through all events (will return "ab" and "ac"):

    curl localhost:4001/events?limit=20

To scan an index (will return just "ab"):

    curl localhost:4001/events?index=a&value=b&limit=20