protocol

package
v0.0.0-...-4ad0f93 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(url string) bool

func Send

func Send(value int)

func Start

func Start(url string, urls []string)

Types

type LogEntry

type LogEntry struct {
	Value int // contains command for state machine
	Term  int // term when entry was received by leader
}

type RpcArgsAppendEntries

type RpcArgsAppendEntries struct {
	Term         int
	LeaderId     string
	PrevLogIndex int
	PrevLogTerm  int
	Entries      []LogEntry
	LeaderCommit int
}

type RpcArgsRequestVote

type RpcArgsRequestVote struct {
	Term         int
	CandidateId  string
	LastLogIndex int
	LastLogTerm  int
}

type RpcClient

type RpcClient int

func (*RpcClient) Send

func (t *RpcClient) Send(value int, reply *RpcSendReply) error

type RpcSendReply

type RpcSendReply struct {
	Success bool
	Leader  string
}

type RpcServer

type RpcServer int

func (*RpcServer) AppendEntries

func (t *RpcServer) AppendEntries(args RpcArgsAppendEntries, reply *RpcServerReply) error

func (*RpcServer) RequestVote

func (t *RpcServer) RequestVote(args RpcArgsRequestVote, reply *RpcServerReply) error

type RpcServerReply

type RpcServerReply struct {
	Term    int
	Success bool
}

type Server

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

Jump to

Keyboard shortcuts

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