scouting: Add support /requests/request/all_matches
This patch adds a new endpoint that accepts the `RequestAllMatches`
message. It simply returns the full list of matches that the database
knows about.
I decided to change public `int` members in the `db` module to `int32`
so they match the flatbuffer definition. This makes comparison
simpler.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I9bb2eed020e2889644f5a122105a232a68f2f4bd
diff --git a/scouting/webserver/requests/debug/cli/main.go b/scouting/webserver/requests/debug/cli/main.go
index ac24b25..204e541 100644
--- a/scouting/webserver/requests/debug/cli/main.go
+++ b/scouting/webserver/requests/debug/cli/main.go
@@ -50,9 +50,9 @@
// Execute the `flatc` command.
flatcCommand := exec.Command(absFlatcPath, "--binary", absFbsPath, jsonSymlink)
flatcCommand.Dir = dir
- err = flatcCommand.Run()
+ output, err := flatcCommand.CombinedOutput()
if err != nil {
- log.Fatal("Failed to execute flatc: ", err)
+ log.Fatal("Failed to execute flatc: ", err, ": ", string(output))
}
// Read the serialized flatbuffer and return it.
@@ -70,6 +70,8 @@
"The end point where the server is listening.")
submitDataScoutingPtr := flag.String("submitDataScouting", "",
"If specified, parse the file as a SubmitDataScouting JSON request.")
+ requestAllMatchesPtr := flag.String("requestAllMatches", "",
+ "If specified, parse the file as a RequestAllMatches JSON request.")
flag.Parse()
// Handle the actual arguments.
@@ -82,6 +84,17 @@
if err != nil {
log.Fatal("Failed SubmitDataScouting: ", err)
}
- log.Printf("%+v", response)
+ log.Printf("%+v", *response)
+ }
+ if *requestAllMatchesPtr != "" {
+ log.Printf("Sending RequestAllMatches to %s", *addressPtr)
+ binaryRequest := parseJson(
+ "scouting/webserver/requests/messages/request_all_matches.fbs",
+ *requestAllMatchesPtr)
+ response, err := debug.RequestAllMatches(*addressPtr, binaryRequest)
+ if err != nil {
+ log.Fatal("Failed RequestAllMatches: ", err)
+ }
+ log.Printf("%+v", *response)
}
}