Hello grpcs,
I have the following task sent from client to server.
service applis {
rpc GenerateVoxelMesh(VoxelMeshRequest) returns (VoxelMeshReply) {}
}
message VoxelMeshRequest {
any image_input = 1;
bool smooth = 4;
int32 iterations = 5;
double mu = 6;
double lambda = 7;
double scale = 8;
repeat int32 part_ids = 9;
}
message VoxelMeshReply {
any nas_output = 1; // text file
}
The image_input, nas_output are the binary files that can be fairly large sometimes. I would guess the `any` is not a recommended type.
It is preferred to use stream chunk bytes to send and receive the image and nas files. However, if we stream chunk file, we can not send
the other request parameters at one call. We will have to make multiple calls and make server side a state machine. It increases the complexity.
I am just wondering if there any more element design or what the idiomatic way of doing this in grpc?
the possible design like below.
service applis {
rpc GenerateVoxelMesh(stream VoxelMeshRequest) returns (stream VoxelMeshReply) {}
}
message VoxelMeshRequest {
oneof test_oneof {
FileChunk image_input = 1;
VoxelMeshParamters mesh_params = 2;
}
}
message FileChunk {
bytes chunk = 1;
}
message VoxelMeshParameters {
bool smooth = 4;
int32 iterations = 5;
double mu = 6;
double lambda = 7;
double scale = 8;
repeat int32 part_ids = 9;
}
message VoxelMeshReply {
FileChunk nas_output = 1; // text file
}
Any suggestion will be appreciated.
Thanks in advance,
Weidong