mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-03 06:37:14 +00:00
statesync/event: emit statesync start/end event (#6700)
This commit is contained in:
@@ -157,6 +157,10 @@ func (b *EventBus) PublishEventFastSyncStatus(data EventDataFastSyncStatus) erro
|
||||
return b.Publish(EventFastSyncStatusValue, data)
|
||||
}
|
||||
|
||||
func (b *EventBus) PublishEventStateSyncStatus(data EventDataStateSyncStatus) error {
|
||||
return b.Publish(EventStateSyncStatusValue, data)
|
||||
}
|
||||
|
||||
// PublishEventTx publishes tx event with events from Result. Note it will add
|
||||
// predefined keys (EventTypeKey, TxHashKey). Existing events with the same keys
|
||||
// will be overwritten.
|
||||
@@ -316,3 +320,7 @@ func (NopEventBus) PublishEventValidatorSetUpdates(data EventDataValidatorSetUpd
|
||||
func (NopEventBus) PublishEventFastSyncStatus(data EventDataFastSyncStatus) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (NopEventBus) PublishEventStateSyncStatus(data EventDataStateSyncStatus) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -372,6 +372,8 @@ func TestEventBusPublish(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
err = eventBus.PublishEventFastSyncStatus(EventDataFastSyncStatus{})
|
||||
require.NoError(t, err)
|
||||
err = eventBus.PublishEventStateSyncStatus(EventDataStateSyncStatus{})
|
||||
require.NoError(t, err)
|
||||
|
||||
select {
|
||||
case <-done:
|
||||
@@ -479,6 +481,7 @@ var events = []string{
|
||||
EventTimeoutWaitValue,
|
||||
EventVoteValue,
|
||||
EventFastSyncStatusValue,
|
||||
EventStateSyncStatusValue,
|
||||
}
|
||||
|
||||
func randEventValue() string {
|
||||
|
||||
+21
-11
@@ -29,17 +29,18 @@ const (
|
||||
EventCompleteProposalValue = "CompleteProposal"
|
||||
// The FastSyncStatus event will be emitted when the node switching
|
||||
// state sync mechanism between the consensus reactor and the fastsync reactor.
|
||||
EventFastSyncStatusValue = "FastSyncStatus"
|
||||
EventLockValue = "Lock"
|
||||
EventNewRoundValue = "NewRound"
|
||||
EventNewRoundStepValue = "NewRoundStep"
|
||||
EventPolkaValue = "Polka"
|
||||
EventRelockValue = "Relock"
|
||||
EventTimeoutProposeValue = "TimeoutPropose"
|
||||
EventTimeoutWaitValue = "TimeoutWait"
|
||||
EventUnlockValue = "Unlock"
|
||||
EventValidBlockValue = "ValidBlock"
|
||||
EventVoteValue = "Vote"
|
||||
EventFastSyncStatusValue = "FastSyncStatus"
|
||||
EventLockValue = "Lock"
|
||||
EventNewRoundValue = "NewRound"
|
||||
EventNewRoundStepValue = "NewRoundStep"
|
||||
EventPolkaValue = "Polka"
|
||||
EventRelockValue = "Relock"
|
||||
EventStateSyncStatusValue = "StateSyncStatus"
|
||||
EventTimeoutProposeValue = "TimeoutPropose"
|
||||
EventTimeoutWaitValue = "TimeoutWait"
|
||||
EventUnlockValue = "Unlock"
|
||||
EventValidBlockValue = "ValidBlock"
|
||||
EventVoteValue = "Vote"
|
||||
)
|
||||
|
||||
// Pre-populated ABCI Tendermint-reserved events
|
||||
@@ -104,6 +105,7 @@ func init() {
|
||||
tmjson.RegisterType(EventDataValidatorSetUpdates{}, "tendermint/event/ValidatorSetUpdates")
|
||||
tmjson.RegisterType(EventDataString(""), "tendermint/event/ProposalString")
|
||||
tmjson.RegisterType(EventDataFastSyncStatus{}, "tendermint/event/FastSyncStatus")
|
||||
tmjson.RegisterType(EventDataStateSyncStatus{}, "tendermint/event/StateSyncStatus")
|
||||
}
|
||||
|
||||
// Most event messages are basic types (a block, a transaction)
|
||||
@@ -181,6 +183,13 @@ type EventDataFastSyncStatus struct {
|
||||
Height int64 `json:"height"`
|
||||
}
|
||||
|
||||
// EventDataStateSyncStatus shows the statesync status and the
|
||||
// height when the node state sync mechanism changes.
|
||||
type EventDataStateSyncStatus struct {
|
||||
Complete bool `json:"complete"`
|
||||
Height int64 `json:"height"`
|
||||
}
|
||||
|
||||
// PUBSUB
|
||||
|
||||
const (
|
||||
@@ -219,6 +228,7 @@ var (
|
||||
EventQueryValidBlock = QueryForEvent(EventValidBlockValue)
|
||||
EventQueryVote = QueryForEvent(EventVoteValue)
|
||||
EventQueryFastSyncStatus = QueryForEvent(EventFastSyncStatusValue)
|
||||
EventQueryStateSyncStatus = QueryForEvent(EventStateSyncStatusValue)
|
||||
)
|
||||
|
||||
func EventQueryTxFor(tx Tx) tmpubsub.Query {
|
||||
|
||||
Reference in New Issue
Block a user