https://github.com/sakshamsharma/gossip-haskell
A simple library implementing a gossip network, in Haskell.
https://github.com/sakshamsharma/gossip-haskell
distributed-systems gossip-protocol haskell networks
Last synced: 7 months ago
JSON representation
A simple library implementing a gossip network, in Haskell.
- Host: GitHub
- URL: https://github.com/sakshamsharma/gossip-haskell
- Owner: sakshamsharma
- License: bsd-3-clause
- Created: 2018-02-18T15:09:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-17T15:14:29.000Z (over 7 years ago)
- Last Synced: 2025-01-15T12:24:24.425Z (9 months ago)
- Topics: distributed-systems, gossip-protocol, haskell, networks
- Language: Haskell
- Size: 18.6 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# gossip-haskell
This implements a very simple gossip protocol over an [Abstract Network](https://github.com/sakshamsharma/abstract-network). This should make developing distributed applications very easy, since it abstracts away all communication / peer-list / keep-alive / discovery-of-peers logics.
It will also not forward messages which have already been forwarded in the past (timestamping would be a good idea if you want to re-send a message).
## Important API
### createGossiper
You can create a Gossip Context as follows:
```
createGossiper :: UserNetContext IO -> [NetAddr] -> String -> (B.ByteString -> IO ()) ->
IO GossipContext
```Arguments:
* A user network context (from [abstract-network](https://github.com/sakshamsharma/abstract-network)).
* A list of addresses of seed / bootstrap peers.
* An action to run on receiving an application message (this will not be called when keep-alive/discovery etc messages are received).This GossipContext will be used for communication on the set-up network.
### doGossip
This action will send the input bytes over the whole network.
```
doGossip :: GossipContext -> B.ByteString -> IO ()
```Arguments:
* GossipContext / Gossip Network, over which the message has to be sent.
* The bytes to be sent over the network.## TODO
The project is functional, but some important functionality is missing.* PeerSet does not send pings yet. A process must be launched which does this.
* PeerSet does not yet run a process to purge peers which have not responded in a while.
* PeerSet does not allow configuration of parameters yet.
* Peer Discovery messages are not being sent yet.
* We should allow configuring a predicate, which chooses whether a message needs to be forwarded. For example, some stale messages could be discarded.