Expand description
A gRPC server using tonic
to serve Aoc
answer requests.
§Protobuf
syntax = "proto3";
package aocrunner;
service AocRun {
rpc GetAnswer(Attributes) returns (Answer);
}
message Attributes {
uint32 year = 1;
uint32 day = 2;
optional string input = 3;
}
message Answer {
string part_one = 1;
string part_two = 2;
}
§Examples
Assuming Aocrun server is listening to localhost port 41470
. Using grpcurl
,
$ grpcurl -plaintext -import-path ./proto \
-proto aocrunner.proto \
-d '{"year": 2022, "day": 1, "input": "1000\\n2000\\n\\n1500\\n2500\\n4000"}' '[::1]:41470' \
aocrunner.AocRun/GetAnswer
The response received is
{
"partOne": "8000",
"partTwo": "11000"
}
Structs§
- Answer
- gRPC stub to destructure answer
- AocRun
Client - gRPC stub to create client.
- Attributes
- gRPC stub to create solve request
Functions§
- run
- Connect to AocData using AocDataClient, and start AocRun service to handle gRPC requests.