raft

package
v0.0.0-...-75eef08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2025 License: MIT Imports: 0 Imported by: 0

README

Raft

Getting Started

package main

import (
	"github.com/shortlink-org/shortlink/pkg/raft"
)

func main() {
	r, err := raft.New(raft.Config{
		Name:     "node1",
		BindAddr: "localhost:8001",
	})
	if err != nil {
		panic(err)
	}

	r.Go(func() {
		// Do something
	})
}

Raft server states

stateDiagram-v2
  UNSPECIFIED --> Follower: times out, start election
  Follower    --> Candidate: times out, start election
  Candidate   --> Candidate: timeout, new election
  Candidate   --> Leader: win election
  Candidate   --> Follower: receive vote from majority
Docs

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
rpc
v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL