mediachain / concat

Mediachain daemons
MIT License
42 stars 13 forks source link

Remote Query Protocol #28

Closed vyzo closed 7 years ago

vyzo commented 7 years ago

Implements the remote query protocol, with associated REST api endpoint. Closes #22

Notes:

Example:

$ curl http://127.0.0.1:9004/id
Qme1ypbSE8vvuSSeZ5YWTRDDbULUjuTeNJ6QCyijxdmaJt
$ curl -H "Content-Type: application/text" -d 'SELECT COUNT(id) FROM *' http://127.0.0.1:9004/query
0
$ curl -H "Content-Type: application/text" -d 'SELECT COUNT(id) FROM *' http://127.0.0.1:9004/query/QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK
1000
$ curl -H "Content-Type: application/text" -d 'SELECT * FROM * LIMIT 5' http://127.0.0.1:9004/query/QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK
{"id":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1475492974:0","publisher":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK","namespace":"a.b.c","body":{"Body":{"Simple":{"object":"QmABC","refs":["abc"],"tags":["test"]}}},"timestamp":1475492974}
{"id":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1475492974:1","publisher":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK","namespace":"a.b.c","body":{"Body":{"Simple":{"object":"QmABC","refs":["abc"],"tags":["test"]}}},"timestamp":1475492974}
{"id":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1475492974:2","publisher":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK","namespace":"a.b.c","body":{"Body":{"Simple":{"object":"QmABC","refs":["abc"],"tags":["test"]}}},"timestamp":1475492974}
{"id":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1475492974:3","publisher":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK","namespace":"a.b.c","body":{"Body":{"Simple":{"object":"QmABC","refs":["abc"],"tags":["test"]}}},"timestamp":1475492974}
{"id":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1475492974:4","publisher":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK","namespace":"a.b.c","body":{"Body":{"Simple":{"object":"QmABC","refs":["abc"],"tags":["test"]}}},"timestamp":1475492974}
parkan commented 7 years ago

I think we can draw upon our previous in-stream error propagation (in gRPC) to make this make sense; let's wait for @yusefnapora's opinion on how we want to package them.

Can prob merge this in the meantime tho