All Projects → ThreeMammals → Rafty

ThreeMammals / Rafty

Licence: mit
Implementation of RAFT consensus in .NET core

Projects that are alternatives of or similar to Rafty

Raft.net
Implementation of RAFT distributed consensus algorithm among TCP Peers on .NET / .NETStandard / .NETCore / dotnet
Stars: ✭ 112 (-38.46%)
Mutual labels:  dotnet-standard, raft, dotnet-core, dotnetcore
Corehook
A library that simplifies intercepting application function calls using managed code and the .NET Core runtime
Stars: ✭ 191 (+4.95%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Sharpsnmplib
Sharp SNMP Library- Open Source SNMP for .NET and Mono
Stars: ✭ 247 (+35.71%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Dotnet Etcd
A C# .NET (dotnet) GRPC client for etcd v3 +
Stars: ✭ 157 (-13.74%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Sendgrid Csharp
The Official Twilio SendGrid Led, Community Driven C#, .NetStandard, .NetCore API Library
Stars: ✭ 835 (+358.79%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Awesome Cms Core
Awesome CMS Core is an open source CMS built using ASP.Net Core & ReactJS with module seperation concern in mind and provide lastest trend of technology like .Net Core, React, Webpack, SASS, Background Job, Message Queue.
Stars: ✭ 352 (+93.41%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Appmetrics
App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application.
Stars: ✭ 1,986 (+991.21%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Dotnext
Next generation API for .NET
Stars: ✭ 379 (+108.24%)
Mutual labels:  raft, raft-consensus-algorithm, dotnetcore
Alexa Skills Dotnet
An Amazon Alexa Skills SDK for .NET
Stars: ✭ 412 (+126.37%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Sio.core
✔ [ SIOC ] Swastika I/O Core is an all in one platform (e.g CMS, eCommerce, Forum, Q&A, CRM...) ASP.NET Core / Dotnet Core System based on SIOH Framework.
Stars: ✭ 121 (-33.52%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Wopihost
ASP.NET Core MVC implementation of the WOPI protocol. Enables integration with WOPI clients such as Office Online Server.
Stars: ✭ 132 (-27.47%)
Mutual labels:  dotnet-standard, dotnet-core, dotnetcore
Entityframeworkcore.cacheable
EntityFrameworkCore second level cache
Stars: ✭ 138 (-24.18%)
Mutual labels:  dotnet-standard, dotnet-core
Coravel
Near-zero config .NET Core micro-framework that makes advanced application features like Task Scheduling, Caching, Queuing, Event Broadcasting, and more a breeze!
Stars: ✭ 1,989 (+992.86%)
Mutual labels:  dotnetcore, dotnet-core
Dotnetcore
.NET 5 Nuget Packages.
Stars: ✭ 146 (-19.78%)
Mutual labels:  dotnet-core, dotnetcore
Json Ld.net
A JSON-LD processor for .NET.
Stars: ✭ 171 (-6.04%)
Mutual labels:  dotnet-core, dotnetcore
Nlayerappv3
Domain Driven Design (DDD) N-LayeredArchitecture with .Net Core 2
Stars: ✭ 138 (-24.18%)
Mutual labels:  dotnet-core, dotnetcore
Angular 7 Project With Asp.net Core Apis
Angular 7 Project with ASP.NET CORE APIS | Angular Project
Stars: ✭ 174 (-4.4%)
Mutual labels:  dotnet-core, dotnetcore
Architecture
.NET 6, ASP.NET Core 6, Entity Framework Core 6, C# 10, Angular 13, Clean Code, SOLID, DDD.
Stars: ✭ 2,285 (+1155.49%)
Mutual labels:  dotnet-core, dotnetcore
Dotnetlabs
.NET Labs -- Show Me the Tips and Tricks and Code
Stars: ✭ 135 (-25.82%)
Mutual labels:  dotnet-core, dotnetcore
Netbarcode
Barcode generation library written in C# and .NET Standard 2
Stars: ✭ 149 (-18.13%)
Mutual labels:  dotnet-core, dotnetcore

Rafty

Please note rafty is experimental

Rafty is an implementation of the Raft concensus algorythm see here created using C# and .NET core. Rafty is the algorythm only and does not provide useful implementation of the transport between nodes, the state machine or log. Instead Rafty provides interfaces that you will need to implement. I reccomend at least 5 nodes in your cluster for Rafty to operate optimally and this is basically all I've tested....

Rafty was built to allow Ocelot (another project of mine) to run in a cluster without a database or relying on another piece of software to persist state. This will also allow me to turn Ocelot into a service discovery provider and key value store so its pretty nice....if it works!

Install

Bring the rafty package into your project using nuget.

Install-Package Rafty

This will make all the raft code available to you!

ILog

You must implement ILog which provides a description of each member in the summary comments of the interface. This log implementation should be persistant and not shared between nodes.

IFiniteStateMachine

You must implement IFiniteStateMachine which provides a description of each member in the summary comments of the interface. This just takes a command of T and you execute it! Pretty simple.

IPeer

You must implement IPeer which provides a description of each member in the summary comments of the interface. This encapsulates the transport logic to each node in the cluster.

IPeersProvider

You must implement IPeersProvider which provides a description of each member in the summary comments of the interface. This should return all available nodes in the cluster as peers.

ISettings

You must implement ISettings which provides a description of each member in the summary comments of the interface. Holds some basic settings information that you might want to tweak such as timeout.

Startup

Rafty provides some in memory implementations of its interfaces (you shouldn't use these for anything serious).

    var log = new InMemoryLog();
    var fsm = new InMemoryStateMachine();
    var settings = new InMemorySettings(1000, 3500, 50, 5000);
    var peersProvider = new InMemoryPeersProvider(_peers);
    var node = new Node(fsm, log, settings, peersProvider);
    node.Start();

The above code will get a Rafty node up and running. If the IPeersProvider does not return any IPeers then it will elect itself leader and just run along happily. If something joins the cluster later it will update that new node as the node will get a heartbeat before it can elect itself. Or an election will start!

So in order to get Rafty really running the IPeerProvider needs to return peers. The easiest way to do this is just provide a HTTP transport version of IPeer. The host and port of these peers is known to each node and you just push them into memory and return them. The request will then flow through the IPeer interfaces from the nodes!

Finally you need to expose the INode interface to some kind of HTTP. I would advise just a plain old .net core web api type thing. These are the methods you need to expose and the transport in your IPeer should hit these URLS (hope that makes some sense). You can look at NodePeer to see how I do this in memory.

Task<AppendEntriesResponse> Request(AppendEntries appendEntries);
Task<RequestVoteResponse> Request(RequestVote requestVote);
Task<Response<T>> Request<T>(T command);

Further help

The Acceptance and Integration tests will be helpful for anyone who wants to use Rafty.

Future

I will provide some half decent implementations of these interfaces so you don't have to.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].