Documentation ¶
Overview ¶
Package msgs describes all I/O formatting
Index ¶
- func Marshal(v interface{}) ([]byte, error)
- func Unmarshal(data []byte, v interface{}) error
- type Check
- type CheckRequest
- type CheckResponse
- type Client
- type ClientNet
- type ClientRequest
- type ClientResponse
- type Commit
- type CommitRequest
- type CommitResponse
- type Coordinate
- type CoordinateRequest
- type CoordinateResponse
- type Copy
- type CopyRequest
- type CopyResponse
- type DummyStorage
- type Entry
- type ExternalStorage
- type FailureNotifier
- type ForwardRequest
- type LogUpdate
- type NewView
- type NewViewRequest
- type NewViewResponse
- type Notificator
- type PeerNet
- type Prepare
- type PrepareRequest
- type PrepareResponse
- type ProtoMsgs
- type Query
- type QueryRequest
- type QueryResponse
- type Requests
- type Responses
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Check ¶
type Check struct { Request CheckRequest Response CheckResponse }
type CheckRequest ¶
type CheckRequest struct { SenderID int Requests []ClientRequest }
Check is used to see apply a read without the master
type CheckResponse ¶
type CheckResponse struct { SenderID int Success bool CommitIndex int Replies []ClientResponse }
type Client ¶
type Client struct { Request ClientRequest Response ClientResponse }
Client wraps a ClientRequest and ClientResponse.
type ClientNet ¶
type ClientNet struct { IncomingRequests chan ClientRequest OutgoingResponses chan Client OutgoingRequestsFailed chan ClientRequest }
func MakeClientNet ¶
type ClientRequest ¶
type ClientRequest struct { ClientID int RequestID int ForceViewChange bool ReadOnly bool Request string }
ClientRequest desribes a request.
type ClientResponse ¶
ClientResponse desribes a request response.
type Commit ¶
type Commit struct { Request CommitRequest Response CommitResponse }
Commit wraps a CommitRequest and CommitResponse.
type CommitRequest ¶
type CommitRequest struct { SenderID int ResponseRequired bool StartIndex int EndIndex int Entries []Entry }
CommitRequest describes a Commit messages.
type CommitResponse ¶
CommitResponse describes a Commit response messages.
type Coordinate ¶
type Coordinate struct { Request CoordinateRequest Response CoordinateResponse }
type CoordinateRequest ¶
type CoordinateResponse ¶
type Copy ¶
type Copy struct { Request CopyRequest Response CopyResponse }
type CopyRequest ¶
type CopyResponse ¶
CopyResponse is not currently used
type DummyStorage ¶
type DummyStorage struct{}
func MakeDummyStorage ¶
func MakeDummyStorage() *DummyStorage
func (*DummyStorage) PersistLogUpdate ¶
func (_ *DummyStorage) PersistLogUpdate(log LogUpdate) error
func (*DummyStorage) PersistSnapshot ¶
func (_ *DummyStorage) PersistSnapshot(index int, snap []byte) error
func (*DummyStorage) PersistView ¶
func (_ *DummyStorage) PersistView(view int) error
type Entry ¶
type Entry struct { View int Committed bool Requests []ClientRequest }
Entry describes a item stored in the replicated log.
type ExternalStorage ¶
type ExternalStorage struct { ViewPersist chan int ViewPersistFsync chan int LogPersist chan LogUpdate LogPersistFsync chan LogUpdate }
func MakeExternalStorage ¶
func MakeExternalStorage() *ExternalStorage
func (*ExternalStorage) PersistLogUpdate ¶
func (s *ExternalStorage) PersistLogUpdate(logUpdate LogUpdate) error
func (*ExternalStorage) PersistSnapshot ¶
func (s *ExternalStorage) PersistSnapshot(index int, snap []byte) error
func (*ExternalStorage) PersistView ¶
func (s *ExternalStorage) PersistView(view int) error
type FailureNotifier ¶
type FailureNotifier struct {
// contains filtered or unexported fields
}
func NewFailureNotifier ¶
func NewFailureNotifier(n int) *FailureNotifier
func (*FailureNotifier) IsConnected ¶
func (f *FailureNotifier) IsConnected(id int) bool
func (*FailureNotifier) NextConnected ¶
func (f *FailureNotifier) NextConnected(id int) int
Return the ID of the next connected node
func (*FailureNotifier) NotifyOnFailure ¶
func (f *FailureNotifier) NotifyOnFailure(id int) chan bool
func (*FailureNotifier) NowConnected ¶
func (f *FailureNotifier) NowConnected(id int) error
func (*FailureNotifier) NowDisconnected ¶
func (f *FailureNotifier) NowDisconnected(id int)
type ForwardRequest ¶
type ForwardRequest struct { SenderID int View int Request ClientRequest }
type NewView ¶
type NewView struct { Request NewViewRequest Response NewViewResponse }
type NewViewRequest ¶
type NewViewResponse ¶
type Notificator ¶
type Notificator struct {
// contains filtered or unexported fields
}
func NewNotificator ¶
func NewNotificator() *Notificator
func (*Notificator) IsSubscribed ¶
func (n *Notificator) IsSubscribed(request ClientRequest) bool
func (*Notificator) Notify ¶
func (n *Notificator) Notify(request ClientRequest, response ClientResponse)
func (*Notificator) Subscribe ¶
func (n *Notificator) Subscribe(request ClientRequest) ClientResponse
Blocking call
type PeerNet ¶
type PeerNet struct { Incoming ProtoMsgs OutgoingBroadcast ProtoMsgs OutgoingUnicast map[int]*ProtoMsgs }
func MakePeerNet ¶
type Prepare ¶
type Prepare struct { Request PrepareRequest Response PrepareResponse }
Prepare wraps a PrepareRequest and PrepareResponse.
type PrepareRequest ¶
type PrepareRequest struct { SenderID int View int StartIndex int // inclusive EndIndex int // exclusive Entries []Entry }
PrepareRequest describes a Prepare messages.
type PrepareResponse ¶
PrepareResponse describes a Prepare response messages.
type ProtoMsgs ¶
func MakeProtoMsgs ¶
func (*ProtoMsgs) BytesToProtoMsg ¶
func (*ProtoMsgs) Discard ¶
func (from *ProtoMsgs) Discard()
Forward mesaages from one ProtoMsgs to another
func (*ProtoMsgs) ProtoMsgToBytes ¶
type Query ¶
type Query struct { Request QueryRequest Response QueryResponse }
type QueryRequest ¶
type QueryResponse ¶
type Requests ¶
type Requests struct { Prepare chan PrepareRequest Commit chan CommitRequest NewView chan NewViewRequest Query chan QueryRequest Copy chan CopyRequest Coordinate chan CoordinateRequest Forward chan ForwardRequest Check chan CheckRequest }