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