Skip to content

Commit

Permalink
Addressing issues with Builds and PR review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: a-saksena <[email protected]>
  • Loading branch information
a-saksena committed Jul 24, 2024
1 parent eaec07d commit 59b1f6e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
13 changes: 13 additions & 0 deletions protos/src/main/protobuf/blockstream.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -153,6 +153,7 @@ private void getBlock(BlockStreamServiceGrpcProto.Block block, StreamObserver<Bl
.withDescription("DID NOT FIND YOUR BLOCK")
.asRuntimeException()
);
// Keeping below comments for the fix needed above.
// complete(responseObserver, BlockStreamServiceGrpcProto.Block.getDefaultInstance());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ private Constants() {}
public static final String SERVICE_NAME = "BlockStreamGrpc";
public static final String CLIENT_STREAMING_METHOD_NAME = "StreamSink";
public static final String SERVER_STREAMING_METHOD_NAME = "StreamSource";
public static final String GET_BLOCK_METHOD_NAME = "GetBlock";
}
6 changes: 3 additions & 3 deletions server/src/main/java/com/hedera/block/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static void main(final String[] args) {
// Initialize the block storage, cache, and service
final BlockStorage<BlockStreamServiceGrpcProto.Block> 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));
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions server/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 59b1f6e

Please sign in to comment.