text
stringlengths 0
234
|
---|
.br dbopen (3), |
this manual page describes only the hash-specific information. |
.pp |
the hash data structure is an extensible, dynamic hashing scheme. |
.pp |
the access-method-specific data structure provided to |
.br dbopen (3) |
is defined in the |
.i <db.h> |
include file as follows: |
.pp |
.in +4n |
.ex |
typedef struct { |
unsigned int bsize; |
unsigned int ffactor; |
unsigned int nelem; |
unsigned int cachesize; |
uint32_t (*hash)(const void *, size_t); |
int lorder; |
} hashinfo; |
.ee |
.in |
.pp |
the elements of this structure are as follows: |
.tp 10 |
.i bsize |
defines the hash table bucket size, and is, by default, 256 bytes. |
it may be preferable to increase the page size for disk-resident tables |
and tables with large data items. |
.tp |
.i ffactor |
indicates a desired density within the hash table. |
it is an approximation of the number of keys allowed to accumulate in any |
one bucket, determining when the hash table grows or shrinks. |
the default value is 8. |
.tp |
.i nelem |
is an estimate of the final size of the hash table. |
if not set or set too low, hash tables will expand gracefully as keys |
are entered, although a slight performance degradation may be noticed. |
the default value is 1. |
.tp |
.i cachesize |
is the suggested maximum size, in bytes, of the memory cache. |
this value is |
.ir "only advisory" , |
and the access method will allocate more memory rather than fail. |
.tp |
.i hash |
is a user-defined hash function. |
since no hash function performs equally well on all possible data, the |
user may find that the built-in hash function does poorly on a particular |
data set. |
a user-specified hash functions must take two arguments (a pointer to a byte |
string and a length) and return a 32-bit quantity to be used as the hash |
value. |
.tp |
.i lorder |
is the byte order for integers in the stored database metadata. |
the number should represent the order as an integer; for example, |
big endian order would be the number 4,321. |
if |
.i lorder |
is 0 (no order is specified), the current host order is used. |
if the file already exists, the specified value is ignored and the |
value specified when the tree was created is used. |
.pp |
if the file already exists (and the |
.b o_trunc |
flag is not specified), the |
values specified for |
.ir bsize , |
.ir ffactor , |
.ir lorder , |
and |
.i nelem |
are |
ignored and the values specified when the tree was created are used. |
.pp |
if a hash function is specified, |
.i hash_open |
attempts to determine if the hash function specified is the same as |
the one with which the database was created, and fails if it is not. |
.pp |
backward-compatible interfaces to the routines described in |
.br dbm (3), |
and |
.br ndbm (3) |
are provided, however these interfaces are not compatible with |
previous file formats. |
.sh errors |
the |
.i hash |
access method routines may fail and set |
.i errno |
for any of the errors specified for the library routine |
.br dbopen (3). |
.sh bugs |
only big and little endian byte order are supported. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.