1dbh_sweep(3) DBHashTables Programmers' Manual dbh_sweep(3)
2
3
4
5‐
6
8 dbh_sweep, dbh_fanout, dbh_foreach_sweep, dbh_foreach_fanout,
9 dbh_exit_sweep, dbh_exit_fanout - apply a function to all or part of
10 the DBHashtable
11
12
14 #include <dbh.h>
15
16 int dbh_foreach_sweep (DBHashTable *dbh, DBHashFunc operate);
17 int dbh_foreach_fanout (DBHashTable *dbh, DBHashFunc operate);
18 int dbh_sweep (DBHashTable *dbh, DBHashFunc operate, unsigned char
19 *key1, unsigned char *key2, unsigned char ignore_portion);
20 int dbh_fanout (DBHashTable *dbh, DBHashFunc operate, unsigned char
21 *key1, unsigned char *key2, unsigned char ignore_portion);
22 void dbh_exit_sweep (DBHashTable *dbh);
23 void dbh_exit_fanout (DBHashTable *dbh);
24
26 dbh_foreach_sweep applies function operate to each member of the hash,
27 following a sweep trajectory. Sweep is done by traversing the
28 DBHashTable in a vertical direction through all branches.
29
30
31 dbh_foreach_fanout applies a function operate to each member of the
32 hash, following a fanout trajectory. Fanout is done by traversing the
33 DBHashTable in a horizontal direction through all records.
34
35 dbh_sweep and dbh_fanout apply a function to subtree members of the
36 hash, where dbh_sweep follows a sweep trajectory (vertically through
37 branches) and dbh_fanout follows a fanout trajectory (horizontally
38 through branches).
39
40 key1 is the key from which to start the sweep or NULL if you don't care
41 and want to start at the top. If you decide to define key1 make sure
42 it is a top level node of a subtree. This is done with dbh_find
43 key2 is the key which will trigger an exit condition, or NULL if don't
44 care and want to continue until the end of the DBHashTable
45 ignore_portion allows you to define the ignored trailing bytes of key1
46 which will define the size of the subtree to be sweeped, or zero if you
47 don't care and want to process all branches.
48
49 In these functions, operate ( void (*operate) (DBHashTable *dbh) ) is
50 the function to apply to each selected member of the DBHashTable
51
52 dbh_exit_sweep and dbh_exit_fanout within the operate function will
53 cause the exit of a currently running sweep or fanout.
54
56 0 on error, 1 otherwise.
57
59 In order for sweep/fanout functions to be extremely fast, you should
60 prepare the DBHashTable for the trajectory you intend to use with
61 dbh_regen_sweep or dbh_regen_fanout first. This allows for extremely
62 efficient use of hardware and operating system caches.
63
65 dbh (0), dbh_regen_sweep [22m(3), dbh_regen_fanout [22m(3), dbh_find [22m(3),
66 dbh_settempdir (3)
67
69 Edscott Wilson Garcia <edscott@xfce.org>
70
71
72
73DBHashTables DBH dbh_sweep(3)