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
This commit is contained in:
M. J. Fromberger
2022-02-23 15:22:40 -08:00
committed by GitHub
parent 61a81279bd
commit 5662bd12a8
7 changed files with 303 additions and 1 deletions
+14
View File
@@ -2,7 +2,10 @@ package proxy
import (
"context"
"errors"
"time"
"github.com/tendermint/tendermint/internal/eventlog/cursor"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
lrpc "github.com/tendermint/tendermint/light/rpc"
rpcclient "github.com/tendermint/tendermint/rpc/client"
@@ -27,6 +30,17 @@ func (p proxyService) GetConsensusState(ctx context.Context) (*coretypes.ResultC
return p.ConsensusState(ctx)
}
// TODO(creachadair): Remove this once the RPC clients support the new method.
// This is just a placeholder to let things build during development.
func (proxyService) Events(ctx context.Context,
filter *coretypes.EventFilter,
maxItems int,
before, after cursor.Cursor,
waitTime time.Duration,
) (*coretypes.ResultEvents, error) {
return nil, errors.New("the /events method is not implemented")
}
func (p proxyService) Subscribe(ctx context.Context, query string) (*coretypes.ResultSubscribe, error) {
return p.SubscribeWS(ctx, query)
}