mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-03 06:37:14 +00:00
make the rest of the code compile
This commit is contained in:
@@ -6,10 +6,10 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
"github.com/tendermint/tendermint/libs/pubsub"
|
||||
"github.com/tendermint/tendermint/libs/pubsub/query"
|
||||
"github.com/tendermint/tendermint/pkg/abci"
|
||||
)
|
||||
|
||||
func TestExample(t *testing.T) {
|
||||
|
||||
@@ -39,10 +39,10 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/tendermint/tendermint/abci/types"
|
||||
tmsync "github.com/tendermint/tendermint/internal/libs/sync"
|
||||
"github.com/tendermint/tendermint/libs/pubsub/query"
|
||||
"github.com/tendermint/tendermint/libs/service"
|
||||
"github.com/tendermint/tendermint/pkg/abci"
|
||||
)
|
||||
|
||||
type operation int
|
||||
@@ -71,7 +71,7 @@ var (
|
||||
// allows event types to repeat themselves with the same set of keys and
|
||||
// different values.
|
||||
type Query interface {
|
||||
Matches(events []types.Event) (bool, error)
|
||||
Matches(events []abci.Event) (bool, error)
|
||||
String() string
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ type cmd struct {
|
||||
|
||||
// publish
|
||||
msg interface{}
|
||||
events []types.Event
|
||||
events []abci.Event
|
||||
}
|
||||
|
||||
// Server allows clients to subscribe/unsubscribe for messages, publishing
|
||||
@@ -315,13 +315,13 @@ func (s *Server) NumClientSubscriptions(clientID string) int {
|
||||
// Publish publishes the given message. An error will be returned to the caller
|
||||
// if the context is canceled.
|
||||
func (s *Server) Publish(ctx context.Context, msg interface{}) error {
|
||||
return s.PublishWithEvents(ctx, msg, []types.Event{})
|
||||
return s.PublishWithEvents(ctx, msg, []abci.Event{})
|
||||
}
|
||||
|
||||
// PublishWithEvents publishes the given message with the set of events. The set
|
||||
// is matched with clients queries. If there is a match, the message is sent to
|
||||
// the client.
|
||||
func (s *Server) PublishWithEvents(ctx context.Context, msg interface{}, events []types.Event) error {
|
||||
func (s *Server) PublishWithEvents(ctx context.Context, msg interface{}, events []abci.Event) error {
|
||||
select {
|
||||
case s.cmds <- cmd{op: pub, msg: msg, events: events}:
|
||||
return nil
|
||||
@@ -474,7 +474,7 @@ func (state *state) removeAll(reason error) {
|
||||
}
|
||||
}
|
||||
|
||||
func (state *state) send(msg interface{}, events []types.Event) error {
|
||||
func (state *state) send(msg interface{}, events []abci.Event) error {
|
||||
for qStr, clientSubscriptions := range state.subscriptions {
|
||||
if sub, ok := clientSubscriptions[qStr]; ok && sub.id == qStr {
|
||||
continue
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
"github.com/tendermint/tendermint/pkg/abci"
|
||||
|
||||
"github.com/tendermint/tendermint/libs/pubsub"
|
||||
"github.com/tendermint/tendermint/libs/pubsub/query"
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package query
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tendermint/abci/types"
|
||||
)
|
||||
import "github.com/tendermint/tendermint/pkg/abci"
|
||||
|
||||
// Empty query matches any set of events.
|
||||
type Empty struct {
|
||||
}
|
||||
|
||||
// Matches always returns true.
|
||||
func (Empty) Matches(events []types.Event) (bool, error) {
|
||||
func (Empty) Matches(events []abci.Event) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/libs/pubsub/query"
|
||||
"github.com/tendermint/tendermint/pkg/abci"
|
||||
)
|
||||
|
||||
func TestEmptyQueryMatchesAnything(t *testing.T) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/pkg/abci"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -200,7 +200,7 @@ func (q *Query) Conditions() ([]Condition, error) {
|
||||
//
|
||||
// For example, query "name=John" matches events = {"name": ["John", "Eric"]}.
|
||||
// More examples could be found in parser_test.go and query_test.go.
|
||||
func (q *Query) Matches(rawEvents []types.Event) (bool, error) {
|
||||
func (q *Query) Matches(rawEvents []abci.Event) (bool, error) {
|
||||
if len(rawEvents) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
@@ -505,7 +505,7 @@ func matchValue(value string, op Operator, operand reflect.Value) (bool, error)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func flattenEvents(events []types.Event) map[string][]string {
|
||||
func flattenEvents(events []abci.Event) map[string][]string {
|
||||
flattened := make(map[string][]string)
|
||||
|
||||
for _, event := range events {
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/libs/pubsub/query"
|
||||
"github.com/tendermint/tendermint/pkg/abci"
|
||||
)
|
||||
|
||||
func expandEvents(flattenedEvents map[string][]string) []abci.Event {
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/tendermint/tendermint/abci/types"
|
||||
tmsync "github.com/tendermint/tendermint/internal/libs/sync"
|
||||
"github.com/tendermint/tendermint/pkg/abci"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -90,10 +90,10 @@ func (s *Subscription) cancel(err error) {
|
||||
type Message struct {
|
||||
subID string
|
||||
data interface{}
|
||||
events []types.Event
|
||||
events []abci.Event
|
||||
}
|
||||
|
||||
func NewMessage(subID string, data interface{}, events []types.Event) Message {
|
||||
func NewMessage(subID string, data interface{}, events []abci.Event) Message {
|
||||
return Message{
|
||||
subID: subID,
|
||||
data: data,
|
||||
@@ -109,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() []types.Event { return msg.events }
|
||||
func (msg Message) Events() []abci.Event { return msg.events }
|
||||
|
||||
Reference in New Issue
Block a user