npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gossip-query

v2.0.2

Published

flooding gossip search for p2p.

Downloads

87

Readme

gossip-query

flooding gossip search for p2p.

pseudocode

something is requested (either by local user, or a peer)
check for it locally (async),
  if you have it
    respond to peers who requested it
  else
    ask other peers
    if a peer responds
      check it's correct
      then respond to any peers who requested it

note: "peers who requested" can be the local user or a remote peer. if a second request is made for queries already in the system, the requestor is just added to the waiting callbacks, instead of starting that request over.

when two peers connect, they exchange a table of the things they are looking for. when a request is made on behave of a peer, a hops counter is incremented. That way, a who may be several steps on from the source can see how far it has come, and may choose to ignore distant requests.

protocol

requests are sent in the form of a JSON object, with the query string as the key {: || ,...}

the can be anything, it's just a way to identify that request.

more than one request/response can be broadcast in a single packet. normally, <hops> is a negative integer (but could be some other representation of the weighting of how important the request is, as long as it's distinct from any value of <response>) <response> can be any value, and in some cases it allows only one value, for example, in ssb-blobs the request is the blob hash, and the response is the size of the blob. in a search query, the request would be the query string, and the result is responses (which might be message ids or something like that)

for ssb-ooo (out of order messages), the response is just the message, and there can never be more than one result.

for protocols that can have multiple responses, a reduce function is supplied that combines those results.

data structure

the state of the protocol is represented as a {} object of the state of each request.

{<query>: <state>,...}

state holds information about what phase this query is in, this contains a list of peers (can include the local user) who have made a particular query, (and that the response will be transmitted to, once received) it contains the value received (if we have it)

requested values should be cached for some length of time, but eventually gc'd (maybe combining a count and a time limit)

i'm not completely clear on what the state object needs to look like it might need a map of which peers have requested and which peers have been sent data.

pull based

to make the protocol properly pullish (and respect back pressure) i think the right idea is that when a peer is ready for data, iterate over the state objects and check which have data for them, this way it can just wait as long as necessary if the peer doesn't want anything yet.

processing

the processing step, (after a response is received from a peer) is optional - but in the case of ssb-blobs would be used to request that blob from the peer.

License

MIT