Documentation ¶
Index ¶
- func Init(rs *rpc.Server)
- type Client
- type ClientState
- type CommitRequest
- type Configuration
- type GetStateRequest
- type Impl
- func (impl *Impl) AdvanceOpId() int
- func (impl *Impl) AppendOp(opId int, logMsg log2.LogMessage) log2.Operation
- func (impl *Impl) BufferCommitRequest(req *CommitRequest) *clientrpc.WorkRequest
- func (impl *Impl) BufferPrepareRequest(req *PrepareRequest) *clientrpc.WorkRequest
- func (impl *Impl) ClearOpsAfterOpId()
- func (impl *Impl) Commit(req *CommitRequest, res *clientrpc.EmptyResponse) error
- func (impl *Impl) CreateClientState(clientId string) *ClientState
- func (impl *Impl) DoPendingCommits(commitId int)
- func (impl *Impl) GetBackups() []Replica
- func (impl *Impl) GetClientState(clientId string) *ClientState
- func (impl *Impl) GetClusterStatus() Status
- func (impl *Impl) GetOtherReplicas() []Replica
- func (impl *Impl) GetPrimary() Replica
- func (impl *Impl) GetQuorumSize() int
- func (impl *Impl) GetState(req *GetStateRequest) *NewStateResponse
- func (impl *Impl) IsClusterStatusNormal() bool
- func (impl *Impl) IsPrimary() bool
- func (impl *Impl) IsPrimaryReqRecvd() bool
- func (impl *Impl) Prepare(req *PrepareRequest, res *clientrpc.EmptyResponse) error
- func (impl *Impl) ProcessCommitRequests()
- func (impl *Impl) ProcessPrepareRequests()
- func (impl *Impl) Recovery(req *RecoveryRequest, res *RecoveryResponse) error
- func (impl *Impl) SendRecoveryRequests(nonce []byte) chan *RecoveryResponse
- func (impl *Impl) SetClusterStatusNormal()
- func (impl *Impl) SetClusterStatusViewChange()
- func (impl *Impl) SetPrimaryReqRecvd(status bool)
- func (impl *Impl) UpdateClientState(clientId string, requestId int, res *log2.OpResult) *OpResponse
- func (impl *Impl) UpdatePrimaryNode(id int)
- func (impl *Impl) WaitForRecoveryQuorum(nonce []byte, done chan *RecoveryResponse) *RecoveryResponse
- func (impl *Impl) WaitForStateTransfer(view int)
- type NewStateResponse
- type OpResponse
- type PrepareOkRequest
- type PrepareRequest
- type RecoveryRequest
- type RecoveryResponse
- type Replica
- type Role
- type Status
- type ViewReplication
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientState ¶
type ClientState struct { Id string RequestId int LastResponse *OpResponse }
type CommitRequest ¶
func (*CommitRequest) LogRequest ¶
func (req *CommitRequest) LogRequest(recv bool)
type Configuration ¶
type Configuration struct { Id int Self *Replica Replicas map[int]Replica QuorumSize int // contains filtered or unexported fields }
func (*Configuration) GetClient ¶
func (c *Configuration) GetClient(id string) Client
func (*Configuration) IsPrimary ¶
func (c *Configuration) IsPrimary() bool
func (*Configuration) SetPrimary ¶
func (c *Configuration) SetPrimary(id int, self bool)
type GetStateRequest ¶
func (*GetStateRequest) LogRequest ¶
func (req *GetStateRequest) LogRequest(recv bool)
type Impl ¶
type Impl struct { Config Configuration View int OpId int Ops []log2.Operation CommitId int ClusterStatus Status ClientStates map[string]*ClientState PrepareQueue chan *clientrpc.WorkRequest CommitQueue chan *clientrpc.WorkRequest ActivityTimer *time.Timer ActivityTimeout time.Duration }
func (*Impl) AdvanceOpId ¶
func (*Impl) BufferCommitRequest ¶
func (impl *Impl) BufferCommitRequest(req *CommitRequest) *clientrpc.WorkRequest
func (*Impl) BufferPrepareRequest ¶
func (impl *Impl) BufferPrepareRequest(req *PrepareRequest) *clientrpc.WorkRequest
func (*Impl) ClearOpsAfterOpId ¶
func (impl *Impl) ClearOpsAfterOpId()
func (*Impl) Commit ¶
func (impl *Impl) Commit(req *CommitRequest, res *clientrpc.EmptyResponse) error
func (*Impl) CreateClientState ¶
func (impl *Impl) CreateClientState(clientId string) *ClientState
func (*Impl) DoPendingCommits ¶
func (*Impl) GetBackups ¶
func (*Impl) GetClientState ¶
func (impl *Impl) GetClientState(clientId string) *ClientState
func (*Impl) GetClusterStatus ¶
func (*Impl) GetOtherReplicas ¶
func (*Impl) GetPrimary ¶
func (*Impl) GetQuorumSize ¶
func (*Impl) GetState ¶
func (impl *Impl) GetState(req *GetStateRequest) *NewStateResponse
func (*Impl) IsClusterStatusNormal ¶
func (*Impl) IsPrimaryReqRecvd ¶
func (*Impl) Prepare ¶
func (impl *Impl) Prepare(req *PrepareRequest, res *clientrpc.EmptyResponse) error
func (*Impl) ProcessCommitRequests ¶
func (impl *Impl) ProcessCommitRequests()
func (*Impl) ProcessPrepareRequests ¶
func (impl *Impl) ProcessPrepareRequests()
func (*Impl) Recovery ¶
func (impl *Impl) Recovery(req *RecoveryRequest, res *RecoveryResponse) error
func (*Impl) SendRecoveryRequests ¶
func (impl *Impl) SendRecoveryRequests(nonce []byte) chan *RecoveryResponse
func (*Impl) SetClusterStatusNormal ¶
func (impl *Impl) SetClusterStatusNormal()
func (*Impl) SetClusterStatusViewChange ¶
func (impl *Impl) SetClusterStatusViewChange()
func (*Impl) SetPrimaryReqRecvd ¶
func (*Impl) UpdateClientState ¶
func (*Impl) UpdatePrimaryNode ¶
func (*Impl) WaitForRecoveryQuorum ¶
func (impl *Impl) WaitForRecoveryQuorum(nonce []byte, done chan *RecoveryResponse) *RecoveryResponse
func (*Impl) WaitForStateTransfer ¶
type NewStateResponse ¶
type NewStateResponse struct { View int OpId int CommitId int Ops []log2.Operation Primary int ReplicaId int DestId int }
func (*NewStateResponse) LogResponse ¶
func (res *NewStateResponse) LogResponse(recv bool)
type OpResponse ¶
func (*OpResponse) LogResponse ¶
func (or *OpResponse) LogResponse(recv bool)
func (*OpResponse) String ¶
func (or *OpResponse) String() string
type PrepareOkRequest ¶
func (*PrepareOkRequest) LogRequest ¶
func (req *PrepareOkRequest) LogRequest(recv bool)
type PrepareRequest ¶
type PrepareRequest struct { ClientId string RequestId int View int Log log2.LogMessage OpId int CommitId int ReplicaId int DestId int }
func (*PrepareRequest) LogRequest ¶
func (req *PrepareRequest) LogRequest(recv bool)
type RecoveryRequest ¶
func (*RecoveryRequest) LogRequest ¶
func (req *RecoveryRequest) LogRequest(recv bool)
type RecoveryResponse ¶
type RecoveryResponse struct { View int Ops []log2.Operation Nonce []byte OpId int CommitId int ReplicaId int DestId int }
func (*RecoveryResponse) LogResponse ¶
func (res *RecoveryResponse) LogResponse(recv bool)
type Replica ¶
func (Replica) IsConnected ¶
func (*Replica) SetPrimary ¶
func (r *Replica) SetPrimary()
type ViewReplication ¶
type ViewReplication interface { Prepare(req *PrepareRequest, res *clientrpc.EmptyResponse) error Commit(req *CommitRequest, res *clientrpc.EmptyResponse) error GetState(req *GetStateRequest, res *NewStateResponse) error Recovery(req *RecoveryRequest, res *RecoveryResponse) error }
Click to show internal directories.
Click to hide internal directories.