mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-30 12:02:53 +00:00
* rpc: implement the ADR 075 /events method (#7965) This method implements the eventlog extension interface to expose ABCI metadata to the log for query processing. Only the types that have ABCI events need to implement this. - Add an event log to the environment - Add a sketch of the handler method - Add an /events RPCFunc to the route map - Implement query logic - Subscribe to pubsub if confingured, handle termination * add MatchesEvents test * add TODO due to backport sequence Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
This commit is contained in:
co-authored by
M. J. Fromberger
parent
069e402aa1
commit
d47b675cda
@@ -95,6 +95,13 @@ func (q *Query) Matches(events map[string][]string) (bool, error) {
|
||||
return q.matchesEvents(ExpandEvents(events)), nil
|
||||
}
|
||||
|
||||
func (q *Query) MatchesEvents(events []types.Event) (bool, error) {
|
||||
if q == nil {
|
||||
return true, nil
|
||||
}
|
||||
return q.matchesEvents(events), nil
|
||||
}
|
||||
|
||||
// String matches part of the pubsub.Query interface.
|
||||
func (q *Query) String() string {
|
||||
if q == nil {
|
||||
|
||||
@@ -332,6 +332,16 @@ func TestCompiledMatches(t *testing.T) {
|
||||
t.Errorf("Query: %#q\nInput: %+v\nMatches: got %v, want %v",
|
||||
tc.s, tc.events, got, tc.matches)
|
||||
}
|
||||
|
||||
got, err = c.MatchesEvents(query.ExpandEvents(tc.events))
|
||||
if err != nil {
|
||||
t.Errorf("Query: %#q\nInput: %+v\nMatches: got error %v",
|
||||
tc.s, tc.events, err)
|
||||
}
|
||||
if got != tc.matches {
|
||||
t.Errorf("Query: %#q\nInput: %+v\nMatches: got %v, want %v",
|
||||
tc.s, tc.events, got, tc.matches)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user