From 32f2afbf34b9316094ded907e02e16c311119279 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 29 May 2021 18:11:21 +0300 Subject: restate problem Sponsored-by: author --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/README.md b/README.md index a2aed58..4c0dfc6 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,83 @@ This is the work sample for my job application for a developer position for OSO. + +## Re-statement of problem + +To clarify the problem for myself, I am re-stating it. This will also +work to make sure I've understood it in the intended way when we +discuss this. + +The goal is to write a server, which communicates with a client using +messages over HTTP. The client has a list of integers, and the asks +the server to figure out what is the largest integer in the list. The +crux is that the client does not send the server the whole list, but +only small messages and the server needs to, effectively, ask the +client to do pairwise comparisons of integers. + +The possible messages sent by the client and the server are listed +below, as examples. Communication is started by client by a "start +computation" message. Server responds with a suitable message, which +causes the client to make a new HTTP request with the response to the +server's message. This continues until the server sends a message +with result it has come up with. + +## Client request: start computation + +~~~json +{ + "type": "compute_max", + "length": 2 +} +~~~ + +## Server response: request computation + +~~~json +{ + "type": "compare", + "left": 0, + "right": 1, + "request_id": 7 +} +~~~ + +## Client request: computation result + +~~~json +{ + "type": "comp_result", + "answer": true, + "request_id": 7 +} +~~~ + +## Server response: result + +~~~json +{ + "type": "one", + "result": 2 +} +~~~ + +# Example + +~~~plantuml +@startuml + +Alice -> Bob: Authentication Request +Bob --> Alice: Authentication Response + +Alice -> Bob: Another authentication Request + +@enduml +~~~ + + +--- +title: OSO work sample +author: Lars Wirzenius +classes: +- json +... -- cgit v1.2.1