1dbh_genkey(3) DBHashTables Programmers' Manual dbh_genkey(3)
2
3
4
5‐
6
8 dbh_genkey, dbh_genkey2, dbh_orderkey - generate cuantified or ordered
9 keys
10
12 #include <dbh.h>
13
14 void dbh_genkey (unsigned char *key, unsigned char length, unsigned int
15 n);
16 void dbh_genkey2 (unsigned char *key, unsigned char length, unsigned
17 int n);
18 void dbh_orderkey (unsigned char *key, unsigned char length, unsigned
19 int n, unsigned char base);
20
21
23 dbh_genkey and dbh_genkey2 obtain a key from a secuential series of
24 natural numbers (positive integers without zero) which does not con‐
25 serve the order of the natural numbers, but which are optimized for
26 construction of a balanced hash tree. In dbh_genkey the key is
27 expressed in cuantified numbers based on the 0 digit. In dbh_genkey2
28 the key is expressed in cuantified numbers based on the A symbol.
29
30 dbh_orderkey will obtain a key from a secuential series of natural num‐
31 bers (positive integers without zero) which conserves the order of the
32 natural numbers. This function generates a key that belongs to a finite
33 subset of the cuantified numbers, but which preserves the order of the
34 natural numbers (up to the supreme, of course).
35
36 In these functions key is pointer to the address where to put the gen‐
37 erated key, length is the key length, and n is the natural number for
38 which to generate the key. For dbh_orderkey base is the number system
39 base to use. This will equal the maximum number of nodes per branch.
40 This ---along with the keylength--- will define a maximum number of
41 records for the DBHashTable.
42
43
45 These functions do not return any value.
46
48 Cuantified numbers are an alternate way to view the set of natural num‐
49 bers {1, 2, 3, ...} where order is defined in two levels. In natural
50 numbers there is only one level of order (defined by the > boolean
51 operator). In cuantified numbers the first level of order is defined by
52 the cuanta or quantity. The cuanta is obtained by adding all the digits
53 of the cuantified number. Thus, for example, 10022, 5, 32, and 11111
54 are all equal at the first level of order since they all add up to 5.
55 The second level or order may be obtained in different manners. In
56 functions dbh_genkey and dbh_genkey2 the corresponding order of the
57 natural numbers from which they are associated is not conserved. In
58 dbh_orderkey the corresponding order of the natural numbers from which
59 they are associated is conserved, but at a price. The base, or maximum
60 value each digit may reach, must be defined. This effectively puts a
61 limit on the number of keys which may be generated for a given number
62 of digits.
63
64 When a DBHashTable is constructed with cuantified keys, the maximum
65 amount of disk access instructions generated to access any given record
66 is equal to the cuanta of the cuantified number represented by the key.
67 This allows a DBHashTable to be constructed with minimum access time
68 across all records.
69
71 dbh (0), dbh_update (3), dbh_load (3)
72
74 Edscott Wilson Garcia <edscott@xfce.org>
75
76
77
78DBHashTables DBH dbh_genkey(3)