order your record & sub and push message
TODO
docker pull qyvlik/orderdb
docker run -d \
--name myorderdb \
-v /home/www/orderdb:/home/www/orderdb \
-p 17711:17711 \
qyvlik/orderdb --orderdb.disk.directory=/home/www/orderdb
{
"id": 10001,
"method": "append",
"params":["test", "action-1000", {}]
}
scope
: scope of your datakey
: unique key of datadata
: the data, json format
{
"id": 10001,
"method": "append",
"result": 1
}
result
: the index of thekey
{
"id": 10001,
"method": "delete.by.index",
"params":["test", 1000]
}
scope
: scope of your dataindex
: index of data
{
"id": 10001,
"method": "append",
"result": "success"
}
result
: success or failure
{
"id": 10001,
"method": "delete.by.key",
"params":["test", "action-1000"]
}
scope
: scope of your datakey
: key of data
{
"id": 10001,
"method": "append",
"result": "success"
}
result
: success or failure
{
"id": 10001,
"method": "append.list",
"params":["test", true, [{"scope":"test", "key":"key1"},{"scope":"test", "key":"key2"}]]
}
scope
: scope of your dataignoreExist
: ignore if the key is exist, or throw a exceptionlist
: data of list
{
"id": 10001,
"method": "append",
"result": [
{
"scope": "test",
"key": "key1",
"index": 1
},
{
"scope": "test",
"key": "key2",
"index": 2
}
]
}
result
: the index of thekey
{
"id": 10001,
"method": "get.by.index",
"params":["test", 1]
}
scope
: scope of your dataindex
: index of data
response:
{
"id": 10001,
"method": "get.by.index",
"result":{
"scope": "test",
"key": "action-1000",
"index": 1,
"data":{}
}
}
key
: the unique keyindex
: index numberdata
: data
{
"id": 10001,
"method": "get.by.key",
"params":["test", "action-1000"]
}
scope
: scope of your datakey
: unique key of data
response:
{
"id": 10001,
"method": "get.by.key",
"result":{
"scope": "test",
"key": "action-1000",
"index": 1,
"data":{}
}
}
key
: the unique keyindex
: index numberdata
: data
{
"id": 10001,
"method": "get.latest.index",
"params": ["test"]
}
scope
: scope of your data
response
{
"id": 10001,
"method": "get.latest.index",
"result": 1
}
return the latest index number.
{
"id": 10001,
"method": "get.list",
"params": ["test", 1, 2]
}
scope
: scope of your datafrom
: index which is startto
: index which is end
response
{
"id": 10001,
"method": "get.by.key",
"result":[
{
"scope": "test",
"key": "action-1000",
"index": 1,
"data":{}
},
{
"scope": "test",
"key": "action-1001",
"index": 2,
"data":{}
}
]
}
{
"channel": "sub.append",
"subscribe": true,
"params": ["test"]
}
scope
: which scope you want subscribe.
if you subscribe success, response as follow
{
"channel": "sub.append",
"result": "subscribe"
}
when some one call append
for order some data, will receive the data as follow
{
"channel": "sub.append",
"result": {
"scope": "test",
"key": "action-1001",
"index": 2,
"data":{}
}
}
{
"channel": "sub.delete",
"subscribe": true,
"params": ["test"]
}
scope
: which scope you want subscribe.
if you subscribe success, response as follow
{
"channel": "sub.delete",
"result": "subscribe"
}
when some one call `delete some data, will receive the data as follow
{
"channel": "sub.delete",
"result": {
"scope": "test",
"key": "action-1001",
"index": 2,
"data":{}
}
}