MaxDeg / fs-swim

Swim protocol implementation in F#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fs-swim

Swim protocol implementation

This repository contains a implementation of Swim protocol (https://www.cs.cornell.edu/~asdas/research/dsn02-swim.pdf) in F#.

This could be used as a library to keep a cluster of mutiple node connected together with an heartbeat system integrated.

A simple program is provided in the solution.

Usage

SwimProtocol.exe [port] [node addresses]

  • SwimProtocol.exe "1337" -- Will run the first node of a cluster
  • SwimProtocol.exe "1338" "XXX.XXX.XXX.XXX:1337" -- Wil run another that will connect to the cluster

Example

Running a cluster of 5 nodes on the same machine.

open System
open System.Diagnostics

let localName = System.Net.Dns.GetHostName()

let exec args =
    let psi = new ProcessStartInfo(__SOURCE_DIRECTORY__ + @"\bin\Release\SwimProtocol.exe")
    psi.Arguments <- args
    psi.UseShellExecute <- true
    Process.Start(psi) |> ignore

let remoteNode = sprintf "%s:%i"

exec "1337"

for i in 1..7 do
    remoteNode "127.0.0.1" 1337
    |> sprintf "%i %s" (1337 + i)
    |> exec

About

Swim protocol implementation in F#

License:MIT License


Languages

Language:F# 97.7%Language:Shell 1.7%Language:Batchfile 0.6%