source: project/sfht/trunk/sfht-eggdoc.scm @ 4834

Last change on this file since 4834 was 4834, checked in by Ivan Raikov, 13 years ago

Added random-swb to the list of dependencies.

File size: 5.8 KB
Line 
1
2(use eggdoc)
3
4(define doc
5  `((eggdoc:begin
6     (name "sfht")
7     (description "A dictionary data structure based on counting Bloom filters.")
8     (author (url "mailto:iraikov@ece.gatech.edu" "Ivan Raikov"))
9
10     (history 
11      (version "1.1" "Added random-swb to the list of dependencies")
12      (version "1.0" "Initial release"))
13
14     (requires (url "random-swb.html" "random-swb")
15               (url "sparse-vectors.html" "sparse-vectors"))
16
17     (usage "(require-extension sfht)")
18
19     (download "sfht.egg")
20
21     (documentation
22     
23      (p "The sfht library is an implementation of the Shared-node "
24         "Fast Hash Table (SFHT) data structure described by Song, et al., in " 
25         (pre "_Fast Hash Table Lookup Using Extended Bloom Filter: "
26              "An Aid to Network Processing_. (SIGCOMM'05)") ". ")
27
28      (p "This code defines an " (tt "sfht") " object that implements a "
29         "dictionary mapping of keys to values. The object responds to "
30         "messages for querying, insertion of new elements, and deletion "
31         "of existing elements. The interface of the " (tt "sfht") " object "
32         "is particularly suitable for situations where the keys are "
33         "represented by bit vectors or vectors of fixnum values. ")
34
35      (p "A counting Bloom filter is a Bloom filter that has been extended so "
36         "that each bit of the filter has a counter associated with it. Upon "
37         "insertion or deletion of an element, the counter is incremented or "
38         "decremented, respectively. In order to find an element efficiently, "
39         "we need to compute the " (tt "k") " hash values, read the counters "
40         "at the " (tt "k") " locations, determine the smallest bucket size, "
41         "and perform a linear search of that bucket for the element. ")
42
43
44      (subsection "SFHT procedures"
45
46          (p "The sfht object is created by a make-sfht function, "
47             "the only user-visible function defined in this egg: ")
48
49          (procedure "make-sfht:: N P KEY->VECTOR KEY-VECTOR-REF KEY-VECTOR-LENGTH [KEY-EQUAL?] -> SELECTOR"
50                        (p "where  "
51                           (symbol-table
52                            (describe "KEY->VECTOR"
53                                      ("is a user-supplied function that takes a key value " 
54                                       "and returns a vector."))
55                            (describe "KEY-VECTOR-REF"
56                                      ("is a user-supplied function that retrieves an element from " 
57                                       "the vector returned by " (tt "KEY-VECTOR") ". "))
58                            (describe "KEY-VECTOR-LENGTH"
59                                      ("is a user-supplied function that returns the length " 
60                                       "of the key vector."))
61                            (describe "KEY->EQUAL?"
62                                      ("is a user-supplied predicate that takes two keys and returns " 
63                                       (tt "#t") " if they are equal. The default function used is " 
64                                       (tt "equal?")))))
65                       
66                        (p "The returned selector procedure can take one of the following arguments: "
67                           (symbol-table 
68                            (describe "'get" 
69                                      ("returns a procedure " (tt "LAMBDA KEY . DEFAULT-CLAUSE") 
70                                         " which searches the hash table for an association with a given "
71                                         (tt "KEY") ", and returns a (key . value) pair of the found association. "
72                                         "If an association with " (tt "KEY") " cannot be located in the hash table, "
73                                         "the PROC returns the result of evaluating the " (tt "DEFAULT-CLAUSE") ". "
74                                         "If the default clause is omitted, an error is signaled. "
75                                         (tt "KEY") " must be comparable to the keys in the hash table "
76                                         "by the " (tt "KEY-EQUAL?") " predicate specified "
77                                         "when the hash table was created)"))
78                           
79                            (describe "'empty?"
80                                      ("returns " (tt "#t") " if the hash table is empty"))
81                           
82                            (describe "'size"
83                                      ("returns the size (the number of associations) in the hash table"))
84                           
85                            (describe "'clear!"
86                                      ("removes all associations from the hash table (thus making it empty)"))
87                           
88                            (describe "'put!"
89                                      ("returns a procedure " (tt "LAMBDA KEY VALUE") 
90                                         " which, given a " (tt "KEY") " and a " (tt "VALUE") 
91                                         ", adds the corresponding association to the hash table. "
92                                         "If an association with the same " (tt "KEY") 
93                                         " already exists, its value is replaced with the "
94                                         (tt "VALUE") ". The return value is " (tt "#f") "."))
95                           
96                            (describe "'delete!"
97                                      ("returns a procedure " (tt "LAMBDA KEY . DEFAULT-CLAUSE")
98                                         " which searches the hash table for an association with a given "
99                                         (tt "KEY") ", deletes it, and returns a (key . value) pair of the found "
100                                         "and deleted association. If an association with the KEY cannot be located "
101                                         "in the hash table, the " (tt "PROC") " returns the result of evaluating "
102                                         (tt "DEFAULT-CLAUSE") ". " 
103                                         "If the default clause is omitted, an error is signaled. "))
104                           
105                            (describe "'debugprint"
106                                      ("prints out all the buckets in the Bloom filter, for debug purposes")))))))
107
108
109     (examples (pre #<<EOF
110(require-extension iset)
111(require-extension sfht)
112
113(define sfht (make-sfht 100000 0.0001 
114                        integer->bit-vector 
115                        (compose (lambda (x) (if x 1 0)) bit-vector-ref)
116                        bit-vector-length))
117
118((sfht 'put!) 1 'one)
119
120((sfht 'get))
121
122EOF
123))
124
125     (license
126      "Copyright 2007 Ivan Raikov and the Okinawa Institute of Science and Technology
127
128This program is free software; you can redistribute it and/or
129modify it under the terms of the GNU General Public License as
130published by the Free Software Foundation; either version 2 of the
131License, or (at your option) any later version.
132
133This program is distributed in the hope that it will be useful, but
134WITHOUT ANY WARRANTY; without even the implied warranty of
135MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
136General Public License for more details.
137
138You should have received a copy of the GNU General Public License
139along with this program; if not, write to the Free Software
140Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
14102110-1301 USA
142
143A full copy of the GPL license can be found on Debian systems in
144/usr/share/common-licenses/GPL-2"))))
145
146(if (eggdoc->html doc) (void))
Note: See TracBrowser for help on using the repository browser.