mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-31 13:16:59 +00:00
Rename Tag(s) to Event(s) (#4046)
* Rename Tag(s) to Event(s) - tag was replaced with event, but in some places it still mentions tag, would be easier to understand if we tried to replace it with event to not confuse people. Signed-off-by: Marko Baricevic <marbar3778@yahoo.com> * more changes from tag -> event * rename events to compositeKeys and keys * Apply suggestions from code review Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com> * add minor documentation on how composite keys are constructed * rename eventkey to compositekey Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com> * add changelog entry & add info to regenerate confid to changelog entry
This commit is contained in:
+3
-3
@@ -164,8 +164,8 @@ func (b *EventBus) PublishEventValidBlock(data EventDataRoundState) error {
|
||||
return b.Publish(EventValidBlock, data)
|
||||
}
|
||||
|
||||
// PublishEventTx publishes tx event with tags from Result. Note it will add
|
||||
// predefined tags (EventTypeKey, TxHashKey). Existing tags with the same names
|
||||
// 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.
|
||||
func (b *EventBus) PublishEventTx(data EventDataTx) error {
|
||||
// no explicit deadline for publishing events
|
||||
@@ -173,7 +173,7 @@ func (b *EventBus) PublishEventTx(data EventDataTx) error {
|
||||
|
||||
events := b.validateAndStringifyEvents(data.Result.Events, b.Logger.With("tx", data.Tx))
|
||||
|
||||
// add predefined tags
|
||||
// add predefined compositeKeys
|
||||
events[EventTypeKey] = append(events[EventTypeKey], EventTx)
|
||||
events[TxHashKey] = append(events[TxHashKey], fmt.Sprintf("%X", data.Tx.Hash()))
|
||||
events[TxHeightKey] = append(events[TxHeightKey], fmt.Sprintf("%d", data.Height))
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestEventBusPublishEventTx(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
// PublishEventTx adds all these 3 tags, so the query below should work
|
||||
// PublishEventTx adds 3 composite keys, so the query below should work
|
||||
query := fmt.Sprintf("tm.event='Tx' AND tx.height=1 AND tx.hash='%X' AND testType.baz=1", tx.Hash())
|
||||
txsSub, err := eventBus.Subscribe(context.Background(), "test", tmquery.MustParse(query))
|
||||
require.NoError(t, err)
|
||||
@@ -78,7 +78,7 @@ func TestEventBusPublishEventNewBlock(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
// PublishEventNewBlock adds the tm.event tag, so the query below should work
|
||||
// PublishEventNewBlock adds the tm.event compositeKey, so the query below should work
|
||||
query := "tm.event='NewBlock' AND testType.baz=1 AND testType.foz=2"
|
||||
blocksSub, err := eventBus.Subscribe(context.Background(), "test", tmquery.MustParse(query))
|
||||
require.NoError(t, err)
|
||||
@@ -225,7 +225,7 @@ func TestEventBusPublishEventNewBlockHeader(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
// PublishEventNewBlockHeader adds the tm.event tag, so the query below should work
|
||||
// PublishEventNewBlockHeader adds the tm.event compositeKey, so the query below should work
|
||||
query := "tm.event='NewBlockHeader' AND testType.baz=1 AND testType.foz=2"
|
||||
headersSub, err := eventBus.Subscribe(context.Background(), "test", tmquery.MustParse(query))
|
||||
require.NoError(t, err)
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ type EventDataValidatorSetUpdates struct {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const (
|
||||
// EventTypeKey is a reserved key, used to specify event type in tags.
|
||||
// EventTypeKey is a reserved composite key for event name.
|
||||
EventTypeKey = "tm.event"
|
||||
// TxHashKey is a reserved key, used to specify transaction's hash.
|
||||
// see EventBus#PublishEventTx
|
||||
|
||||
Reference in New Issue
Block a user