-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
syntax = "proto3"; | ||
|
||
option java_package = "com.hedera.block.protos"; | ||
option java_outer_classname = "BlockStreamServiceGrpcProto"; | ||
|
||
service BlockStreamGrpc { | ||
rpc GetBlock(BlockRequest) returns (Block) {} | ||
} | ||
|
||
message Block { | ||
int64 id = 1; | ||
string value = 2; | ||
} | ||
|
||
message BlockResponse { | ||
int64 id = 1; | ||
} | ||
|
||
message BlockRequest { | ||
int64 id = 1; | ||
} |
37 changes: 37 additions & 0 deletions
37
server/src/main/java/com/hedera/block/server/BlockStreamService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.hedera.block.server; | ||
|
||
import com.google.protobuf.Descriptors; | ||
import com.hedera.block.protos.BlockStreamServiceGrpcProto; | ||
import io.grpc.stub.StreamObserver; | ||
import io.helidon.webserver.grpc.GrpcService; | ||
|
||
import java.util.logging.Logger; | ||
|
||
|
||
public class BlockStreamService implements GrpcService { | ||
|
||
private final Logger logger = Logger.getLogger(getClass().getName()); | ||
|
||
@Override | ||
public Descriptors.FileDescriptor proto() { | ||
return BlockStreamServiceGrpcProto.getDescriptor(); | ||
} | ||
|
||
@Override | ||
public String serviceName() { | ||
return "BlockStreamGrpc"; | ||
} | ||
|
||
@Override | ||
public void update(Routing routing) { | ||
routing.unary("GetBlock", this::getBlock); | ||
} | ||
|
||
// @Override void invoke(ReqT request, StreamObserver<RespT> responseObserver); | ||
|
||
private void getBlock(BlockStreamServiceGrpcProto.BlockRequest request, StreamObserver<BlockStreamServiceGrpcProto.Block> responseObserver) { | ||
logger.info("GetBlock request received"); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters