next up previous contents
Next: Appendix: Program Sources Up: Writing Value-Added Servers with Previous: Compiling the Example

 

Running the Example

The configuration options for the server and client can be set in the file exampleconfig or on the command line. You must edit exampleconfig to set the sm_diskrw option to the location of the installed diskrw program. Information about all the options available to the programs can be found by running them with a -h flag.

The first thing to do is to run server -i to format and make the volumes containing the grid data. Next, type client to start a client. At either the client or server prompt, you can type help to get this list of available commands:

Server> help
Valid commands are: 

    commit 
        commit transaction and start another one
    abort 
        abort transaction and start another one
    clear 
        clear grid
    print 
        print grid
    add name x y
        add new item <name> at <x,y>
    remove name
        remove item <name>
    locate name
        print location of item <name>
    spatial x_lo y_lo x_hi y_hi
        print count of items in rectangle and list first few items
    quit 
        quit and exit program (aborts current transaction)
    help 
        prints this message

    Comments begin with a '#' and continue until the end of the line.

At all times a transaction is running for the server and client prompts. As commands are run, appropriate locks are obtained. Locks will be released when a commit or abort command is given.

Here are some commands you might try:

print 			# print the empty grid
add Junk 20 10		# add and item named Junk at coordinate 20,10
add Car 15 5
print
commit			# commit the current transaction
locate Car		# find location of Car
spatial 0 0 39 14	# count all items on grid
spatial 20 10 20 10	# list all items at location 20,10
clear			# clear the grid
print			# it should be empty
abort			# abort the current transaction
print			# grid should have items on it now
quit			# quit -- aborts current transaction



Marvin Solomon
Fri Aug 2 13:40:14 CDT 1996