swift

package
v0.0.0-...-3e9ff4f Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NORMAL = iota
	RECOVERING
)

status

View Source
const (
	START = iota
	PRE_ACCEPT
	ACCEPT
	COMMIT
)

phase

View Source
const (
	BAD_CONT   = 3
	THRESHOLD  = time.Duration(210 * time.Millisecond)
	PING_DELAY = time.Duration(10 * time.Millisecond)
)
View Source
const HISTORY_SIZE = 10010001

Variables

View Source
var MaxDescRoutines = 100

Functions

func IsNilDepOfCmdId

func IsNilDepOfCmdId(cmdId CommandId, dep Dep) bool

func NewReplyChan

func NewReplyChan(r *Replica) *replyChan

func SHashesEq

func SHashesEq(hs1 []SHash, hs2 []SHash) bool

Types

type Ack

type Ack struct {
	CmdId    CommandId
	Dep      []CommandId
	Checksum []SHash
	Seqnum   int
}

func (*Ack) BinarySize

func (t *Ack) BinarySize() (nbytes int, sizeKnown bool)

func (*Ack) Marshal

func (t *Ack) Marshal(wire io.Writer)

func (*Ack) Unmarshal

func (t *Ack) Unmarshal(rr io.Reader) error

type AckCache

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

func NewAckCache

func NewAckCache() *AckCache

func (*AckCache) Get

func (p *AckCache) Get() *Ack

func (*AckCache) Put

func (p *AckCache) Put(t *Ack)

type Batcher

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

func NewBatcher

func NewBatcher(r *Replica, size int,
	freeFastAck func(*MFastAck), freeSlowAck func(*MLightSlowAck)) *Batcher

func (*Batcher) SendFastAck

func (b *Batcher) SendFastAck(f *MFastAck)

func (*Batcher) SendFastAckClient

func (b *Batcher) SendFastAckClient(f *MFastAck, cid int32)

func (*Batcher) SendLightSlowAck

func (b *Batcher) SendLightSlowAck(s *MLightSlowAck)

func (*Batcher) SendLightSlowAckClient

func (b *Batcher) SendLightSlowAckClient(s *MLightSlowAck, cid int32)

type BatcherOp

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

type Client

type Client struct {
	*client.BufferClient

	SQ replica.QuorumI
	FQ replica.QuorumI
	// contains filtered or unexported fields
}

func NewClient

func NewClient(b *client.BufferClient, repNum int) *Client

type CommandId

type CommandId struct {
	ClientId int32
	SeqNum   int32
}

func (*CommandId) BinarySize

func (t *CommandId) BinarySize() (nbytes int, sizeKnown bool)

func (*CommandId) Marshal

func (t *CommandId) Marshal(wire io.Writer)

func (CommandId) String

func (cmdId CommandId) String() string

func (*CommandId) Unmarshal

func (t *CommandId) Unmarshal(wire io.Reader) error

type CommandIdCache

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

func NewCommandIdCache

func NewCommandIdCache() *CommandIdCache

func (*CommandIdCache) Get

func (p *CommandIdCache) Get() *CommandId

func (*CommandIdCache) Put

func (p *CommandIdCache) Put(t *CommandId)

type CommunicationSupply

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

type DelayEntry

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

type DelayLog

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

func NewDelayLog

func NewDelayLog(r *Replica) *DelayLog

func (*DelayLog) BTick

func (dl *DelayLog) BTick(ballot, id int32, fast bool)

func (*DelayLog) Reinit

func (dl *DelayLog) Reinit(r *Replica)

func (*DelayLog) Tick

func (dl *DelayLog) Tick(id int32, fast bool) int32

type Dep

type Dep []CommandId

func NilDepOfCmdId

func NilDepOfCmdId(cmdId CommandId) Dep

func (Dep) Contains

func (d Dep) Contains(cmdId CommandId) bool

func (Dep) Equals

func (dep1 Dep) Equals(dep2 Dep) bool

func (Dep) EqualsAndDiff

func (dep1 Dep) EqualsAndDiff(dep2 Dep) (bool, map[CommandId]struct{})

type HashLog

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

func NewHashLog

func NewHashLog() *HashLog

func (*HashLog) Append

func (l *HashLog) Append(_ state.Command, cmdId CommandId) SHash

func (*HashLog) String

func (l *HashLog) String() string

func (*HashLog) Update

func (l *HashLog) Update(cmdId CommandId, s int, h SHash)

type HashNode

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

func (*HashNode) String

func (n *HashNode) String() string

type MAccept

type MAccept struct {
	Replica int32
	Ballot  int32
	CmdId   CommandId
	Rep     []byte
}

func (*MAccept) BinarySize

func (t *MAccept) BinarySize() (nbytes int, sizeKnown bool)

func (*MAccept) Marshal

func (t *MAccept) Marshal(wire io.Writer)

func (*MAccept) New

func (m *MAccept) New() fastrpc.Serializable

func (*MAccept) Unmarshal

func (t *MAccept) Unmarshal(rr io.Reader) error

type MAcceptCache

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

func NewMAcceptCache

func NewMAcceptCache() *MAcceptCache

func (*MAcceptCache) Get

func (p *MAcceptCache) Get() *MAccept

func (*MAcceptCache) Put

func (p *MAcceptCache) Put(t *MAccept)

type MAcks

type MAcks struct {
	FastAcks      []MFastAck
	LightSlowAcks []MLightSlowAck
}

func (*MAcks) BinarySize

func (t *MAcks) BinarySize() (nbytes int, sizeKnown bool)

func (*MAcks) Marshal

func (t *MAcks) Marshal(wire io.Writer)

func (*MAcks) New

func (m *MAcks) New() fastrpc.Serializable

func (*MAcks) Unmarshal

func (t *MAcks) Unmarshal(rr io.Reader) error

type MAcksCache

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

func NewMAcksCache

func NewMAcksCache() *MAcksCache

func (*MAcksCache) Get

func (p *MAcksCache) Get() *MAcks

func (*MAcksCache) Put

func (p *MAcksCache) Put(t *MAcks)

type MCollect

type MCollect struct {
	Replica int32
	Ballot  int32
	Ids     []CommandId
}

func (*MCollect) BinarySize

func (t *MCollect) BinarySize() (nbytes int, sizeKnown bool)

func (*MCollect) Marshal

func (t *MCollect) Marshal(wire io.Writer)

func (*MCollect) New

func (m *MCollect) New() fastrpc.Serializable

func (*MCollect) Unmarshal

func (t *MCollect) Unmarshal(rr io.Reader) error

type MCollectCache

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

func NewMCollectCache

func NewMCollectCache() *MCollectCache

func (*MCollectCache) Get

func (p *MCollectCache) Get() *MCollect

func (*MCollectCache) Put

func (p *MCollectCache) Put(t *MCollect)

type MFastAck

type MFastAck struct {
	Replica  int32
	Ballot   int32
	CmdId    CommandId
	Dep      []CommandId
	Checksum []SHash
	Seqnum   int
}

func (*MFastAck) BinarySize

func (t *MFastAck) BinarySize() (nbytes int, sizeKnown bool)

func (*MFastAck) Marshal

func (t *MFastAck) Marshal(wire io.Writer)

func (*MFastAck) New

func (m *MFastAck) New() fastrpc.Serializable

func (*MFastAck) Unmarshal

func (t *MFastAck) Unmarshal(rr io.Reader) error

type MFastAckCache

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

func NewMFastAckCache

func NewMFastAckCache() *MFastAckCache

func (*MFastAckCache) Get

func (p *MFastAckCache) Get() *MFastAck

func (*MFastAckCache) Put

func (p *MFastAckCache) Put(t *MFastAck)

type MFastAckClient

type MFastAckClient struct {
	Replica  int32
	Ballot   int32
	CmdId    CommandId
	Checksum []SHash
}

func (*MFastAckClient) BinarySize

func (t *MFastAckClient) BinarySize() (nbytes int, sizeKnown bool)

func (*MFastAckClient) Marshal

func (t *MFastAckClient) Marshal(wire io.Writer)

func (*MFastAckClient) New

func (*MFastAckClient) Unmarshal

func (t *MFastAckClient) Unmarshal(rr io.Reader) error

type MFastAckClientCache

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

func NewMFastAckClientCache

func NewMFastAckClientCache() *MFastAckClientCache

func (*MFastAckClientCache) Get

func (*MFastAckClientCache) Put

type MLightSlowAck

type MLightSlowAck struct {
	Replica int32
	Ballot  int32
	CmdId   CommandId
}

func (*MLightSlowAck) BinarySize

func (t *MLightSlowAck) BinarySize() (nbytes int, sizeKnown bool)

func (*MLightSlowAck) Marshal

func (t *MLightSlowAck) Marshal(wire io.Writer)

func (*MLightSlowAck) New

func (*MLightSlowAck) Unmarshal

func (t *MLightSlowAck) Unmarshal(wire io.Reader) error

type MLightSlowAckCache

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

func NewMLightSlowAckCache

func NewMLightSlowAckCache() *MLightSlowAckCache

func (*MLightSlowAckCache) Get

func (*MLightSlowAckCache) Put

func (p *MLightSlowAckCache) Put(t *MLightSlowAck)

type MLightSync

type MLightSync struct {
	Replica int32
	Ballot  int32
}

func (*MLightSync) BinarySize

func (t *MLightSync) BinarySize() (nbytes int, sizeKnown bool)

func (*MLightSync) Marshal

func (t *MLightSync) Marshal(wire io.Writer)

func (*MLightSync) New

func (m *MLightSync) New() fastrpc.Serializable

func (*MLightSync) Unmarshal

func (t *MLightSync) Unmarshal(wire io.Reader) error

type MLightSyncCache

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

func NewMLightSyncCache

func NewMLightSyncCache() *MLightSyncCache

func (*MLightSyncCache) Get

func (p *MLightSyncCache) Get() *MLightSync

func (*MLightSyncCache) Put

func (p *MLightSyncCache) Put(t *MLightSync)

type MNewLeader

type MNewLeader struct {
	Replica int32
	Ballot  int32
}

func (*MNewLeader) BinarySize

func (t *MNewLeader) BinarySize() (nbytes int, sizeKnown bool)

func (*MNewLeader) Marshal

func (t *MNewLeader) Marshal(wire io.Writer)

func (*MNewLeader) New

func (m *MNewLeader) New() fastrpc.Serializable

func (*MNewLeader) Unmarshal

func (t *MNewLeader) Unmarshal(wire io.Reader) error

type MNewLeaderAck

type MNewLeaderAck struct {
	Replica int32
	Ballot  int32
	Cballot int32
}

func (*MNewLeaderAck) BinarySize

func (t *MNewLeaderAck) BinarySize() (nbytes int, sizeKnown bool)

func (*MNewLeaderAck) Marshal

func (t *MNewLeaderAck) Marshal(wire io.Writer)

func (*MNewLeaderAck) New

func (*MNewLeaderAck) Unmarshal

func (t *MNewLeaderAck) Unmarshal(wire io.Reader) error

type MNewLeaderAckCache

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

func NewMNewLeaderAckCache

func NewMNewLeaderAckCache() *MNewLeaderAckCache

func (*MNewLeaderAckCache) Get

func (*MNewLeaderAckCache) Put

func (p *MNewLeaderAckCache) Put(t *MNewLeaderAck)

type MNewLeaderAckN

type MNewLeaderAckN struct {
	Replica int32
	Ballot  int32
	Cballot int32
	CmdIds  []CommandId
	Phases  []int
	Cmds    []state.Command
	Deps    []SDep
}

func (*MNewLeaderAckN) BinarySize

func (t *MNewLeaderAckN) BinarySize() (nbytes int, sizeKnown bool)

func (*MNewLeaderAckN) Marshal

func (t *MNewLeaderAckN) Marshal(wire io.Writer)

func (*MNewLeaderAckN) New

func (*MNewLeaderAckN) Unmarshal

func (t *MNewLeaderAckN) Unmarshal(rr io.Reader) error

type MNewLeaderAckNCache

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

func NewMNewLeaderAckNCache

func NewMNewLeaderAckNCache() *MNewLeaderAckNCache

func (*MNewLeaderAckNCache) Get

func (*MNewLeaderAckNCache) Put

type MNewLeaderCache

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

func NewMNewLeaderCache

func NewMNewLeaderCache() *MNewLeaderCache

func (*MNewLeaderCache) Get

func (p *MNewLeaderCache) Get() *MNewLeader

func (*MNewLeaderCache) Put

func (p *MNewLeaderCache) Put(t *MNewLeader)

type MOptAcks

type MOptAcks struct {
	Replica int32
	Ballot  int32
	Acks    []Ack
}

func (*MOptAcks) BinarySize

func (t *MOptAcks) BinarySize() (nbytes int, sizeKnown bool)

func (*MOptAcks) Marshal

func (t *MOptAcks) Marshal(wire io.Writer)

func (*MOptAcks) New

func (m *MOptAcks) New() fastrpc.Serializable

func (*MOptAcks) Unmarshal

func (t *MOptAcks) Unmarshal(rr io.Reader) error

type MOptAcksCache

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

func NewMOptAcksCache

func NewMOptAcksCache() *MOptAcksCache

func (*MOptAcksCache) Get

func (p *MOptAcksCache) Get() *MOptAcks

func (*MOptAcksCache) Put

func (p *MOptAcksCache) Put(t *MOptAcks)

type MPing

type MPing struct {
	Replica int32
	Ballot  int32
}

func (*MPing) BinarySize

func (t *MPing) BinarySize() (nbytes int, sizeKnown bool)

func (*MPing) Marshal

func (t *MPing) Marshal(wire io.Writer)

func (*MPing) New

func (m *MPing) New() fastrpc.Serializable

func (*MPing) Unmarshal

func (t *MPing) Unmarshal(wire io.Reader) error

type MPingCache

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

func NewMPingCache

func NewMPingCache() *MPingCache

func (*MPingCache) Get

func (p *MPingCache) Get() *MPing

func (*MPingCache) Put

func (p *MPingCache) Put(t *MPing)

type MPingRep

type MPingRep struct {
	Replica int32
	Ballot  int32
}

func (*MPingRep) BinarySize

func (t *MPingRep) BinarySize() (nbytes int, sizeKnown bool)

func (*MPingRep) Marshal

func (t *MPingRep) Marshal(wire io.Writer)

func (*MPingRep) New

func (m *MPingRep) New() fastrpc.Serializable

func (*MPingRep) Unmarshal

func (t *MPingRep) Unmarshal(wire io.Reader) error

type MPingRepCache

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

func NewMPingRepCache

func NewMPingRepCache() *MPingRepCache

func (*MPingRepCache) Get

func (p *MPingRepCache) Get() *MPingRep

func (*MPingRepCache) Put

func (p *MPingRepCache) Put(t *MPingRep)

type MReply

type MReply struct {
	Replica  int32
	Ballot   int32
	CmdId    CommandId
	Checksum []SHash
	Rep      []byte
}

func (*MReply) BinarySize

func (t *MReply) BinarySize() (nbytes int, sizeKnown bool)

func (*MReply) Marshal

func (t *MReply) Marshal(wire io.Writer)

func (*MReply) New

func (m *MReply) New() fastrpc.Serializable

func (*MReply) Unmarshal

func (t *MReply) Unmarshal(rr io.Reader) error

type MReplyCache

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

func NewMReplyCache

func NewMReplyCache() *MReplyCache

func (*MReplyCache) Get

func (p *MReplyCache) Get() *MReply

func (*MReplyCache) Put

func (p *MReplyCache) Put(t *MReply)

type MShareState

type MShareState struct {
	Replica int32
	Ballot  int32
}

func (*MShareState) BinarySize

func (t *MShareState) BinarySize() (nbytes int, sizeKnown bool)

func (*MShareState) Marshal

func (t *MShareState) Marshal(wire io.Writer)

func (*MShareState) New

func (m *MShareState) New() fastrpc.Serializable

func (*MShareState) Unmarshal

func (t *MShareState) Unmarshal(wire io.Reader) error

type MShareStateCache

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

func NewMShareStateCache

func NewMShareStateCache() *MShareStateCache

func (*MShareStateCache) Get

func (p *MShareStateCache) Get() *MShareState

func (*MShareStateCache) Put

func (p *MShareStateCache) Put(t *MShareState)

type MSlowAck

type MSlowAck struct {
	Replica  int32
	Ballot   int32
	CmdId    CommandId
	Dep      []CommandId
	Checksum []SHash
}

func (*MSlowAck) BinarySize

func (t *MSlowAck) BinarySize() (nbytes int, sizeKnown bool)

func (*MSlowAck) Marshal

func (t *MSlowAck) Marshal(wire io.Writer)

func (*MSlowAck) New

func (m *MSlowAck) New() fastrpc.Serializable

func (*MSlowAck) Unmarshal

func (t *MSlowAck) Unmarshal(rr io.Reader) error

type MSlowAckCache

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

func NewMSlowAckCache

func NewMSlowAckCache() *MSlowAckCache

func (*MSlowAckCache) Get

func (p *MSlowAckCache) Get() *MSlowAck

func (*MSlowAckCache) Put

func (p *MSlowAckCache) Put(t *MSlowAck)

type MSync

type MSync struct {
	Replica int32
	Ballot  int32
	Phases  map[CommandId]int
	Cmds    map[CommandId]state.Command
	Deps    map[CommandId]Dep
}

func (*MSync) Marshal

func (m *MSync) Marshal(w io.Writer)

func (*MSync) New

func (m *MSync) New() fastrpc.Serializable

func (*MSync) Unmarshal

func (m *MSync) Unmarshal(r io.Reader) error

type Replica

type Replica struct {
	*replica.Replica

	SQ replica.QuorumI
	FQ replica.QuorumI
	// contains filtered or unexported fields
}

func New

func New(alias string, rid int, addrs []string, exec, fastRead, optExec, AQreconf bool,
	pl, f int, conf *config.Config, l *dlog.Logger, slowAddrs []string) *Replica

func (*Replica) BeTheLeader

func (r *Replica) BeTheLeader(_ *defs.BeTheLeaderArgs, reply *defs.BeTheLeaderReply) error

TODO: do something more elegant

type SDep

type SDep struct {
	Dep []CommandId
}

func (*SDep) BinarySize

func (t *SDep) BinarySize() (nbytes int, sizeKnown bool)

func (*SDep) Marshal

func (t *SDep) Marshal(wire io.Writer)

func (*SDep) Unmarshal

func (t *SDep) Unmarshal(rr io.Reader) error

type SDepCache

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

func NewSDepCache

func NewSDepCache() *SDepCache

func (*SDepCache) Get

func (p *SDepCache) Get() *SDep

func (*SDepCache) Put

func (p *SDepCache) Put(t *SDep)

type SHash

type SHash struct {
	H [32]byte
}

func (*SHash) BinarySize

func (t *SHash) BinarySize() (nbytes int, sizeKnown bool)

func (*SHash) Marshal

func (t *SHash) Marshal(wire io.Writer)

func (*SHash) Unmarshal

func (t *SHash) Unmarshal(wire io.Reader) error

type SHashCache

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

func NewSHashCache

func NewSHashCache() *SHashCache

func (*SHashCache) Get

func (p *SHashCache) Get() *SHash

func (*SHashCache) Put

func (p *SHashCache) Put(t *SHash)

type SwapValue

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

type UpdateEntry

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

Jump to

Keyboard shortcuts

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