https://github.com/libopenstorage/gossip
Go implementation of the Gossip protocol
https://github.com/libopenstorage/gossip
Last synced: about 1 year ago
JSON representation
Go implementation of the Gossip protocol
- Host: GitHub
- URL: https://github.com/libopenstorage/gossip
- Owner: libopenstorage
- License: apache-2.0
- Created: 2015-08-17T21:56:32.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-03-11T18:11:54.000Z (over 2 years ago)
- Last Synced: 2024-06-18T14:12:45.263Z (almost 2 years ago)
- Language: Go
- Size: 4.54 MB
- Stars: 125
- Watchers: 29
- Forks: 24
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gossip
[](https://travis-ci.org/libopenstorage/gossip)
[](https://codecov.io/gh/libopenstorage/gossip)
Go implementation of the Gossip protocol.
## Overview
This package provides an implementation of an eventually consistent in-memory
data store. The data store values are exchanged using a push-pull gossip protocol.
```
// Create a gossiper
g := NewGossiper(":", "", "")
// Add peer nodes with whom you want to gossip
g.AddNode(":")
...
// update self values
g.UpdateSelf("", "")
// start gossip
g.Start()
```
These values are exchanged using the gossip protocol between the configured
peers.
```
// Get the current view of the world
storeKeys = g.GetStoreKeys()
for _, key := range storeKeys.List {
nodeInfoMap := g.GetStoreKeyValue(key)
for id, nodeInfo := nodeInfoList.List {
// if nodeInfo.Status != types.NODE_STATUS_INVALID
// then nodeInfo has valid data.
}
}
// Stop gossiping
g.Stop()
```
## Contributing
### Testing
To test, run `make test`. This will run the unit tests
### Vendoring
For vendoring, we use [dep](https://golang.github.io/dep/). Some useful dep commands are:
- `dep ensure`: install the project's dependencies
- `dep ensure -update`: update the locked versions of all dependencies
- `dep ensure -add github.com/pkg/errors`: add a dependency to the project