The shared in-memory key-value store, a single GenServer backing every
endpoint.
It holds two independent keyspaces so both the bucketed and bucketless protocols can share one process:
- a bucketed space —
put/3,4,get/2,delete/2take(bucket, key)(andkeys/1takes just(bucket)) and are used byFakeRiak.Riak; - a bucketless space —
put/2,get/1,delete/1take just(key)and are used byFakeRiak.Redis,FakeRiak.EtcdandFakeRiak.Memcached.
The bucketed space models Riak's siblings: each key holds a list of
values, so get/2 replies {:ok, values} with a non-empty list. put/4
takes a merge mode — :append adds the value as a new sibling (byte-identical
values are deduplicated, as real Riak does), while :replace collapses the
key to a single value, the way resolving with a vector clock does. put/3
defaults to :replace. The bucketless space stays strictly last-write-wins:
its get/1 replies {:ok, value} with a single value.
In both spaces get replies {:error, reason} when absent, and
put/delete reply :ok (with delete returning {:error, reason} when
the key is absent). The public functions run in the caller's connection
process, so when --verbose is set they log each operation, attributed to
that connection's protocol.
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.init/1.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Callback implementation for GenServer.init/1.