pubsub: Refactor Event Subscription (#6634)

This commit is contained in:
Aleksandr Bezobchuk
2021-07-01 11:17:48 -04:00
committed by GitHub
parent b0a413eb17
commit 414130aee1
19 changed files with 428 additions and 226 deletions
+4 -3
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/google/uuid"
"github.com/tendermint/tendermint/abci/types"
tmsync "github.com/tendermint/tendermint/internal/libs/sync"
)
@@ -89,10 +90,10 @@ func (s *Subscription) cancel(err error) {
type Message struct {
subID string
data interface{}
events map[string][]string
events []types.Event
}
func NewMessage(subID string, data interface{}, events map[string][]string) Message {
func NewMessage(subID string, data interface{}, events []types.Event) Message {
return Message{
subID: subID,
data: data,
@@ -108,4 +109,4 @@ func (msg Message) SubscriptionID() string { return msg.subID }
func (msg Message) Data() interface{} { return msg.data }
// Events returns events, which matched the client's query.
func (msg Message) Events() map[string][]string { return msg.events }
func (msg Message) Events() []types.Event { return msg.events }