3.3. Network Protocol
The interaction between a client and a server is a simple iterative dialog where the client sends a query, and waits for an answer from the server.
All values are sent as 64-bit little-endian numbers.
3.3.1. Client to Server
Prefix |
Data |
Description |
---|---|---|
joedb |
client_version |
first message, sent at connection time |
H |
until hash (32 bytes) |
check SHA-256 hash code |
r |
from until |
read a range of bytes |
D |
wait from |
pull, no lock, no data |
E |
wait from |
pull, lock, no data |
F |
wait from |
pull, no lock, data |
G |
wait from |
pull, lock, data |
L |
lock |
|
M |
unlock |
|
N |
from until data |
push, keep locked |
O |
from until data |
push, unlock |
3.3.2. Server to Client
Prefix |
Data |
Description |
---|---|---|
joedb |
server_version
session_id
checkpoint
‘R’ or ‘W’
|
reply to joedb.
server_version = 0 means client_version is rejected.
‘R’ is pull-only
|
H |
reply to H, hash is matching |
|
h |
reply to H, hash mismatch |
|
r |
until data |
reply to r (size may be shorter than what was asked) |
D |
until |
reply to D |
E |
until |
reply to E |
F |
until data |
reply to F |
G |
until data |
reply to G |
L |
reply to L |
|
M |
reply to M |
|
N |
reply to N |
|
O |
reply to O |
|
R |
reply to E, G, L, M, N, O when the server is read-only |
|
C |
reply to N, O in case of conflict |
|
t |
reply to N, O in case of time out |