whio  Update of "whio_ht_tool"

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.


Artifact ID: 8e474c68f136e4ce91940cc3b561cdf2660b8037
Page Name:whio_ht_tool
Date: 2011-05-23 18:50:57
Original User: stephan
Parent: d26935846264eb4c9a4a5ddce077cfa46da8cced

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
    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]
Inserted: [aaa]=[AAAAAAA]
Inserted: [bbb]=[BBBBBBBB]

# Search:
~> whio-ht-tool my.ht search aaa bbb ccc
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