A time-traveling, replicated, eventually-consistent key-value store.
Operations are currently NOT atomic! Writing to a key concurrently can and likely will cause issues. You have been warned!
Returns the key and its revisions. The returned value looks like:
[current_value, revisions]
where revisions
is a possibly-empty list.
If the key does not exist, an empty list is returned:
[]
revisions
: The number of revisions to return. Set toall
for all revisions. If this value is not specified, or is not a number or the literal string"all"
, an empty list of revisions will be returned.patch
: Whether or not to apply patches. By default, the returned revisions are a set of patches that can be used to revert to each previous state. Ifpatch
is set totrue
, the patches will be applied, and the computed values will be returned as the list of revisions. Defaults tofalse
.
Returns info about the given key.
// ▶ curl localhost:7654/test/info
{"key":"test","revision_count":11}
Sets the value at the given key. The request body is the value that is set. Returns the value that was set.
Deletes the key from the store. Returns the following JSON:
{
"status": "ok",
}
All of these routes take a :fork
parameter, like this:
GET /:key/:fork
PUT /:key/:fork
DELETE /:key/:fork
GET /:key/:fork/info
If you don't provide a fork, the default fork is used.
You can fork a key to operate on a copy of its data without affecting the original. Likewise, you can merge a fork into a target fork.
// On success
{
"status": "ok",
}
// On failure
{
"status": "error",
"error": "not_found",
}
Blindly merges the fork's data into the target. This is a destructive operation. You are on your own for rollbacks.
This overwrites the target fork with the provided fork! This does NOT do some sort of smart merge! The originating fork's value OVERWRITES the target fork's value directly, and has the relevant patch added to its history.
// On success
{
"status": "ok",
}
// On failure
{
"status": "error",
"error": "fork_not_found",
}
{
"status": "error",
"error": "target_not_found",
}