1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)hash.3 8.6 (Berkeley) 8/18/94
33 .\" $FreeBSD: src/lib/libc/db/man/hash.3,v 1.8 2003/09/08 19:57:13 ru Exp $
40 .Nd "hash database access method"
47 is the library interface to database files.
48 One of the supported file formats is
51 The general description of the database access methods is in
53 this manual page describes only the
59 data structure is an extensible, dynamic hashing scheme.
61 The access method specific data structure provided to
65 include file as follows:
72 u_int32_t (*hash)(const void *, size_t);
77 The elements of this structure are as follows:
78 .Bl -tag -width indent
85 table bucket size, and is, by default, 256 bytes.
86 It may be preferable to increase the page size for disk-resident tables
87 and tables with large data items.
92 indicates a desired density within the
95 It is an approximation of the number of keys allowed to accumulate in any
96 one bucket, determining when the
98 table grows or shrinks.
99 The default value is 8.
104 is an estimate of the final size of the
107 If not set or set too low,
109 tables will expand gracefully as keys
110 are entered, although a slight performance degradation may be noticed.
111 The default value is 1.
113 A suggested maximum size, in bytes, of the memory cache.
116 advisory, and the access method will allocate more memory rather
127 function performs equally well on all possible data, the
128 user may find that the built-in
130 function does poorly on a particular
134 functions must take two arguments (a pointer to a byte
135 string and a length) and return a 32-bit quantity to be used as the
139 The byte order for integers in the stored database metadata.
140 The number should represent the order as an integer; for example,
141 big endian order would be the number 4,321.
144 is 0 (no order is specified) the current host order is used.
145 If the file already exists, the specified value is ignored and the
146 value specified when the tree was created is used.
149 If the file already exists (and the
151 flag is not specified), the
152 values specified for the
153 .Va bsize , ffactor , lorder
158 ignored and the values specified when the tree was created are used.
162 function is specified,
164 will attempt to determine if the
166 function specified is the same as
167 the one with which the database was created, and will fail if it is not.
169 Backward compatible interfaces to the older
173 routines are provided, however these interfaces are not compatible with
174 previous file formats.
178 access method routines may fail and set
180 for any of the errors specified for the library routine
188 .%T "Dynamic Hash Tables"
190 .%R "Communications of the ACM"
194 .%T "A New Hash Package for UNIX"
196 .%R "USENIX Proceedings"
200 Only big and little endian byte order is supported.