Documentation
¶
Index ¶
- Constants
- Variables
- type LwsWalAdaptor
- func (l *LwsWalAdaptor) AddNewView() error
- func (l *LwsWalAdaptor) AddProposalWalIndex(proposalHeight, index uint64)
- func (l *LwsWalAdaptor) Close()
- func (l *LwsWalAdaptor) GetHeightStatus() map[uint64]uint64
- func (l *LwsWalAdaptor) ReplayWal() (bool, error)
- func (l *LwsWalAdaptor) SaveWalEntry(msgType maxbftpb.MessageType, msg []byte) (uint64, error)
- func (l *LwsWalAdaptor) SwitchState(contract *maxbftpb.GovernanceContract)
- func (l *LwsWalAdaptor) UpdateWalIndexAndTrunc(committedHeight uint64)
- type WalAdaptor
- type WalEntryCoder
Constants ¶
const EntryTypeWalEntry = int8(1)
EntryTypeWalEntry is the entry type in lws
Variables ¶
ErrWrongFormattingData is an error about wrong formatting data
Functions ¶
This section is empty.
Types ¶
type LwsWalAdaptor ¶
type LwsWalAdaptor struct {
// contains filtered or unexported fields
}
LwsWalAdaptor is an implementation of interface WalAdaptor
func (*LwsWalAdaptor) AddNewView ¶
func (l *LwsWalAdaptor) AddNewView() error
AddNewView add new view information to wal
func (*LwsWalAdaptor) AddProposalWalIndex ¶
func (l *LwsWalAdaptor) AddProposalWalIndex(proposalHeight, index uint64)
AddProposalWalIndex add proposal wal index to wal
func (*LwsWalAdaptor) GetHeightStatus ¶
func (l *LwsWalAdaptor) GetHeightStatus() map[uint64]uint64
GetHeightStatus return current height status of the wal
func (*LwsWalAdaptor) ReplayWal ¶
func (l *LwsWalAdaptor) ReplayWal() (bool, error)
ReplayWal replay wal file after the node was restarted
func (*LwsWalAdaptor) SaveWalEntry ¶
func (l *LwsWalAdaptor) SaveWalEntry(msgType maxbftpb.MessageType, msg []byte) (uint64, error)
SaveWalEntry save an entry to the wal
func (*LwsWalAdaptor) SwitchState ¶
func (l *LwsWalAdaptor) SwitchState(contract *maxbftpb.GovernanceContract)
SwitchState set the state of the new epoch
func (*LwsWalAdaptor) UpdateWalIndexAndTrunc ¶
func (l *LwsWalAdaptor) UpdateWalIndexAndTrunc(committedHeight uint64)
UpdateWalIndexAndTrunc update wal index and truncate the wal file
type WalAdaptor ¶
type WalAdaptor interface { // save consensus messages that validated to log wal system SaveWalEntry(msgType maxbft.MessageType, msg []byte) (uint64, error) // load consensus messages from wal system and replay them ReplayWal() (hasWalEntry bool, err error) // delete related information after committed blocks and update lastCommitWalIndex UpdateWalIndexAndTrunc(committedHeight uint64) // record wal index when receiving proposal AddProposalWalIndex(proposalHeight, index uint64) // return height status GetHeightStatus() map[uint64]uint64 // set the state of the new epoch SwitchState(contract *maxbftpb.GovernanceContract) // save new view information to wal AddNewView() error // close the wal Close() }
WalAdaptor defines an adapter for wal components
type WalEntryCoder ¶
type WalEntryCoder struct { }
WalEntryCoder used to encode and decode data in lws
func (*WalEntryCoder) Decode ¶
func (c *WalEntryCoder) Decode(data []byte) (interface{}, error)
Decode deserialize []byte to wal entry
func (*WalEntryCoder) Encode ¶
func (c *WalEntryCoder) Encode(s interface{}) ([]byte, error)
Encode serialize wal entry to []byte