ssbc / ssb-replication-scheduler Goto Github PK
View Code? Open in Web Editor NEWPlugin to trigger replication of feeds identified as friendly in the social graph
Plugin to trigger replication of feeds identified as friendly in the social graph
I had an idea of implementing sympathetic replication like this:
partialReplication: {
0: [
{ purpose: 'main' },
{ purpose: 'git-ssb' },
{ purpose: 'index' }
],
1: [
{ purpose: 'main' },
{ purpose: 'git-ssb', $certainty: 50 },
],
Note $certainty: 50
, this means that with 50% probability I will replicate a friend's git-ssb
feed. This wouldn't be random, because we need every sbot session to always replicate the same "lucky" friend git-ssb feed, so determinism.
I thought that one way to achieve determinism is to pluck the first nibble of the friend's subfeed, and replicate that subfeed only if it belongs to my set of "chosen lucky nibble". With 50%, suppose that my deterministic lucky nibbles are: 0, 2, 4, 6, 8, a, c, e. If I had chosen 100% certainty, then the lucky nibbles would be all the 16 possible: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f. The lucky nibbles can be selected "randomly" too.
I don't know if this is too complicated, maybe there is a simpler and easier way of deterministically choosing whether a friend's subfeed is "lucky" given my certainty parameter, but my point is that sympathetic replication overall seems like it could be achieved with this simple $certainty
value.
Thoughts @arj03 ?
When adding a lot of messages for a feed, right now you might get a follow and a unfollow or block right after. Would be good if these were debounced a bit so that ebt doesn't start requesting these messages.
Seems like we should treat the else
case here:
ssb-replication-scheduler/req-manager.js
Lines 275 to 277 in 8550b7e
Say I follow both Alice and Bob, but Alice blocks Bob.
It's currently a feature in ssb-replication-scheduler that we won't forward Alice's (main) feed to Bob, and it's implemented here:
ssb-replication-scheduler/index.js
Line 49 in 6a01b2f
But that's only for main feeds. Bob is still capable of replicating Alice's metafeed tree.
We should support preventing Bob from getting Alice's metafeed tree (any of Alice's feeds).
But there is an exception to this: Bob can always get Alice's group leaf feed (and the whole branch above that) if both Alice and Bob are in the same group.
ssb-replication-scheduler/test/integration/groups.js
Lines 617 to 618 in 8550b7e
When i change this to carol.db.get
, which seems to be intended, I get an error
โ 20) Error: Msg %BYhQdJTDN52qRn8Rh1RJYa5icwgMnWmjPQxxjalxZns=.sha256 not found in leveldb index
Expected error to be falsy
At: async Test.<anonymous> (/test/integration/groups.js:607:18)
I was having trouble with (partial?) replication, and things started to work once I installed ssb-subset-rpc, but that's not mentioned in the readme here.
my setup before the fix
module.exports = function startSbot() {
const stack = SecretStack({ caps: { shs } })
.use(require("ssb-db2/core"))
.use(require("ssb-classic"))
.use(require("ssb-bendy-butt"))
.use(require("ssb-meta-feeds"))
.use(require("ssb-box2"))
.use(require("ssb-db2/compat/feedstate"))
.use(require("ssb-db2/compat/ebt"))
.use(require("ssb-db2/compat/db")) // for legacy replicate
.use(require("ssb-db2/compat/history-stream")) // for legacy replicate
.use(require("ssb-friends"))
.use(require("ssb-ebt"))
.use(require("ssb-tribes2"))
.use(require("ssb-lan"))
//.use(require("ssb-subset-rpc")) // this (uncommented) is all i added to fix it
.use(require("ssb-replication-scheduler"));
const sbot = stack({
path: dir,
keys,
ebt: {
// logging: true,
},
db2: {
flushDebounce: 10,
writeTimeout: 10,
},
tribes2: {
// timeoutLow: opts.timeoutLow,
// timeoutHigh: opts.timeoutHigh,
},
friends: {
hops: 1,
},
replicationScheduler: {
//debouncePeriod: 1,
partialReplication: {
0: [{}],
1: [{ purpose: "main" }, { purpose: "group/additions" }],
group: [{ purpose: "$groupSecret" }],
},
},
});
sbot.name = "demo";
sbot.ebt.registerFormat(bendyButtFormat);
return sbot;
};
(Poor title for this issue, and I'm not sure which repo to put this in, but this repo seems to be the highest level)
Consider what happens to messages in the log (avoid duplicates, avoid ssb-ebt replication bugs and incorrect state) when:
metafeed/announce
msg (from the main feed) via ssb-subset-rpc but after that replicated the full main
feed for that peercc @arj03 FYI
state
(base.getLatest() is not that, it does a leveldb read)state
exists for that feed, and this must improve benchmarksA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.