Closed pietgeursen closed 5 years ago
Awesome work, @pietgeursen! Tested it out, and it works.
I'll have to dig into the code more later (and see about removing those hardcoded strings); but for now this works at least as well as anything else in the repo, so it's good enough for me :)
:tada: World's first rusty replication :tada:
About
In short, this PR should let you try out:
createHistoryStream
for the js feed and see the js reply in the console.Setup
We want to force the js server to always request the feed of the rust bot.
node_modules/ssb-replicate
folder, editlegacy.js
, line 351 to look like:We want to switch off
ebt
as well.bin.js
in the top level ofssb-server
and comment out line 61 eg.Make a secret file for the rust code to use that is different from the js-bot.
One other important caveat
The path to the offset file and sqlite file are hard coded to be
/tmp/ssb-db.offset
and/tmp/ssb-db.sqlite3
in thehandleReplicationRequests
command. That means you must use those same paths for the other commands.I need to hard code them otherwise we get borrow checker errors because of the async lambda function around line 365.
Let's do it!
Publish our message:
and you should see something like:
Get the js ssb-server to replicate us:
With the modded ssb-server running.
You should see:
Now on the js side, go
createHistoryStream
for the rust feed id. You should see your rusty message :1st_place_medal:Post a reply to it:
Get the js feed into rust:
You should see:
And now to see the reply from js:
And you should see:
Fast replication
Also for fun, try replicating a big feed. The validation / verification / appending is all batched to it's super fast!
Noisy diff
OMG, the diff is super noisy, sorry, I always run
cargo fmt
before I push.cc @ahdinosaur @AljoschaMeyer @mmckegg