Skip to content

rpc: implement the ADR 075 /events method#7965

Merged
creachadair merged 3 commits intomasterfrom
mjf/adr075-service
Feb 23, 2022
Merged

rpc: implement the ADR 075 /events method#7965
creachadair merged 3 commits intomasterfrom
mjf/adr075-service

Conversation

@creachadair
Copy link

This change implements the new method on the RPC environment, and adds data types for the parameters and results of that method.

It also updates the event data types that have ABCI events to expose them to the event log.

@creachadair creachadair marked this pull request as ready for review February 22, 2022 15:24
@creachadair creachadair force-pushed the mjf/adr075-service branch 2 times, most recently from c84cfa3 to 9ba6ec9 Compare February 22, 2022 18:37
@creachadair creachadair force-pushed the mjf/adr075-service branch 4 times, most recently from 7b79f8f to bb3200a Compare February 23, 2022 19:07
// and we want to keep waiting until we have relevant results (or time out).
cur := after
for len(items) == 0 {
info, err = env.EventLog.WaitScan(ctx, cur, accept)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q about this implementation: does WaitScan allow the full ctx to elapse or does it scan the list as soon as items are available? A client may have listed that they are willing to wait a long time for items and want a lot of items. If such a client arrives at an empty list that then has 1 item appended followed by a ton of items, I think they will just get the 1 item back, which feels a little off since they are still willing to wait for the entire waitTime for their items.

Copy link
Author

@creachadair creachadair Feb 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returns as soon as it has something. That's how it's defined in the ADR but it wouldn't be hard to change it to keep trying.

I think we probably want to return eagerly though:
A client who's waiting has already found no matches, so they're right at the head of the log. Do they want to wait for more items or have the new data ASAP? We can't know, but if they want "more" they can easily call again (and probably reuse the same HTTP connection).

By contrast if they DIDN'T want to wait, they have to kinda tune their timeout carefully and will wind up polling rapidly just to avoid stalling.

So my intuition is that eager is better, but it isn't much work to change it if there's a good case for waiting.

M. J. Fromberger added 3 commits February 23, 2022 14:54
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
@creachadair creachadair merged commit 5662bd1 into master Feb 23, 2022
@creachadair creachadair deleted the mjf/adr075-service branch February 23, 2022 23:22
mmsqe pushed a commit to mmsqe/tendermint that referenced this pull request Aug 29, 2022
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
mmsqe pushed a commit to mmsqe/tendermint that referenced this pull request Aug 30, 2022
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
mmsqe pushed a commit to mmsqe/tendermint that referenced this pull request Aug 30, 2022
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
mmsqe pushed a commit to mmsqe/tendermint that referenced this pull request Aug 30, 2022
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
mmsqe pushed a commit to mmsqe/tendermint that referenced this pull request Sep 28, 2022
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
mmsqe pushed a commit to mmsqe/tendermint that referenced this pull request Sep 28, 2022
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
sergio-mena pushed a commit that referenced this pull request Oct 4, 2022
* 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>
mmsqe added a commit to mmsqe/tendermint that referenced this pull request Dec 9, 2022
…dermint#9497)

* rpc: implement the ADR 075 /events method (tendermint#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>
mmsqe added a commit to mmsqe/tendermint that referenced this pull request Dec 9, 2022
…dermint#9497)

* rpc: implement the ADR 075 /events method (tendermint#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants