Back

Examples

Consider the following 4 invocations of logappend followed by an invocation of logread:

$ ./logappend -T 1 -K secret -A -D Alice -F log1
$ ./logappend -T 2 -K secret -A -N Bob -F log1
$ ./logappend -T 3 -K secret -A -D Alice -R 1 -F log1
$ ./logappend -T 4 -K secret -A -N Bob -R 1 -F log1

These commands have used the key secret to append 4 events to the log -F log1, recording the arrival of Dr. Alice and Nurse Bob in room 1 of the hospital. If logread is then used to print the state of the hospital, the following should be printed:

$ ./logread -K secret -S -F log1
Alice
Bob
1: Alice,Bob

If we continue using -F log1 and record some movements, we can then use logread to get a list of the rooms entered by Alice.

./logappend -T 5 -K secret -L -D Alice -R 1 -F log1
./logappend -T 6 -K secret -A -D Alice -R 2 -F log1
./logappend -T 7 -K secret -L -D Alice -R 2 -F log1
./logappend -T 8 -K secret -A -D Alice -R 3 -F log1
./logappend -T 9 -K secret -L -D Alice -R 3 -F log1
./logappend -T 10 -K secret -A -D Alice -R 1 -F log1
./logread -K secret -R -D Alice -F log1
1,2,3,1

We can also use logappend in batch mode like so (on a fresh log log2):

$ cat batch 
-K secret -T 0 -A -D Ritchey -F log2
-K secret -T 1 -A -R 0 -D Ritchey -F log2
-K secret -T 2 -A -N Andrew -F log2
-K secret -T 3 -A -R 0 -N Andrew -F log2
$ ./logappend -B batch 
$ ./logread -K secret -S -F log2
Ritchey
Andrew
0:Andrew,Ritchey