The first thing to do is to run server -i to format and make the volumes containing the grid data. Before running the grid server, you must edit exampleconfig and change the value of the sm_diskrw option to $SHORE/bin/diskrw. (Note: You must replace $SHORE/bin/diskrw with the actual pathname of the diskrw executable; you cannot use a "shell variable" in this file.) Information about all the options available to the programs can be found by running them with a -h flag.
Running grid will leave log files in ./log.grid and a storage device file called ./device.grid. These can be removed when you are done.
% server -i
Answer "y" to the question "Do you really want to initialize the Grid database?". You should see something like this:
processing configuration options ... Do you really want to initialize the Grid database? y Starting SSM and performing recovery ... Formatting and mounting device: device.grid with a 2000KB quota ... Creating a new volume on the device with a 2000KB quota ... starting up, listening on port 1234 allocating a tcp socket for listening for connections ... binding to port 1234 creating tcp service registering rpc service main starting stdin thread creating file handler for listener socket Command thread is running Creating a new Grid Server>
With the server running in one window, type client in another window to start a client. At either the client or server prompt, you can type help to get this list of available commands.
% client processing configuration options ... trying to connect to server at port 1234 attempting server connection Client ready. client> 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> move name x y move item <name> to location <x,y> 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. client>
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 typing to the client.
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
When you are done, you can type "make clean" to remove the compiled programs, or "make distclean" to remove the compiled programs as well as the "database" and log files generated by running them.