Packages

In-memory fake for Riak, etcd, Redis and memcached that speaks their wire protocols on TCP, so you can point real clients at it. Ships as an escript.

Current section

Files

Jump to
fake_riak lib fake_riak.ex
Raw

lib/fake_riak.ex

defmodule FakeRiak do
@moduledoc """
Top-level namespace for FakeRiak.
FakeRiak is an in-memory fake for several key-value services. A single store
(`FakeRiak.SimpleStore`) is fronted by four TCP endpoints that each speak a
real wire protocol, so unmodified clients can talk to it:
* `FakeRiak.Riak` — Riak KV HTTP + Protocol Buffers APIs (bucketed)
* `FakeRiak.Redis` — Redis RESP protocol (bucketless)
* `FakeRiak.Etcd` — etcd v2 HTTP/JSON API (bucketless)
* `FakeRiak.Memcached` — memcached text protocol (bucketless)
It is meant as a lightweight test double, not a faithful reimplementation of
any of those servers. The command-line entry point is `FakeRiak.CLI`, built
into a standalone executable with `mix escript.build`.
"""
@doc """
The version string, read at runtime from the application spec (which is
generated from `mix.exs`). The `:fake_riak` application must be loaded.
"""
@spec version() :: String.t()
def version do
:fake_riak |> Application.spec(:vsn) |> to_string()
end
end