xref: /minix3/lib/libc/db/hash/README (revision 2639ae9b1755f49e4eb4b211ce63d8879b0edd4a)
1*2639ae9bSBen Gras#	$NetBSD: README,v 1.5 1999/02/16 17:59:18 kleink Exp $
2*2639ae9bSBen Gras#	@(#)README	8.1 (Berkeley) 6/4/93
3*2639ae9bSBen Gras
4*2639ae9bSBen GrasThis package implements a superset of the hsearch and dbm/ndbm libraries.
5*2639ae9bSBen Gras
6*2639ae9bSBen GrasTest Programs:
7*2639ae9bSBen Gras	All test programs which need key/data pairs expect them entered
8*2639ae9bSBen Gras	with key and data on separate lines
9*2639ae9bSBen Gras
10*2639ae9bSBen Gras	tcreat3.c
11*2639ae9bSBen Gras		Takes
12*2639ae9bSBen Gras			bucketsize (bsize),
13*2639ae9bSBen Gras			fill factor (ffactor), and
14*2639ae9bSBen Gras			initial number of elements (nelem).
15*2639ae9bSBen Gras		Creates a hash table named hashtest containing the
16*2639ae9bSBen Gras		keys/data pairs entered from standard in.
17*2639ae9bSBen Gras	thash4.c
18*2639ae9bSBen Gras		Takes
19*2639ae9bSBen Gras			bucketsize (bsize),
20*2639ae9bSBen Gras			fill factor (ffactor),
21*2639ae9bSBen Gras			initial number of elements (nelem)
22*2639ae9bSBen Gras			bytes of cache (ncached), and
23*2639ae9bSBen Gras			file from which to read data  (fname)
24*2639ae9bSBen Gras		Creates a table from the key/data pairs on standard in and
25*2639ae9bSBen Gras		then does a read of each key/data in fname
26*2639ae9bSBen Gras	tdel.c
27*2639ae9bSBen Gras		Takes
28*2639ae9bSBen Gras			bucketsize (bsize), and
29*2639ae9bSBen Gras			fill factor (ffactor).
30*2639ae9bSBen Gras			file from which to read data (fname)
31*2639ae9bSBen Gras		Reads each key/data pair from fname and deletes the
32*2639ae9bSBen Gras		key from the hash table hashtest
33*2639ae9bSBen Gras	tseq.c
34*2639ae9bSBen Gras		Reads the key/data pairs in the file hashtest and writes them
35*2639ae9bSBen Gras		to standard out.
36*2639ae9bSBen Gras	tread2.c
37*2639ae9bSBen Gras		Takes
38*2639ae9bSBen Gras			butes of cache (ncached).
39*2639ae9bSBen Gras		Reads key/data pairs from standard in and looks them up
40*2639ae9bSBen Gras		in the file hashtest.
41*2639ae9bSBen Gras	tverify.c
42*2639ae9bSBen Gras		Reads key/data pairs from standard in, looks them up
43*2639ae9bSBen Gras		in the file hashtest, and verifies that the data is
44*2639ae9bSBen Gras		correct.
45*2639ae9bSBen Gras
46*2639ae9bSBen GrasNOTES:
47*2639ae9bSBen Gras
48*2639ae9bSBen GrasThe man page ../man/db.3 explains the interface to the hashing system.
49*2639ae9bSBen GrasThe file hash.ps is a postscript copy of a paper explaining
50*2639ae9bSBen Grasthe history, implementation, and performance of the hash package.
51*2639ae9bSBen Gras
52*2639ae9bSBen Gras"bugs" or idiosyncracies
53*2639ae9bSBen Gras
54*2639ae9bSBen GrasIf you have a lot of overflows, it is possible to run out of overflow
55*2639ae9bSBen Graspages.  Currently, this will cause a message to be printed on stderr.
56*2639ae9bSBen GrasEventually, this will be indicated by a return error code.
57*2639ae9bSBen Gras
58*2639ae9bSBen GrasIf you are using the ndbm interface and exit without flushing or closing the
59*2639ae9bSBen Grasfile, you may lose updates since the package buffers all writes.  Also,
60*2639ae9bSBen Grasthe db interface only creates a single database file.  To avoid overwriting
61*2639ae9bSBen Grasthe user's original file, the suffix ".db" is appended to the file name
62*2639ae9bSBen Graspassed to dbm_open.  Additionally, if your code "knows" about the historic
63*2639ae9bSBen Gras.dir and .pag files, it will break.
64*2639ae9bSBen Gras
65*2639ae9bSBen GrasThere is a fundamental difference between this package and the old hsearch.
66*2639ae9bSBen GrasHsearch requires the user to maintain the keys and data in the application's
67*2639ae9bSBen Grasallocated memory while hash takes care of all storage management.  The down
68*2639ae9bSBen Grasside is that the byte strings passed in the ENTRY structure must be null
69*2639ae9bSBen Grasterminated (both the keys and the data).
70