FakeRiak.Riak (fake_riak v0.3.0)

Copy Markdown View Source

Fake Riak KV endpoint speaking both of Riak's client APIs on the same port: the HTTP API and the Protocol Buffers (PBC) API.

Like real Riak's PBC port, framing starts with a 4-byte big-endian length — so the first byte a PBC client sends is always 0x00, while an HTTP request starts with an ASCII method. Each connection is dispatched on that first byte and then stays in its protocol for its lifetime; there is no need for a separate PBC port (though --riak can be repeated to also listen on Riak's conventional 8087). PBC messages are handled by FakeRiak.RiakPBC, including the RpbStartTls in-band TLS upgrade.

Being bucketed, it maps directly onto the bucketed side of FakeRiak.SimpleStore, shared by both APIs. Supported HTTP routes (both the modern and legacy forms):

GET|PUT|POST|DELETE  /buckets/:bucket/keys/:key
GET|PUT|POST|DELETE  /riak/:bucket/:key
GET                  /ping

Object values are stored as the raw request body. Siblings live in the shared store (see FakeRiak.RiakPBC), but the HTTP API has no multipart sibling representation, so a PUT replaces and a GET serves the most recent value. Vector clocks and 2i are not implemented on the HTTP side.