raft

package module
v0.0.0-...-1ce129d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 4 Imported by: 0

README

raft

Implementation of Raft algorithm

Documentation

Overview

Server container for a Raft Consensus Module. Exposes Raft to the network and enables RPCs between Raft peers.

Eli Bendersky [https://eli.thegreenplace.net] This code is in the public domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consensus

type Consensus struct {
	// contains filtered or unexported fields
}

Consensus provides implementation of consensus module

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(id int, peerIds []int, ready <-chan interface{}) *Server

New server creates a new one server

func (*Server) ConnectToPeer

func (s *Server) ConnectToPeer(peerID int, addr net.Addr) error

ConnectToPeer provides connecting to the peer

func (*Server) DisconnectAll

func (s *Server) DisconnectAll()

DisconnectAll provides disconnecting of all clients

func (*Server) DisconnectPeer

func (s *Server) DisconnectPeer(peerID int) error

DisconnectPeer disconnects this server from the peer identified by peerId.

func (*Server) GetListenAddr

func (s *Server) GetListenAddr() net.Addr

GetListenAddr returns net address

func (*Server) Serve

func (s *Server) Serve()

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown provides shutdownling of the server

Jump to

Keyboard shortcuts

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