-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.in
63 lines (44 loc) · 2.49 KB
/
README.in
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
## Hibiscus
An API specification for simple RPC clients.
## Motivation
Many [io7m](https://www.io7m.com/) projects implement some form of RPC client.
The Hibiscus API is an attempt to define some common interface types so that
unrelated projects nevertheless end up with a consistent look and feel across
client implementations.
## Architecture
![architecture](./src/site/resources/arch.png?raw=true)
1. A `Configuration` is passed to a `ClientFactory` to produce a `Client`.
2. The `Client` sends `ConnectionParameters` to the server to log in.
3. The `Server` sends back `Messages` indicating if the login succeeded or
failed.
4. Assuming success, the `Client` sends `Messages` to the server to perform
operations.
5. The `Server` sends `Messages` in response to `Messages`.
## State
Clients conform to a simple state machine:
![state](./src/site/resources/state.png?raw=true)
1. Clients begin in the `DISCONNECTED` state.
2. A `Login` operation moves the client into the `CONNECTING` state.
3. If the login succeeds, the client moves to the `CONNECTED` state after
passing through the `CONNECTION_SUCCEEDED` state.
4. If the login fails, the client moves to the `DISCONNECTED` state after
passing through the `CONNECTION_FAILED` state.
In the `CONNECTED` state, the client can:
* Disconnect, moving to the `DISCONNECTED` state.
* Send messages, remaining in the `CONNECTED` state.
A client maintains an internal [Transport](#transport) that performs
the actual communication.
## Transport
A _Transport_ represents an object that can be used to read and write messages.
A _Transport_ exposes the following operations:
* `receive`: Read a message from the transport.
* `sendAndForget`: Write a message to the transport, potentially discarding
any response that might come back.
* `sendAndWait`: Write a message to the transport and wait for a response
to come back.
* `send`: Write a message to the transport but do not wait for a response
to come back. The response can be fetched later with `receive`.
The package includes multiple example transports:
* [EUDP0Transport](com.io7m.hibiscus.examples/src/main/java/com/io7m/hibiscus/examples/udp0/EUDP0Transport.java) - A UDP transport
* [ETCP0Transport](com.io7m.hibiscus.examples/src/main/java/com/io7m/hibiscus/examples/tcp0/ETCP0Transport.java) - A TCP transport
* [EHTTP0Transport](com.io7m.hibiscus.examples/src/main/java/com/io7m/hibiscus/examples/http0/EHTTP0Transport.java) - An HTTP transport