Documentation ¶
Overview ¶
Package wal implements the similar write-ahead logging for cbft consensus.
Index ¶
- func WALDecode(pack []byte, msgType uint16) (interface{}, error)
- func WalDir(ctx *node.ServiceContext) string
- type IWALDatabase
- type Message
- type MessageConfirmedViewChange
- type MessageSendPrepareBlock
- type MessageSendPrepareVote
- type MessageSendViewChange
- type ViewChangeMessage
- type WALDatabase
- func (db *WALDatabase) Close()
- func (db *WALDatabase) Delete(key []byte) error
- func (db *WALDatabase) Get(key []byte) ([]byte, error)
- func (db *WALDatabase) Has(key []byte) (bool, error)
- func (db *WALDatabase) NewIterator(key []byte, wo *opt.ReadOptions) iterator.Iterator
- func (db *WALDatabase) Put(key []byte, value []byte, wo *opt.WriteOptions) error
- type Wal
- type WriterWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WalDir ¶
func WalDir(ctx *node.ServiceContext) string
Types ¶
type IWALDatabase ¶
type Message ¶
type Message struct { Timestamp uint64 Data interface{} }
Message is a combination of consensus msg.
type MessageConfirmedViewChange ¶
type MessageConfirmedViewChange struct { Timestamp uint64 Data *protocols.ConfirmedViewChange }
struct ConfirmedViewChange for rlp decode
type MessageSendPrepareBlock ¶
type MessageSendPrepareBlock struct { Timestamp uint64 Data *protocols.SendPrepareBlock }
struct SendPrepareBlock for rlp decode
type MessageSendPrepareVote ¶
type MessageSendPrepareVote struct { Timestamp uint64 Data *protocols.SendPrepareVote }
struct SendPrepareVote for rlp decode
type MessageSendViewChange ¶
type MessageSendViewChange struct { Timestamp uint64 Data *protocols.SendViewChange }
struct SendViewChange for rlp decode
type ViewChangeMessage ¶
type WALDatabase ¶
type WALDatabase struct {
// contains filtered or unexported fields
}
func (*WALDatabase) Close ¶
func (db *WALDatabase) Close()
func (*WALDatabase) Delete ¶
func (db *WALDatabase) Delete(key []byte) error
Delete deletes the key from the queue and database
func (*WALDatabase) Get ¶
func (db *WALDatabase) Get(key []byte) ([]byte, error)
Get returns the given key if it's present.
func (*WALDatabase) NewIterator ¶
func (db *WALDatabase) NewIterator(key []byte, wo *opt.ReadOptions) iterator.Iterator
func (*WALDatabase) Put ¶
func (db *WALDatabase) Put(key []byte, value []byte, wo *opt.WriteOptions) error
Put puts the given key / value to the queue
type Wal ¶
type Wal interface { UpdateChainState(chainState *protocols.ChainState) error LoadChainState(fn recoveryChainStateFn) error Write(msg interface{}) error WriteSync(msg interface{}) error UpdateViewChange(info *ViewChangeMessage) error UpdateViewChangeQC(epoch uint64, viewNumber uint64, viewChangeQC *ctypes.ViewChangeQC) error GetViewChangeQC(epoch uint64, viewNumber uint64) (*ctypes.ViewChangeQC, error) Load(fn recoveryConsensusMsgFn) error Close() SetMockJournalLimitSize(limit uint64) }
Wal encapsulates functions required to update and load consensus state.
type WriterWrapper ¶
type WriterWrapper struct {
// contains filtered or unexported fields
}
WriterWrapper wrap the write file. it contains the actual file handle and memory bufio
func NewWriterWrapper ¶
func NewWriterWrapper(file *os.File, bufferLimitSize int) *WriterWrapper
NewWriterWrapper creates a new buffer writer to write data to file.
func (*WriterWrapper) Close ¶
func (w *WriterWrapper) Close() (err error)
Close tries to actual file handle.
func (*WriterWrapper) Flush ¶
func (w *WriterWrapper) Flush() (err error)
Flush tries to flush the data from memory bufio to actual file.
func (*WriterWrapper) FlushAndClose ¶
func (w *WriterWrapper) FlushAndClose() (err error)
FlushAndClose successive invoke function Flush and Close