GithubHelp home page GithubHelp logo

tonydoan889 / gossip Goto Github PK

View Code? Open in Web Editor NEW

This project forked from libopenstorage/gossip

0.0 1.0 0.0 2.01 MB

Go implementation of the Gossip protocol

License: Apache License 2.0

Makefile 0.65% Go 99.35%

gossip's Introduction

gossip

Travis branch

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("<ip>:<port>", "<unique node id>", "<peer-list>")
// Add peer nodes with whom you want to gossip
g.AddNode("<peer_ip>:<peer_port>")
...
// update self values
g.UpdateSelf("<some_key>", "<any_value>")
// 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. 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

gossip's People

Contributors

sangleganesh avatar adityadani avatar gourao avatar baopx avatar lpabon avatar

Watchers

James Cloos avatar

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.