Documentation ¶
Index ¶
- Variables
- func IsLocalMessageType(t paxospb.MessageType) bool
- type IInstance
- type ILogDB
- type Peer
- func (p *Peer) Commit(ud paxospb.Update)
- func (p *Peer) GetUpdate(moreEntriesToApply bool) paxospb.Update
- func (p *Peer) Handle(msg paxospb.PaxosMsg)
- func (p *Peer) HasUpdate(moreEntriesToApply bool) bool
- func (p *Peer) NotifyPaxosLastApplied(lastApplied uint64)
- func (p *Peer) Propose(key uint64, value []byte)
- func (p *Peer) Tick()
- type PeerAddress
Constants ¶
This section is empty.
Variables ¶
var ErrCompacted = errors.New("entry compacted")
ErrCompacted is the error returned to indicate that the requested entries are no longer in the LogDB due to compaction.
ErrUnavailable is the error returned to indicate that requested entries are not available in LogDB.
Functions ¶
func IsLocalMessageType ¶
func IsLocalMessageType(t paxospb.MessageType) bool
IsLocalMessageType returns a boolean value indicating whether the specified message type is a local message type.
Types ¶
type IInstance ¶
type IInstance interface {
// contains filtered or unexported methods
}
IInstance ...
type ILogDB ¶
type ILogDB interface { // GetRange returns the range of the entries in LogDB. GetRange() (uint64, uint64) // SetRange updates the ILogDB to extend the entry range known to the ILogDB.s SetRange(index uint64, length uint64) // NodeState returns the state of the node persistented in LogDB. NodeState() paxospb.State SetState(ps paxospb.State) Entries(low uint64, high uint64) ([]paxospb.Entry, error) // Append makes the given entries known to the ILogDB instance. This is // usually not how entries are persisted. Append(entries []paxospb.Entry) error Compact(instanceID uint64) error }
ILogDB is a read-only interface to the underlying persistent storage to allow the paxos package to access paxos state, entries, snapshots stored in the persistent storage. Entries stored in the persistent storage accessible via ILogDB is usually not required in normal cases.
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
Peer is the interface struct for interacting with the underlying Paxos protocol implementation.
func LaunchPeer ¶
func LaunchPeer(config *config.Config, logdb ILogDB, addresses []PeerAddress, initial bool, newNode bool) (*Peer, error)
LaunchPeer starts or restarts a Paxos node.
func (*Peer) HasUpdate ¶
HasUpdate returns a boolean value indicating whether there is any Update ready to be processed.
func (*Peer) NotifyPaxosLastApplied ¶
NotifyPaxosLastApplied ...
type PeerAddress ¶
PeerAddress is the basic info for a peer in the paxos group.