genericsmr

package
v0.0.0-...-ef9f1ab Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CHAN_BUFFER_SIZE = 200000

Variables

This section is empty.

Functions

This section is empty.

Types

type Beacon

type Beacon struct {
	Rid       int32
	Timestamp uint64
}

type Client

type Client struct {
	*genericsmrproto.RegisterClientIdArgs
	Reply *bufio.Writer
}

type Connect

type Connect struct {
	*genericsmrproto.Connect
	Reply *bufio.Writer
}

type Disconnect

type Disconnect struct {
	*genericsmrproto.Disconnect
	Reply *bufio.Writer
}

type GetState

type GetState struct {
	*genericsmrproto.GetState
	Reply *bufio.Writer
}

type GetView

type GetView struct {
	*genericsmrproto.GetView
	Reply *bufio.Writer
}

type HasSenderId

type HasSenderId interface {
	GetSenderId() int32
}

type LockedReader

type LockedReader struct {
	*bufio.Reader
	// contains filtered or unexported fields
}

type LockedWriter

type LockedWriter struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

type Propose

type Propose struct {
	*genericsmrproto.Propose
	Reply *bufio.Writer
}

type RPCPair

type RPCPair struct {
	Obj  fastrpc.Serializable
	Chan chan fastrpc.Serializable
}

type RepCommand

type RepCommand struct {
	ServerId int
	Command  state.Command
}

type Replica

type Replica struct {
	N            int        // total number of replicas
	Id           int32      // the ID of the current replica
	PeerAddrList []string   // array with the IP:port address of every replica
	Peers        []net.Conn // cache of connections to all other replicas
	PeerReaders  []LockedReader
	PeerWriters  []LockedWriter
	Alive        []bool // connection status
	Listener     net.Listener

	State *state.State

	ProposeChan chan *Propose // channel for client proposals
	BeaconChan  chan *Beacon  // channel for beacons from peer replicas

	Shutdown bool

	Thrifty bool // send only as many messages as strictly required?
	Exec    bool // execute commands?
	Dreply  bool // reply to client after command has been executed?
	Beacon  bool // send beacons to detect how fast are the other replicas?

	Durable     bool     // log to a stable store?
	StableStore *os.File // file support for the persistent log

	PreferredPeerOrder []int32 // replicas in the preferred order of communication

	Ewma []float64

	OnClientConnect chan bool

	RegisterClientIdChan chan *Client // channel for registering client id

	GetViewChan chan *GetView

	GetStateChan chan *GetState

	SlowdownChan chan *Slowdown

	ConnectChan chan *Connect

	DisconnectChan chan *Disconnect

	TestingState Testing

	Connected map[int]bool
	// contains filtered or unexported fields
}

func NewReplica

func NewReplica(id int, peerAddrList []string, thrifty bool, exec bool, dreply bool) *Replica

func (*Replica) BeTheLeader

func (*Replica) BeTheLeader2

func (*Replica) ConnectListenToPeers

func (r *Replica) ConnectListenToPeers()

func (*Replica) ConnectToPeers

func (r *Replica) ConnectToPeers()

func (*Replica) ConnectToPeersNoListeners

func (r *Replica) ConnectToPeersNoListeners()

func (*Replica) ConnectToPeersSim

func (r *Replica) ConnectToPeersSim(serverId int, simConn *SimConn, reliable bool)

func (*Replica) Ping

func (*Replica) RegisterRPC

func (r *Replica) RegisterRPC(msgObj fastrpc.Serializable, notify chan fastrpc.Serializable) uint8

func (*Replica) ReplyBeacon

func (r *Replica) ReplyBeacon(beacon *Beacon)

func (*Replica) ReplyConnect

func (r *Replica) ReplyConnect(reply *genericsmrproto.ConnectReply, w *bufio.Writer)

func (*Replica) ReplyDisconnect

func (r *Replica) ReplyDisconnect(reply *genericsmrproto.DisconnectReply, w *bufio.Writer)

func (*Replica) ReplyGetState

func (r *Replica) ReplyGetState(reply *genericsmrproto.GetStateReply, w *bufio.Writer)

func (*Replica) ReplyGetView

func (r *Replica) ReplyGetView(reply *genericsmrproto.GetViewReply, w *bufio.Writer)

func (*Replica) ReplyPropose

func (r *Replica) ReplyPropose(reply *genericsmrproto.ProposeReply, w *bufio.Writer)

func (*Replica) ReplyProposeTS

func (r *Replica) ReplyProposeTS(reply *genericsmrproto.ProposeReplyTS, w *bufio.Writer)

func (*Replica) ReplyRegisterClientId

func (r *Replica) ReplyRegisterClientId(reply *genericsmrproto.RegisterClientIdReply, w *bufio.Writer)

func (*Replica) ReplySlowdown

func (r *Replica) ReplySlowdown(reply *genericsmrproto.SlowdownReply, w *bufio.Writer)

func (*Replica) SendBeacon

func (r *Replica) SendBeacon(peerId int32)

func (*Replica) SendMsg

func (r *Replica) SendMsg(peerId int32, code uint8, msg fastrpc.Serializable)

func (*Replica) SendMsgNoFlush

func (r *Replica) SendMsgNoFlush(peerId int32, code uint8, msg fastrpc.Serializable)

func (*Replica) UpdatePreferredPeerOrder

func (r *Replica) UpdatePreferredPeerOrder(quorum []int32)

updates the preferred order in which to communicate with peers according to a preferred quorum

func (*Replica) WaitForClientConnections

func (r *Replica) WaitForClientConnections()

Client connections dispatcher

type SimConn

type SimConn struct {
	*io.PipeReader
	*io.PipeWriter
}

func NewSimConn

func NewSimConn(pr *io.PipeReader, pw *io.PipeWriter) *SimConn

type Slowdown

type Slowdown struct {
	*genericsmrproto.Slowdown
	Reply *bufio.Writer
}

type Testing

type Testing struct {
	IsProduction bool
	// IsConnected  IsConnectedStatus
	IsReliable   map[int]bool
	RequestChan  chan state.Command
	ResponseChan chan RepCommand
}

Jump to

Keyboard shortcuts

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