mediachain / concat

Mediachain daemons
MIT License
42 stars 13 forks source link

Step 1: Persistent nodes and simple statement publication #8

Closed vyzo closed 7 years ago

vyzo commented 7 years ago

Moving forward to a basic functional prototype:

Statements are peristed to disk with a file per statement and content marshalled in protobuf.

A simple example illustrating publication and retrieval of statements:

shell0 $ mcdir
2016/09/14 12:04:02 Loading identity from /tmp/mcdir/identity
2016/09/14 12:04:02 ID: QmZkHSwRd29Eq3XcfUVt3AzGNXUtgjf6eGqdSk56EXZtBb
2016/09/14 12:04:02 I am /ip4/127.0.0.1/tcp/9000/QmZkHSwRd29Eq3XcfUVt3AzGNXUtgjf6eGqdSk56EXZtBb
...

shell1 $ mcnode /ip4/127.0.0.1/tcp/9000/QmZkHSwRd29Eq3XcfUVt3AzGNXUtgjf6eGqdSk56EXZtBb
2016/09/14 13:18:56 Loading identity from /tmp/mcnode/identity
2016/09/14 13:18:56 ID: QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK
2016/09/14 13:18:56 I am /ip4/127.0.0.1/tcp/9001/QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK
2016/09/14 13:18:56 Serving client interface at 127.0.0.1:9002
2016/09/14 13:18:56 Registering with directory
...
shell2 $ curl -H "Content-Type: application/json" -d '{"object": "QmABC", "refs": ["abc"], "tags": ["test"]}' http://127.0.0.1:9002/publish/foo.bar
QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1473848347:0
$ ls /tmp/mcnode/stmt/
QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1473848347:0
$ curl http://127.0.0.1:9002/stmt/QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1473848347:0
{"id":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK:1473848347:0","publisher":"QmWwnVop4hHB3K6z2vuUgU9rh5VrDwMnwuiP9LZew7NzUK","namespace":"foo.bar","Body":{"Simple":{"object":"QmABC","refs":["abc"],"tags":["test"]}}}
parkan commented 7 years ago

Overall this looks good to me, let's merge? We're gonna have @bigs come in next week to do more detailed code review (he's familiar with Go) but for now let's move forward