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. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)hash.3 8.6 (Berkeley) 8/18/94
29 .\" $FreeBSD: src/lib/libc/db/man/hash.3,v 1.4.2.3 2003/02/23 19:45:52 trhodes Exp $
30 .\" $DragonFly: src/lib/libc/db/man/hash.3,v 1.5 2007/07/21 17:45:54 swildner Exp $
37 .Nd "hash database access method"
44 is the library interface to database files.
45 One of the supported file formats is
48 The general description of the database access methods is in
50 this manual page describes only the
56 data structure is an extensible, dynamic hashing scheme.
58 The access method specific data structure provided to
62 include file as follows:
69 u_int32_t (*hash)(const void *, size_t);
74 The elements of this structure are as follows:
75 .Bl -tag -width indent
82 table bucket size, and is, by default, 256 bytes.
83 It may be preferable to increase the page size for disk-resident tables
84 and tables with large data items.
89 indicates a desired density within the
92 It is an approximation of the number of keys allowed to accumulate in any
93 one bucket, determining when the
95 table grows or shrinks.
96 The default value is 8.
101 is an estimate of the final size of the
104 If not set or set too low,
106 tables will expand gracefully as keys
107 are entered, although a slight performance degradation may be noticed.
108 The default value is 1.
110 A suggested maximum size, in bytes, of the memory cache.
113 advisory, and the access method will allocate more memory rather
124 function performs equally well on all possible data, the
125 user may find that the built-in
127 function does poorly on a particular
131 functions must take two arguments (a pointer to a byte
132 string and a length) and return a 32-bit quantity to be used as the
136 The byte order for integers in the stored database metadata.
137 The number should represent the order as an integer; for example,
138 big endian order would be the number 4,321.
141 is 0 (no order is specified) the current host order is used.
142 If the file already exists, the specified value is ignored and the
143 value specified when the tree was created is used.
146 If the file already exists (and the
148 flag is not specified), the
149 values specified for the
150 .Va bsize , ffactor , lorder
155 ignored and the values specified when the tree was created are used.
159 function is specified,
161 will attempt to determine if the
163 function specified is the same as
164 the one with which the database was created, and will fail if it is not.
166 Backward compatible interfaces to the older
170 routines are provided, however these interfaces are not compatible with
171 previous file formats.
175 access method routines may fail and set
177 for any of the errors specified for the library routine
185 .%T "Dynamic Hash Tables"
187 .%R "Communications of the ACM"
191 .%T "A New Hash Package for UNIX"
193 .%R "USENIX Proceedings"
197 Only big and little endian byte order is supported.