In-memory Key-Value store.
GET http://localhost:3003/luppolo/dbs?{action}
Description | action |
---|---|
Get list of databases | |
Exports all the DBs data as JSON | _export |
Save all the DBs data on the file system | _persist |
Restore all the DBs data from the file system | _restore |
Delete all the DBs from the memory and from the file system | _deleteAndPersist |
//[GET] "http://localhost:3003/luppolo/dbs"
{
"result": "found",
"db": "_all",
"names": [
"db1"
],
"total": 1
}
//[GET] "http://localhost:3003/luppolo/dbs?_export"
{
"result": "found",
"db": "_all",
"value": {
"db1": {
"1": {
"value": {
"boolean": true,
"number": 123,
"string": "text",
"array": [
"123",
"456"
]
},
"lastUpdate": "2018-07-14T09:01:01.748Z"
}
}
}
}
//[GET] "http://localhost:3003/luppolo/dbs?_persist"
{
"result": "saved",
"db": "_all"
}
on Error
{
"result": "error",
"db": "_all",
"error": {
"errno": -4048,
"code": "EPERM",
"syscall": "open",
"path": "/luppolo-db/dump/dbs.json"
}
}
//[GET] "http://localhost:3003/luppolo/dbs?_restore"
{
"result": "restored",
"db": "_all"
}
on Error
{
"result": "error",
"db": "_all",
"error": {
"errno": -4058,
"code": "ENOENT",
"syscall": "open",
"path": "/luppolo-db/dump/dbs.json"
}
}
//[GET] "http://localhost:3003/luppolo/dbs?_deleteAndPersist"
{
"result": "deleted",
"db": "_all"
}
on Error
{
"result": "error",
"db": "_all",
"error": {
"errno": -4048,
"code": "EPERM",
"syscall": "open",
"path": "/luppolo-db/dump/dbs.json"
}
}
Store or update a value in storage.
PUT http://localhost:3003/luppolo/db/db1/1
Body:
{
"boolean": true,
"number": 123,
"string": "text",
"array": [
"123",
"456"
]
}
Result:
{
"result": "created",
"db": "db1",
"key": "1"
}
or
{
"result": "updated",
"db": "db1",
"key": "1"
}
Retrieve a value from storage.
GET http://localhost:3003/luppolo/db/db1/1
Result:
{
"result": "found",
"db": "db1",
"key": "1",
"value": {
"boolean": true,
"number": 123,
"string": "text",
"array": [
"123",
"456"
]
},
"lastUpdate": "2017-12-23T23:52:11.445Z"
}
or
{
"result": "unknown",
"db": "db1",
"key": "1"
}
Removes a DB from storage.
DELETE http://localhost:3003/luppolo/db/db1
Result:
{
"result": "deleted",
"db": "db1"
}
or
{
"result": "unknown",
"db": "db1"
}
Removes a value from storage.
DELETE http://localhost:3003/luppolo/db/db1/1
Result:
{
"result": "deleted",
"db": "db1",
"key": "1",
"value": {
"boolean": true,
"number": 123,
"string": "text",
"array": [
"123",
"456"
]
},
"lastUpdate": "2017-12-23T23:56:38.310Z"
}
or
{
"result": "unknown",
"db": "db1",
"key": "1"
}
Retrieve a DB keys from storage.
GET http://localhost:3003/luppolo/db/db1
Result:
{
"result": "found",
"db": "db1",
"keys": [
"1"
],
"total": 1
}
or
{
"result": "unknown",
"db": "db1",
"total": 0,
"keys": []
}
GET http://localhost:3003/luppolo/db/db1?_count
Result:
{
"result": "found",
"db": "db1",
"total": 1
}
or
{
"result": "unknown",
"db": "db1",
"total": 0
}
It allows to search in the selected DB using jsonpath.
POST http://localhost:3003/luppolo/db/db1/_search
Body:
{
"jpath" : "$..array"
}
Result:
{
"result": "found",
"db": "db1",
"hits": [
[
"123",
"456"
]
],
"total": 1
}
It allows to search in the selected DB using jsonpath, returning path and value of the nodes found.
POST http://localhost:3003/luppolo/db/db1/_search
Body:
{
"jpath-nodes" : "$..array[?(@>200)]"
}
Result:
{
"result": "found",
"db": "db1",
"hits": [
{
"path": ["$", "1", "value", "array", 1],
"value": "456"
}
],
"total": 1
}
Increments or decrement the number stored at key by incNumber.
PUT http://localhost:3003/luppolo/db/db1/1/_increment
PUT http://localhost:3003/luppolo/db/db1/1/_increment/100
PUT http://localhost:3003/luppolo/db/db1/1/_increment/-10
/{db}/{key}/_increment/{incNumber?}
Param | Description | Default |
---|---|---|
db | DB name | |
key | Key | |
incNumber | Increment number | +1 |
Result:
{
"result": "created",
"db": "db1",
"key": "1",
"value": 1
}
or
{
"result": "updated",
"db": "db1",
"key": "1",
"value": 2
}
or
{
"result": "error",
"db": "db1",
"key": "1",
"value": {
"boolean": true,
"number": 123,
"string": "text",
"array": [
"123",
"456"
]
},
"message": "value is NaN."
}
or
{
"result": "error",
"db": "db1",
"key": "1",
"value": 8,
"message": "incNumber is NaN."
}