Git Product home page Git Product logo

committer's Introduction

committer

Two-phase (2PC) and three-phase (3PC) protocols implementaion in Golang. Committer uses BadgerDB for persistence.


protocols description:


Configuring

All config parameters may be specified via command-line flags

flag description default example
role role of the node (coordinator of follower) follower -role=coordinator
nodeaddr node address localhost:3050 -nodeaddr=localhost:3051
coordinator coordinator address "" -coordinator=localhost:3050
committype two-phase or three-phase commit mode three-phase -committype=two-phase
timeout timeout after which the message is considered unacknowledged (only for three-phase mode, because two-phase is blocking by design) 1000 -timeout=500
dbpath database path on filesystem ./badger -dbpath=/tmp/badger
followers comma-separated list of followers' addresses "" -followers=localhost:3052,localhost:3053,localhost:3053
whitelist comma-separated list of allowed hosts 127.0.0.1 -whitelist=192.168.0.105,192.168.0.101

example follower:

./committer -role=follower -nodeaddr=localhost:3001 -committype=three-phase -timeout=1000 -dbpath=/tmp/badger/follower

example coordinator:

./committer -role=coordinator -nodeaddr=localhost:3000 -followers=localhost:3001 -committype=three-phase -timeout=1000 -dbpath=/tmp/badger/coordinator

Hooks

Hooks for requests checking on Propose and Commit stage. It's just a function that receives *pb.ProposeRequest or *pb.CommitRequest and returns true or false. Function body incorporate all validation logic.

Example hooks can be found at core/cohort/commitalgo/hooks/hooks.go.

You can replace code in the core/cohort/commitalgo/hooks/hooks.go file used by committer to inject your validation logic into the handlers.

Testing

functional tests: make tests


Testing with example client

compile executables:

make prepare

run coordinator:

make run-example-coordinator

run follower in another shell:

make run-example-follower

run example client:

go run ./examples/client/client.go

Planned Implement a flexible transaction log mechanism. Current in-mem implementation is not reliable.

committer's People

Contributors

juliia-b avatar vadiminshakov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

committer's Issues

Unable to find votesLog

github.com/vadiminshakov/committer/voteslog
The code is asking for votesLog and it's not able to find it.
Can you please help with this?

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.