genericsmr

package
v0.0.0-...-858e4a7 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CHAN_BUFFER_SIZE = 200000
View Source
const FALSE = uint8(0)
View Source
const TRUE = uint8(1)

Variables

This section is empty.

Functions

This section is empty.

Types

type Beacon

type Beacon struct {
	Rid       int32
	Timestamp int64
}

type Propose

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

type RPCPair

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

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  []*bufio.Reader
	PeerWriters  []*bufio.Writer
	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?
	LRead   bool // execute local reads?
	Dreply  bool // reply to client after command has been executed?
	Beacon  bool // send beacons to detect how fast are the other replicas?

	F int

	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
	Latencies []int64

	Mutex sync.Mutex

	Stats *genericsmrproto.Stats
	// contains filtered or unexported fields
}

func NewReplica

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

func (*Replica) BeTheLeader

func (*Replica) ComputeClosestPeers

func (r *Replica) ComputeClosestPeers()

func (*Replica) ConnectToPeers

func (r *Replica) ConnectToPeers()

func (*Replica) ConnectToPeersNoListeners

func (r *Replica) ConnectToPeersNoListeners()

func (*Replica) FastQuorumSize

func (r *Replica) FastQuorumSize() int

func (*Replica) Ping

func (*Replica) ReadQuorumSize

func (r *Replica) ReadQuorumSize() int

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) ReplyProposeTS

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

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) SlowQuorumSize

func (r *Replica) SlowQuorumSize() int

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

func (*Replica) WriteQuorumSize

func (r *Replica) WriteQuorumSize() int

Flexible Paxos

Jump to

Keyboard shortcuts

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