@@ -28,17 +28,97 @@ mvn install
2828
2929# Running the project
3030
31- We provide a simple script in ``` bin/corfuHelloWorld.sh ``` which will deal with the classpath automatically.
31+ We provide a simple script in ``` bin/airline ``` which will deal with the classpath automatically.
3232The project uses the docopt command line parser for, simple readable command line options.
3333
3434To get help on options, simply type from the project directory:
3535```
36- bin/corfuHelloWorld.sh --help
36+ bin/airline --help
3737```
3838
39- To run the project, type:
40- ```
41- bin/corfuHelloWorld.sh run
42- ```
39+ ## Make certain that the Corfu server is running
40+
41+ This example assumes that both the Corfu server and Corfu client are
42+ running on the same machine. If they run on different machines, use
43+ the ` -c server-host:port-number ` syntax on the client command line to
44+ specify where the server is located.
45+
46+ To run the server to listen on TCP port 9000 (the default port), use:
47+
48+ /path/to/your/corfu-source-top-directory/bin/corfu_server -s -m 9000
49+
50+ * ` -s ` = This will run the Corfu server in "single server" mode.
51+ * ` -m ` = The server will be running in "in-memory" mode (i.e., non-persistent)
52+
53+ ## Let's play with airplanes!
54+
55+ If you just started the ` corfu_server ` process, then the database is
56+ empty. When we view the database's contents, we won't see much.
57+
58+ $ ./bin/airline view-database
59+ view-database using db testdb and runtime args localhost:9000
60+ 16:21:44.501 INFO [main] o.c.r.CorfuRuntime - Connecting to Corfu server instance, layout servers=[localhost:9000]
61+ Planes:
62+
63+ Flight schedules:
64+
65+ Let's add a couple of airplanes.
66+
67+ % ./bin/airline add-plane A319 small7
68+ add-plane using db testdb and runtime args localhost:9000
69+ 16:22:34.312 INFO [main] o.c.r.CorfuRuntime - Connecting to Corfu server instance, layout servers=[localhost:9000]
70+ Airplane small7 (A319) added.
71+
72+ % ./bin/airline add-plane B747 big3
73+ add-plane using db testdb and runtime args localhost:9000
74+ 16:23:00.042 INFO [main] o.c.r.CorfuRuntime - Connecting to Corfu server instance, layout servers=[localhost:9000]
75+ Airplane big3 (B747) added.
76+
77+ Excellent. If we use the ` ./bin/airline view-database ` command again,
78+ we'll see our two new airplanes now.
79+
80+ [...]
81+ Planes:
82+ small7 (A319)
83+ big3 (B747)
84+
85+ Flight schedules:
86+
87+ We haven't added any flight schedules yet. Let's do that.
88+
89+ % ./bin/airline add-flight big3 BOS '2016-09-15T12:00:00' SFO '2016-09-15T14:35:00'
90+ add-flight using db testdb and runtime args localhost:9000
91+ 16:28:48.785 INFO [main] o.c.r.CorfuRuntime - Connecting to Corfu server instance, layout servers=[localhost:9000]
92+ Flight FL 1 BOS-SFO dep 2016-09-15T12:00 arr 2016-09-15T14:35 [big3 (B747)] added
93+
94+ Note that the daily flight number, ` FL 1 ` , has been assigned automatically
95+ by the system. Let's add another flight with the same plane and with
96+ an overlapping time window.
97+
98+ % ./bin/airline add-flight big3 MSP '2016-09-15T13:05:00' NRT '2016-09-16T17:05:00'
99+ add-flight using db testdb and runtime args localhost:9000
100+ 16:30:58.450 INFO [main] o.c.r.CorfuRuntime - Connecting to Corfu server instance, layout servers=[localhost:9000]
101+ Plane big3 (B747) is already in use during this timeframe!
102+
103+ Oops. We won't do that again.
43104
105+ Let's add two more flights, then look at the flight schedule.
44106
107+ % ./bin/airline add-flight small7 JFK '2016-09-14T06:01:00' ORD '2016-09-14T08:12:00'
108+ [...]
109+
110+ % ./bin/airline add-flight big3 SFO '2016-09-15T15:00:00' SEA '2016-09-15T17:22:00'
111+ [...]
112+
113+ % ./bin/airline view-database view-database using db testdb and runtime args localhost:9000
114+ 16:32:42.799 INFO [main] o.c.r.CorfuRuntime - Connecting to Corfu server instance, layout servers=[localhost:9000]
115+ Planes:
116+ small7 (A319)
117+ big3 (B747)
118+
119+ Flight schedules:
120+ Schedule for 2016-09-14
121+ FL 1 JFK-ORD dep 2016-09-14T06:01 arr 2016-09-14T08:12 [small7 (A319)]
122+ Schedule for 2016-09-15
123+ FL 1 BOS-SFO dep 2016-09-15T12:00 arr 2016-09-15T14:35 [big3 (B747)]
124+ FL 2 SFO-SEA dep 2016-09-15T15:00 arr 2016-09-15T17:22 [big3 (B747)]
0 commit comments