GithubHelp home page GithubHelp logo

Comments (5)

hackergrrl avatar hackergrrl commented on May 28, 2024

Possible edge case: I connect to a cabal, read some backlog, then leave. I return the next day, still not having posted anything yet, and now nobody will ever replicate my feed again (because it's size=0).

from cabal-core.

hackergrrl avatar hackergrrl commented on May 28, 2024

cc @telamon

from cabal-core.

telamon avatar telamon commented on May 28, 2024

@noffle yes, that pretty much sums it up, if you're a lurker then you won't unnecessarily tax the network you'll just act as another seed,
And if a user writes a message his feed will no longer be empty and thus it will no longer be filtered.

from cabal-core.

hackergrrl avatar hackergrrl commented on May 28, 2024

from cabal-core.

telamon avatar telamon commented on May 28, 2024

@noffle The peer shouldn't be filtered, only zero length feeds would be rejected. So a user with a zero-length writer should behave like --seed mode until he appends an entry.

I'm thinking of letting other peers know there's a new feed that is qualified for replication the same way that the active feed forwarding works.

When an peer with established connections suddenly becomes aware of a new feed the _onFeedReplicated handler is invoked that forwards the feed to all other connected peers that dosen't have it yet.

So the same needs to be done on the peer that has a zero-length writer when the first entry is written.
Maybe cabal could invoke the above _onFeedReplicated() or startConversation() method which should reannounce previously filtered feeds.

But anyway, at the moment of writing, in order to manually notify connected peers that your writer is no-longer empty we could do the following:

const writer = multi.feed('local')
writer.on('append', () => {
  if (writer.length === 1) {
    multi.replicationManager.connections.forEach(conn => {
      multi.replicationManager._onFeedReplicated(conn, writer.key)
    })
  }
})

I'm adding to my TODO to expose an manager#advertise(key) method to wrap up the above loop in a nicer package.

Did i manage to answer the question?

from cabal-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.