Skip to content

Commit 59b1f6e

Browse files
committed
Addressing issues with Builds and PR review comments.
Signed-off-by: a-saksena <[email protected]>
1 parent eaec07d commit 59b1f6e

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

protos/src/main/protobuf/blockstream.proto

+13
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,16 @@ message BlockResponse {
8181
*/
8282
int64 id = 1;
8383
}
84+
85+
/**
86+
* A block request is a simple message that contains an id.
87+
* This specification is a simple example meant to expedite development.
88+
* It will be replaced with a PBJ implementation in the future.
89+
*/
90+
message BlockRequest {
91+
/**
92+
* The id of the block which was requested. Each block id should
93+
* correlate with the id of a Block message id.
94+
*/
95+
int64 id = 1;
96+
}

server/src/main/java/com/hedera/block/server/BlockStreamService.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public String serviceName() {
9595
public void update(final Routing routing) {
9696
routing.bidi(CLIENT_STREAMING_METHOD_NAME, this::streamSink);
9797
routing.bidi(SERVER_STREAMING_METHOD_NAME, this::streamSource);
98-
routing.unary("GetBlock", this::getBlock);
98+
routing.unary(GET_BLOCK_METHOD_NAME, this::getBlock);
9999
}
100100

101101
/**
@@ -153,6 +153,7 @@ private void getBlock(BlockStreamServiceGrpcProto.Block block, StreamObserver<Bl
153153
.withDescription("DID NOT FIND YOUR BLOCK")
154154
.asRuntimeException()
155155
);
156+
// Keeping below comments for the fix needed above.
156157
// complete(responseObserver, BlockStreamServiceGrpcProto.Block.getDefaultInstance());
157158
}
158159
}

server/src/main/java/com/hedera/block/server/Constants.java

+1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ private Constants() {}
3030
public static final String SERVICE_NAME = "BlockStreamGrpc";
3131
public static final String CLIENT_STREAMING_METHOD_NAME = "StreamSink";
3232
public static final String SERVER_STREAMING_METHOD_NAME = "StreamSource";
33+
public static final String GET_BLOCK_METHOD_NAME = "GetBlock";
3334
}

server/src/main/java/com/hedera/block/server/Server.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static void main(final String[] args) {
6464
// Initialize the block storage, cache, and service
6565
final BlockStorage<BlockStreamServiceGrpcProto.Block> blockStorage = new FileSystemBlockStorage(BLOCKNODE_STORAGE_ROOT_PATH_KEY, config);
6666

67-
// TODO: Make timeoutThresholdMillis configurable
67+
// Initialize blockStreamService with Live Stream and Cache
6868
final BlockStreamService blockStreamService = new BlockStreamService(consumerTimeoutThreshold,
6969
new LiveStreamMediatorImpl(new WriteThroughCacheHandler(blockStorage)),
7070
new WriteThroughCacheHandler(blockStorage));
@@ -83,8 +83,8 @@ public static void main(final String[] args) {
8383
SERVER_STREAMING_METHOD_NAME,
8484
serverBidiStreamingMethod)
8585
.unary(BlockStreamServiceGrpcProto.getDescriptor(),
86-
"BlockStreamGrpc",
87-
"GetBlock",
86+
SERVICE_NAME,
87+
GET_BLOCK_METHOD_NAME,
8888
Server::grpcGetBlock))
8989
.build()
9090
.start();

server/src/main/java/module-info.java

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
requires com.hedera.block.protos;
44
requires com.google.protobuf;
55
requires io.grpc.stub;
6+
requires io.grpc;
67
requires io.helidon.common;
78
requires io.helidon.config;
89
requires io.helidon.webserver.grpc;

0 commit comments

Comments
 (0)