Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for PublishBlockStream to simulator #548

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

georgi-l95
Copy link
Contributor

Description:
This PR adds support for PublishBlockStream in the simulator, by introducing new wokring mode, called PublisherServerMode, where the application acts a server, which listents and awaits stream of block data. With the effort here I aim mainly to introduce the feature, where in future ones we will refine it, according to needs to be able to use it as testing driver.

Related issue(s):

Fixes #430

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
Signed-off-by: georgi-l95 <[email protected]>
@georgi-l95 georgi-l95 added the Simulator Issue related to Block Stream Simulator label Jan 28, 2025
@georgi-l95 georgi-l95 added this to the 0.4.0 milestone Jan 28, 2025
@georgi-l95 georgi-l95 self-assigned this Jan 28, 2025
@georgi-l95 georgi-l95 linked an issue Jan 28, 2025 that may be closed by this pull request
* tracks processed blocks, and maintains a history of stream statuses. It provides functionality
* to start, monitor, and shutdown the gRPC server.
*/
public class PublishStreamGrpcServerImpl implements PublishStreamGrpcServer {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All implementations could be unified under one interface, that means that we close the idea of starting couple of implementations under one instance. Which is okay, judging by the current and future needs.

* @param publishStreamRequest The incoming stream request to process
*/
@Override
public void onNext(PublishStreamRequest publishStreamRequest) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In future PRs we will add handlers here to respond, depending on predefined configuration or depending on controller (don't exist yet). For now we have only one handler, which returns block ack.

@@ -148,8 +134,10 @@ public void stop() throws InterruptedException {
public StreamStatus getStreamStatus() {
return StreamStatus.builder()
.publishedBlocks(publishStreamGrpcClient.getPublishedBlocks())
.processedBlocks(publishStreamGrpcServer.getProcessedBlocks())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If all grpc implementations are unifed under one interface, this could be improved and reduced.

@georgi-l95 georgi-l95 marked this pull request as ready for review January 28, 2025 13:54
@georgi-l95 georgi-l95 requested a review from a team as a code owner January 28, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Simulator Issue related to Block Stream Simulator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for PublishBlockStream to simulator
1 participant