Documentation ¶
Index ¶
- Constants
- Variables
- func CompareHRS(h1 int64, r1 int, s1 cstypes.RoundStepType, h2 int64, r2 int, ...) int
- func IsDataCorruptionError(err error) bool
- func NewWAL(walFile string) (*baseWAL, error)
- func RegisterConsensusMessages(cdc *amino.Codec)
- func RegisterWALMessages(cdc *amino.Codec)
- func RunReplayFile(config cfg.BaseConfig, csConfig *cfg.ConsensusConfig, console bool)
- func WALWithNBlocks(numBlocks int) (data []byte, err error)
- type BlockPartMessage
- type CSOption
- type CommitStepMessage
- type ConsensusMessage
- type ConsensusReactor
- func (conR *ConsensusReactor) AddPeer(peer p2p.Peer)
- func (conR *ConsensusReactor) FastSync() bool
- func (conR *ConsensusReactor) GetChannels() []*p2p.ChannelDescriptor
- func (conR *ConsensusReactor) OnStart() error
- func (conR *ConsensusReactor) OnStop()
- func (conR *ConsensusReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
- func (conR *ConsensusReactor) RemovePeer(peer p2p.Peer, reason interface{})
- func (conR *ConsensusReactor) SetEventBus(b *types.EventBus)
- func (conR *ConsensusReactor) String() string
- func (conR *ConsensusReactor) StringIndented(indent string) string
- func (conR *ConsensusReactor) SwitchToConsensus(state sm.State, blocksSynced int)
- type ConsensusState
- func (cs *ConsensusState) AddProposalBlockPart(height int64, round int, part *types.Part, peerID p2p.ID) error
- func (cs *ConsensusState) AddVote(vote *types.Vote, peerID p2p.ID) (added bool, err error)
- func (cs *ConsensusState) GetRoundState() *cstypes.RoundState
- func (cs *ConsensusState) GetRoundStateJSON() ([]byte, error)
- func (cs *ConsensusState) GetRoundStateSimpleJSON() ([]byte, error)
- func (cs *ConsensusState) GetState() sm.State
- func (cs *ConsensusState) GetValidators() (int64, []*types.Validator)
- func (cs *ConsensusState) LoadCommit(height int64) *types.Commit
- func (cs *ConsensusState) OnStart() error
- func (cs *ConsensusState) OnStop()
- func (cs *ConsensusState) OpenWAL(walFile string) (WAL, error)
- func (cs *ConsensusState) ReplayFile(file string, console bool) error
- func (cs *ConsensusState) SetEventBus(b *types.EventBus)
- func (cs *ConsensusState) SetLogger(l log.Logger)
- func (cs *ConsensusState) SetPrivValidator(priv types.PrivValidator)
- func (cs *ConsensusState) SetProposal(proposal *types.Proposal, peerID p2p.ID) error
- func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *types.Block, parts *types.PartSet, ...) error
- func (cs *ConsensusState) SetTimeoutTicker(timeoutTicker TimeoutTicker)
- func (cs *ConsensusState) String() string
- func (cs *ConsensusState) Wait()
- type DataCorruptionError
- type EndHeightMessage
- type Handshaker
- type HasVoteMessage
- type Metrics
- type NewRoundStepMessage
- type PeerState
- func (ps *PeerState) ApplyCommitStepMessage(msg *CommitStepMessage)
- func (ps *PeerState) ApplyHasVoteMessage(msg *HasVoteMessage)
- func (ps *PeerState) ApplyNewRoundStepMessage(msg *NewRoundStepMessage)
- func (ps *PeerState) ApplyProposalPOLMessage(msg *ProposalPOLMessage)
- func (ps *PeerState) ApplyVoteSetBitsMessage(msg *VoteSetBitsMessage, ourVotes *cmn.BitArray)
- func (ps *PeerState) BlockPartsSent() int
- func (ps *PeerState) EnsureVoteBitArrays(height int64, numValidators int)
- func (ps *PeerState) GetHeight() int64
- func (ps *PeerState) GetRoundState() *cstypes.PeerRoundState
- func (ps *PeerState) InitProposalBlockParts(partsHeader types.PartSetHeader)
- func (ps *PeerState) PickSendVote(votes types.VoteSetReader) bool
- func (ps *PeerState) PickVoteToSend(votes types.VoteSetReader) (vote *types.Vote, ok bool)
- func (ps *PeerState) RecordBlockPart(bp *BlockPartMessage) int
- func (ps *PeerState) RecordVote(vote *types.Vote) int
- func (ps *PeerState) SetHasProposal(proposal *types.Proposal)
- func (ps *PeerState) SetHasProposalBlockPart(height int64, round int, index int)
- func (ps *PeerState) SetHasVote(vote *types.Vote)
- func (ps *PeerState) SetLogger(logger log.Logger) *PeerState
- func (ps *PeerState) String() string
- func (ps *PeerState) StringIndented(indent string) string
- func (ps *PeerState) ToJSON() ([]byte, error)
- func (ps *PeerState) VotesSent() int
- type ProposalHeartbeatMessage
- type ProposalMessage
- type ProposalPOLMessage
- type TimedWALMessage
- type TimeoutTicker
- type VoteMessage
- type VoteSetBitsMessage
- type VoteSetMaj23Message
- type WAL
- type WALDecoder
- type WALEncoder
- type WALMessage
- type WALSearchOptions
Constants ¶
const ( StateChannel = byte(0x20) DataChannel = byte(0x21) VoteChannel = byte(0x22) VoteSetBitsChannel = byte(0x23) )
Variables ¶
var ( ErrPeerStateHeightRegression = errors.New("Error peer state height regression") ErrPeerStateInvalidStartTime = errors.New("Error peer state invalid startTime") )
var ( ErrInvalidProposalSignature = errors.New("Error invalid proposal signature") ErrInvalidProposalPOLRound = errors.New("Error invalid proposal POL round") ErrAddingVote = errors.New("Error adding vote") ErrVoteHeightMismatch = errors.New("Error vote height mismatch") )
var Major = "0" //
var Minor = "2" // replay refactor
var Revision = "2" // validation -> commit
var Spec = "1" // async
kind of arbitrary
Functions ¶
func CompareHRS ¶
func CompareHRS(h1 int64, r1 int, s1 cstypes.RoundStepType, h2 int64, r2 int, s2 cstypes.RoundStepType) int
func IsDataCorruptionError ¶
IsDataCorruptionError returns true if data has been corrupted inside WAL.
func RegisterWALMessages ¶
func RunReplayFile ¶
func RunReplayFile(config cfg.BaseConfig, csConfig *cfg.ConsensusConfig, console bool)
replay the wal file
func WALWithNBlocks ¶
WALWithNBlocks generates a consensus WAL. It does this by spining up a stripped down version of node (proxy app, event bus, consensus state) with a persistent kvstore application and special consensus wal instance (byteBufferWAL) and waits until numBlocks are created. Then it returns a WAL content. If the node fails to produce given numBlocks, it returns an error.
Types ¶
type BlockPartMessage ¶
BlockPartMessage is sent when gossipping a piece of the proposed block.
func (*BlockPartMessage) String ¶
func (m *BlockPartMessage) String() string
String returns a string representation.
type CSOption ¶ added in v0.22.0
type CSOption func(*ConsensusState)
CSOption sets an optional parameter on the ConsensusState.
func WithMetrics ¶ added in v0.22.0
WithMetrics sets the metrics.
type CommitStepMessage ¶ added in v0.7.0
type CommitStepMessage struct { Height int64 BlockPartsHeader types.PartSetHeader BlockParts *cmn.BitArray }
CommitStepMessage is sent when a block is committed.
func (*CommitStepMessage) String ¶ added in v0.7.0
func (m *CommitStepMessage) String() string
String returns a string representation.
type ConsensusMessage ¶
type ConsensusMessage interface{}
ConsensusMessage is a message that can be sent and received on the ConsensusReactor
type ConsensusReactor ¶
type ConsensusReactor struct { p2p.BaseReactor // BaseService + p2p.Switch // contains filtered or unexported fields }
ConsensusReactor defines a reactor for the consensus service.
func NewConsensusReactor ¶
func NewConsensusReactor(consensusState *ConsensusState, fastSync bool) *ConsensusReactor
NewConsensusReactor returns a new ConsensusReactor with the given consensusState.
func (*ConsensusReactor) AddPeer ¶
func (conR *ConsensusReactor) AddPeer(peer p2p.Peer)
AddPeer implements Reactor
func (*ConsensusReactor) FastSync ¶
func (conR *ConsensusReactor) FastSync() bool
FastSync returns whether the consensus reactor is in fast-sync mode.
func (*ConsensusReactor) GetChannels ¶
func (conR *ConsensusReactor) GetChannels() []*p2p.ChannelDescriptor
GetChannels implements Reactor
func (*ConsensusReactor) OnStart ¶
func (conR *ConsensusReactor) OnStart() error
OnStart implements BaseService by subscribing to events, which later will be broadcasted to other peers and starting state if we're not in fast sync.
func (*ConsensusReactor) OnStop ¶
func (conR *ConsensusReactor) OnStop()
OnStop implements BaseService by unsubscribing from events and stopping state.
func (*ConsensusReactor) Receive ¶
func (conR *ConsensusReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
Receive implements Reactor NOTE: We process these messages even when we're fast_syncing. Messages affect either a peer state or the consensus state. Peer state updates can happen in parallel, but processing of proposals, block parts, and votes are ordered by the receiveRoutine NOTE: blocks on consensus state for proposals, block parts, and votes
func (*ConsensusReactor) RemovePeer ¶
func (conR *ConsensusReactor) RemovePeer(peer p2p.Peer, reason interface{})
RemovePeer implements Reactor
func (*ConsensusReactor) SetEventBus ¶
func (conR *ConsensusReactor) SetEventBus(b *types.EventBus)
SetEventBus sets event bus.
func (*ConsensusReactor) String ¶
func (conR *ConsensusReactor) String() string
String returns a string representation of the ConsensusReactor. NOTE: For now, it is just a hard-coded string to avoid accessing unprotected shared variables. TODO: improve!
func (*ConsensusReactor) StringIndented ¶
func (conR *ConsensusReactor) StringIndented(indent string) string
StringIndented returns an indented string representation of the ConsensusReactor
func (*ConsensusReactor) SwitchToConsensus ¶
func (conR *ConsensusReactor) SwitchToConsensus(state sm.State, blocksSynced int)
SwitchToConsensus switches from fast_sync mode to consensus mode. It resets the state, turns off fast_sync, and starts the consensus state-machine
type ConsensusState ¶
type ConsensusState struct { cmn.BaseService cstypes.RoundState // contains filtered or unexported fields }
ConsensusState handles execution of the consensus algorithm. It processes votes and proposals, and upon reaching agreement, commits blocks to the chain and executes them against the application. The internal state machine receives input from peers, the internal validator, and from a timer.
func NewConsensusState ¶
func NewConsensusState( config *cfg.ConsensusConfig, state sm.State, blockExec *sm.BlockExecutor, blockStore sm.BlockStore, mempool sm.Mempool, evpool sm.EvidencePool, options ...CSOption, ) *ConsensusState
NewConsensusState returns a new ConsensusState.
func (*ConsensusState) AddProposalBlockPart ¶
func (cs *ConsensusState) AddProposalBlockPart(height int64, round int, part *types.Part, peerID p2p.ID) error
AddProposalBlockPart inputs a part of the proposal block.
func (*ConsensusState) GetRoundState ¶
func (cs *ConsensusState) GetRoundState() *cstypes.RoundState
GetRoundState returns a shallow copy of the internal consensus state.
func (*ConsensusState) GetRoundStateJSON ¶
func (cs *ConsensusState) GetRoundStateJSON() ([]byte, error)
GetRoundStateJSON returns a json of RoundState, marshalled using go-amino.
func (*ConsensusState) GetRoundStateSimpleJSON ¶
func (cs *ConsensusState) GetRoundStateSimpleJSON() ([]byte, error)
GetRoundStateSimpleJSON returns a json of RoundStateSimple, marshalled using go-amino.
func (*ConsensusState) GetState ¶
func (cs *ConsensusState) GetState() sm.State
GetState returns a copy of the chain state.
func (*ConsensusState) GetValidators ¶
func (cs *ConsensusState) GetValidators() (int64, []*types.Validator)
GetValidators returns a copy of the current validators.
func (*ConsensusState) LoadCommit ¶
func (cs *ConsensusState) LoadCommit(height int64) *types.Commit
LoadCommit loads the commit for a given height.
func (*ConsensusState) OnStart ¶
func (cs *ConsensusState) OnStart() error
OnStart implements cmn.Service. It loads the latest state via the WAL, and starts the timeout and receive routines.
func (*ConsensusState) OnStop ¶
func (cs *ConsensusState) OnStop()
OnStop implements cmn.Service. It stops all routines and waits for the WAL to finish.
func (*ConsensusState) OpenWAL ¶
func (cs *ConsensusState) OpenWAL(walFile string) (WAL, error)
OpenWAL opens a file to log all consensus messages and timeouts for deterministic accountability
func (*ConsensusState) ReplayFile ¶
func (cs *ConsensusState) ReplayFile(file string, console bool) error
Replay msgs in file or start the console
func (*ConsensusState) SetEventBus ¶
func (cs *ConsensusState) SetEventBus(b *types.EventBus)
SetEventBus sets event bus.
func (*ConsensusState) SetLogger ¶
func (cs *ConsensusState) SetLogger(l log.Logger)
SetLogger implements Service.
func (*ConsensusState) SetPrivValidator ¶
func (cs *ConsensusState) SetPrivValidator(priv types.PrivValidator)
SetPrivValidator sets the private validator account for signing votes.
func (*ConsensusState) SetProposal ¶
SetProposal inputs a proposal.
func (*ConsensusState) SetProposalAndBlock ¶
func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *types.Block, parts *types.PartSet, peerID p2p.ID) error
SetProposalAndBlock inputs the proposal and all block parts.
func (*ConsensusState) SetTimeoutTicker ¶
func (cs *ConsensusState) SetTimeoutTicker(timeoutTicker TimeoutTicker)
SetTimeoutTicker sets the local timer. It may be useful to overwrite for testing.
func (*ConsensusState) Wait ¶
func (cs *ConsensusState) Wait()
Wait waits for the the main routine to return. NOTE: be sure to Stop() the event switch and drain any event channels or this may deadlock
type DataCorruptionError ¶
type DataCorruptionError struct {
// contains filtered or unexported fields
}
DataCorruptionError is an error that occures if data on disk was corrupted.
func (DataCorruptionError) Cause ¶
func (e DataCorruptionError) Cause() error
func (DataCorruptionError) Error ¶
func (e DataCorruptionError) Error() string
type EndHeightMessage ¶
type EndHeightMessage struct {
Height int64 `json:"height"`
}
EndHeightMessage marks the end of the given height inside WAL. @internal used by scripts/wal2json util.
type Handshaker ¶
type Handshaker struct {
// contains filtered or unexported fields
}
func NewHandshaker ¶
func NewHandshaker(stateDB dbm.DB, state sm.State, store sm.BlockStore, genDoc *types.GenesisDoc) *Handshaker
func (*Handshaker) Handshake ¶
func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error
TODO: retry the handshake/replay if it fails ?
func (*Handshaker) NBlocks ¶
func (h *Handshaker) NBlocks() int
func (*Handshaker) ReplayBlocks ¶
func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight int64, proxyApp proxy.AppConns) ([]byte, error)
Replay all blocks since appBlockHeight and ensure the result matches the current state. Returns the final AppHash or an error.
func (*Handshaker) SetLogger ¶
func (h *Handshaker) SetLogger(l log.Logger)
type HasVoteMessage ¶
HasVoteMessage is sent to indicate that a particular vote has been received.
func (*HasVoteMessage) String ¶
func (m *HasVoteMessage) String() string
String returns a string representation.
type Metrics ¶
type Metrics struct { // Height of the chain. Height metrics.Gauge // Number of rounds. Rounds metrics.Gauge // Number of validators. Validators metrics.Gauge // Total power of all validators. ValidatorsPower metrics.Gauge // Number of validators who did not sign. MissingValidators metrics.Gauge // Total power of the missing validators. MissingValidatorsPower metrics.Gauge // Number of validators who tried to double sign. ByzantineValidators metrics.Gauge // Total power of the byzantine validators. ByzantineValidatorsPower metrics.Gauge // Time between this and the last block. BlockIntervalSeconds metrics.Histogram // Number of transactions. NumTxs metrics.Gauge // Size of the block. BlockSizeBytes metrics.Gauge // Total number of transactions. TotalTxs metrics.Gauge }
Metrics contains metrics exposed by this package.
func PrometheusMetrics ¶
func PrometheusMetrics() *Metrics
PrometheusMetrics returns Metrics build using Prometheus client library.
type NewRoundStepMessage ¶
type NewRoundStepMessage struct { Height int64 Round int Step cstypes.RoundStepType SecondsSinceStartTime int LastCommitRound int }
NewRoundStepMessage is sent for every step taken in the ConsensusState. For every height/round/step transition
func (*NewRoundStepMessage) String ¶
func (m *NewRoundStepMessage) String() string
String returns a string representation.
type PeerState ¶
type PeerState struct { PRS cstypes.PeerRoundState `json:"round_state"` // Exposed. Stats *peerStateStats `json:"stats"` // Exposed. // contains filtered or unexported fields }
PeerState contains the known state of a peer, including its connection and threadsafe access to its PeerRoundState. NOTE: THIS GETS DUMPED WITH rpc/core/consensus.go. Be mindful of what you Expose.
func NewPeerState ¶
NewPeerState returns a new PeerState for the given Peer
func (*PeerState) ApplyCommitStepMessage ¶ added in v0.7.0
func (ps *PeerState) ApplyCommitStepMessage(msg *CommitStepMessage)
ApplyCommitStepMessage updates the peer state for the new commit.
func (*PeerState) ApplyHasVoteMessage ¶
func (ps *PeerState) ApplyHasVoteMessage(msg *HasVoteMessage)
ApplyHasVoteMessage updates the peer state for the new vote.
func (*PeerState) ApplyNewRoundStepMessage ¶
func (ps *PeerState) ApplyNewRoundStepMessage(msg *NewRoundStepMessage)
ApplyNewRoundStepMessage updates the peer state for the new round.
func (*PeerState) ApplyProposalPOLMessage ¶
func (ps *PeerState) ApplyProposalPOLMessage(msg *ProposalPOLMessage)
ApplyProposalPOLMessage updates the peer state for the new proposal POL.
func (*PeerState) ApplyVoteSetBitsMessage ¶
func (ps *PeerState) ApplyVoteSetBitsMessage(msg *VoteSetBitsMessage, ourVotes *cmn.BitArray)
ApplyVoteSetBitsMessage updates the peer state for the bit-array of votes it claims to have for the corresponding BlockID. `ourVotes` is a BitArray of votes we have for msg.BlockID NOTE: if ourVotes is nil (e.g. msg.Height < rs.Height), we conservatively overwrite ps's votes w/ msg.Votes.
func (*PeerState) BlockPartsSent ¶
BlockPartsSent returns the number of blocks for which peer has been sending us block parts.
func (*PeerState) EnsureVoteBitArrays ¶
EnsureVoteBitArrays ensures the bit-arrays have been allocated for tracking what votes this peer has received. NOTE: It's important to make sure that numValidators actually matches what the node sees as the number of validators for height.
func (*PeerState) GetHeight ¶
GetHeight returns an atomic snapshot of the PeerRoundState's height used by the mempool to ensure peers are caught up before broadcasting new txs
func (*PeerState) GetRoundState ¶
func (ps *PeerState) GetRoundState() *cstypes.PeerRoundState
GetRoundState returns an shallow copy of the PeerRoundState. There's no point in mutating it since it won't change PeerState.
func (*PeerState) InitProposalBlockParts ¶
func (ps *PeerState) InitProposalBlockParts(partsHeader types.PartSetHeader)
InitProposalBlockParts initializes the peer's proposal block parts header and bit array.
func (*PeerState) PickSendVote ¶
func (ps *PeerState) PickSendVote(votes types.VoteSetReader) bool
PickSendVote picks a vote and sends it to the peer. Returns true if vote was sent.
func (*PeerState) PickVoteToSend ¶
PickVoteToSend picks a vote to send to the peer. Returns true if a vote was picked. NOTE: `votes` must be the correct Size() for the Height().
func (*PeerState) RecordBlockPart ¶
func (ps *PeerState) RecordBlockPart(bp *BlockPartMessage) int
RecordBlockPart updates internal statistics for this peer by recording the block part. It returns the total number of block parts (1 per block). This essentially means the number of blocks for which peer has been sending us block parts.
func (*PeerState) RecordVote ¶
RecordVote updates internal statistics for this peer by recording the vote. It returns the total number of votes (1 per block). This essentially means the number of blocks for which peer has been sending us votes.
func (*PeerState) SetHasProposal ¶
SetHasProposal sets the given proposal as known for the peer.
func (*PeerState) SetHasProposalBlockPart ¶
SetHasProposalBlockPart sets the given block part index as known for the peer.
func (*PeerState) SetHasVote ¶
SetHasVote sets the given vote as known by the peer
func (*PeerState) SetLogger ¶
SetLogger allows to set a logger on the peer state. Returns the peer state itself.
func (*PeerState) StringIndented ¶
StringIndented returns a string representation of the PeerState
type ProposalHeartbeatMessage ¶ added in v0.10.3
ProposalHeartbeatMessage is sent to signal that a node is alive and waiting for transactions for a proposal.
func (*ProposalHeartbeatMessage) String ¶ added in v0.10.3
func (m *ProposalHeartbeatMessage) String() string
String returns a string representation.
type ProposalMessage ¶
ProposalMessage is sent when a new block is proposed.
func (*ProposalMessage) String ¶
func (m *ProposalMessage) String() string
String returns a string representation.
type ProposalPOLMessage ¶
ProposalPOLMessage is sent when a previous proposal is re-proposed.
func (*ProposalPOLMessage) String ¶
func (m *ProposalPOLMessage) String() string
String returns a string representation.
type TimedWALMessage ¶
type TimedWALMessage struct { Time time.Time `json:"time"` // for debugging purposes Msg WALMessage `json:"msg"` }
type TimeoutTicker ¶
type TimeoutTicker interface { Start() error Stop() error Chan() <-chan timeoutInfo // on which to receive a timeout ScheduleTimeout(ti timeoutInfo) // reset the timer SetLogger(log.Logger) }
TimeoutTicker is a timer that schedules timeouts conditional on the height/round/step in the timeoutInfo. The timeoutInfo.Duration may be non-positive.
func NewTimeoutTicker ¶
func NewTimeoutTicker() TimeoutTicker
NewTimeoutTicker returns a new TimeoutTicker.
type VoteMessage ¶
VoteMessage is sent when voting for a proposal (or lack thereof).
func (*VoteMessage) String ¶
func (m *VoteMessage) String() string
String returns a string representation.
type VoteSetBitsMessage ¶
type VoteSetBitsMessage struct { Height int64 Round int Type byte BlockID types.BlockID Votes *cmn.BitArray }
VoteSetBitsMessage is sent to communicate the bit-array of votes seen for the BlockID.
func (*VoteSetBitsMessage) String ¶
func (m *VoteSetBitsMessage) String() string
String returns a string representation.
type VoteSetMaj23Message ¶
VoteSetMaj23Message is sent to indicate that a given BlockID has seen +2/3 votes.
func (*VoteSetMaj23Message) String ¶
func (m *VoteSetMaj23Message) String() string
String returns a string representation.
type WAL ¶
type WAL interface { Write(WALMessage) WriteSync(WALMessage) Group() *auto.Group SearchForEndHeight(height int64, options *WALSearchOptions) (gr *auto.GroupReader, found bool, err error) Start() error Stop() error Wait() }
WAL is an interface for any write-ahead logger.
type WALDecoder ¶
type WALDecoder struct {
// contains filtered or unexported fields
}
A WALDecoder reads and decodes custom-encoded WAL messages from an input stream. See WALEncoder for the format used.
It will also compare the checksums and make sure data size is equal to the length from the header. If that is not the case, error will be returned.
func NewWALDecoder ¶
func NewWALDecoder(rd io.Reader) *WALDecoder
NewWALDecoder returns a new decoder that reads from rd.
func (*WALDecoder) Decode ¶
func (dec *WALDecoder) Decode() (*TimedWALMessage, error)
Decode reads the next custom-encoded value from its reader and returns it.
type WALEncoder ¶
type WALEncoder struct {
// contains filtered or unexported fields
}
A WALEncoder writes custom-encoded WAL messages to an output stream.
Format: 4 bytes CRC sum + 4 bytes length + arbitrary-length value (go-amino encoded)
func NewWALEncoder ¶
func NewWALEncoder(wr io.Writer) *WALEncoder
NewWALEncoder returns a new encoder that writes to wr.
func (*WALEncoder) Encode ¶
func (enc *WALEncoder) Encode(v *TimedWALMessage) error
Encode writes the custom encoding of v to the stream.
type WALMessage ¶
type WALMessage interface{}
type WALSearchOptions ¶
type WALSearchOptions struct { // IgnoreDataCorruptionErrors set to true will result in skipping data corruption errors. IgnoreDataCorruptionErrors bool }
WALSearchOptions are optional arguments to SearchForEndHeight.