From 59b1f6e703af07ba45d2d17d9a3674740ab7291a Mon Sep 17 00:00:00 2001 From: a-saksena Date: Tue, 23 Jul 2024 17:34:46 -0700 Subject: [PATCH] Addressing issues with Builds and PR review comments. Signed-off-by: a-saksena --- protos/src/main/protobuf/blockstream.proto | 13 +++++++++++++ .../com/hedera/block/server/BlockStreamService.java | 3 ++- .../java/com/hedera/block/server/Constants.java | 1 + .../main/java/com/hedera/block/server/Server.java | 6 +++--- server/src/main/java/module-info.java | 1 + 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/protos/src/main/protobuf/blockstream.proto b/protos/src/main/protobuf/blockstream.proto index c148efda0..c1d7a425d 100644 --- a/protos/src/main/protobuf/blockstream.proto +++ b/protos/src/main/protobuf/blockstream.proto @@ -81,3 +81,16 @@ message BlockResponse { */ int64 id = 1; } + +/** + * A block request is a simple message that contains an id. + * This specification is a simple example meant to expedite development. + * It will be replaced with a PBJ implementation in the future. + */ +message BlockRequest { + /** + * The id of the block which was requested. Each block id should + * correlate with the id of a Block message id. + */ + int64 id = 1; +} diff --git a/server/src/main/java/com/hedera/block/server/BlockStreamService.java b/server/src/main/java/com/hedera/block/server/BlockStreamService.java index c84a24cf1..2e2511073 100644 --- a/server/src/main/java/com/hedera/block/server/BlockStreamService.java +++ b/server/src/main/java/com/hedera/block/server/BlockStreamService.java @@ -95,7 +95,7 @@ public String serviceName() { public void update(final Routing routing) { routing.bidi(CLIENT_STREAMING_METHOD_NAME, this::streamSink); routing.bidi(SERVER_STREAMING_METHOD_NAME, this::streamSource); - routing.unary("GetBlock", this::getBlock); + routing.unary(GET_BLOCK_METHOD_NAME, this::getBlock); } /** @@ -153,6 +153,7 @@ private void getBlock(BlockStreamServiceGrpcProto.Block block, StreamObserver blockStorage = new FileSystemBlockStorage(BLOCKNODE_STORAGE_ROOT_PATH_KEY, config); - // TODO: Make timeoutThresholdMillis configurable + // Initialize blockStreamService with Live Stream and Cache final BlockStreamService blockStreamService = new BlockStreamService(consumerTimeoutThreshold, new LiveStreamMediatorImpl(new WriteThroughCacheHandler(blockStorage)), new WriteThroughCacheHandler(blockStorage)); @@ -83,8 +83,8 @@ public static void main(final String[] args) { SERVER_STREAMING_METHOD_NAME, serverBidiStreamingMethod) .unary(BlockStreamServiceGrpcProto.getDescriptor(), - "BlockStreamGrpc", - "GetBlock", + SERVICE_NAME, + GET_BLOCK_METHOD_NAME, Server::grpcGetBlock)) .build() .start(); diff --git a/server/src/main/java/module-info.java b/server/src/main/java/module-info.java index c78fae8d4..97423831b 100644 --- a/server/src/main/java/module-info.java +++ b/server/src/main/java/module-info.java @@ -3,6 +3,7 @@ requires com.hedera.block.protos; requires com.google.protobuf; requires io.grpc.stub; + requires io.grpc; requires io.helidon.common; requires io.helidon.config; requires io.helidon.webserver.grpc;