ACHTUNG: AS OF 20110523, THIS PAGE IS NOW MAINTAINED IN THE NEW WIKI: http://whiki.wanderinghorse.net/wikis/whio/?page=whio_ht_tool
whio-ht-tool is a tool for testing and in general tinkering with whio_ht files. It has a number of commands for inserting, searching, and removing records. It is primarily a tool with which i can test the whio_ht API while developing.
It is ONLY useful for hashtables storing string data, and may produce garbage on stdout or stderr if used with a binary-data hashtable.
Its usage is much different from the whio_epfs tools, and more like that of the Sun Cluster family of tools. In the abstract it is used like this:
whio-ht-tool ht_file COMMAND [command args]
It supports commands to do the following:
- create [-f] [hashSize N] [funcSet "name"]
Create or "format" a hashtale file. The arguments are as documented for whio_ht_format(). Use -f to force overwriting of an existing file.
Insert new records from standard input, one record per line, first token is the key and the rest is the value.
- ls: list all records.
- rm KEY1..N
remove records by key. RM is identical ut does not fail if the record is not found.
- search KEY1..N (or s)
search by key name.
Run it without any arguments for the usage/help text.
# Create a whio_ht file: ~> whio-ht-tool my.ht create hashSize 711 funcSet string formatted file [my.ht] as a whio_ht. # Insert records: ~> whio-ht-tool my.ht insert Inputing from stdin. Format is: KEY [OPTIONAL VALUE UNTIL EOL] aaa AAAAAAA Inserted: [aaa]=[AAAAAAA] bbb BBBBBBBB Inserted: [bbb]=[BBBBBBBB] # Search: ~> whio-ht-tool my.ht search aaa bbb ccc [aaa]=[AAAAAAA] [bbb]=[BBBBBBBB] NOT FOUND: [ccc] MARKER: whio-ht-tool.c:100:ht_check_rc(): TAKE NOTE: EXITING WITH ErRoR cOdE -16/whio_rc.NotFoundError # Remove: ~> whio-ht-tool my.ht rm bbb Removing [bbb] ... REMOVED # Search again: ~> whio-ht-tool my.ht search bbb NOT FOUND: [bbb] MARKER: whio-ht-tool.c:100:ht_check_rc(): TAKE NOTE: EXITING WITH ErRoR cOdE -16/whio_rc.NotFoundError