summaryrefslogtreecommitdiff
path: root/README.md
blob: 4c0dfc6ab4c434eb140d1f0a896442c1e9230aee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Work sample for OSO

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
...