This is the zcdb Reference Manual, version 1.0.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 07:10:15 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
zcdb
Read and write cdb files, as specified in http://cr.yp.to/cdb.html
Zach Beane <xach@xach.com>
MIT
1.0.4
package.lisp
(file).
cdb.lisp
(file).
reading.lisp
(file).
writing.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
zcdb/cdb.lisp
package.lisp
(file).
zcdb
(system).
+initial-hash-value+
(constant).
cdb-hash
(function).
make-growable-vector
(function).
zcdb/reading.lisp
cdb.lisp
(file).
zcdb
(system).
lookup-record-at
(function).
make-octet-vector
(function).
read-cdb-u32
(function).
stream-lookup
(function).
stream-map-cdb
(function).
table-slot-lookup
(function).
zcdb/writing.lisp
reading.lisp
(file).
zcdb
(system).
add-record
(function).
print-object
(method).
print-object
(method).
with-output-to-cdb
(macro).
*empty-record-pointer*
(special variable).
*pointer-padding*
(special variable).
bucket-hash-vector
(function).
buckets
(reader method).
(setf buckets)
(writer method).
call-with-output-to-cdb
(function).
cdb-writer
(class).
end-of-records-position
(reader method).
(setf end-of-records-position)
(writer method).
entries
(reader method).
(setf entries)
(writer method).
entry-count
(generic function).
finish-cdb-writer
(function).
hash-table-bucket
(class).
hash-value
(reader method).
(setf hash-value)
(writer method).
output
(reader method).
(setf output)
(writer method).
record-pointer
(class).
record-position
(reader method).
(setf record-position)
(writer method).
slot-count
(generic function).
table-position
(reader method).
(setf table-position)
(writer method).
write-bucket-hash-table
(function).
write-cdb-u32
(function).
write-hash-tables
(function).
write-pointers
(function).
Packages are listed by definition order.
zcdb
common-lisp
.
add-record
(function).
lookup
(function).
map-cdb
(function).
with-output-to-cdb
(macro).
*empty-record-pointer*
(special variable).
*pointer-padding*
(special variable).
+initial-hash-value+
(constant).
bucket-hash-vector
(function).
buckets
(generic reader).
(setf buckets)
(generic writer).
call-with-output-to-cdb
(function).
cdb-hash
(function).
cdb-writer
(class).
end-of-records-position
(generic reader).
(setf end-of-records-position)
(generic writer).
entries
(generic reader).
(setf entries)
(generic writer).
entry-count
(generic function).
finish-cdb-writer
(function).
hash-table-bucket
(class).
hash-value
(generic reader).
(setf hash-value)
(generic writer).
lookup-record-at
(function).
make-growable-vector
(function).
make-octet-vector
(function).
output
(generic reader).
(setf output)
(generic writer).
read-cdb-u32
(function).
record-pointer
(class).
record-position
(generic reader).
(setf record-position)
(generic writer).
slot-count
(generic function).
stream-lookup
(function).
stream-map-cdb
(function).
table-position
(generic reader).
(setf table-position)
(generic writer).
table-slot-lookup
(function).
write-bucket-hash-table
(function).
write-cdb-u32
(function).
write-hash-tables
(function).
write-pointers
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Evaluate BODY with CDB bound to a CDB-WRITER object. The CDB in progress is written to TEMP-FILE, and then when the CDB is successfully written, TEMP-FILE is renamed to FILE. For atomic operation, FILE and TEMP-FILE must be on the same filesystem.
zcdb
.
Add KEY and VALUE to a cdb file. KEY and VALUE should both be (unsigned-byte 8) vectors.
zcdb
.
record-pointer
) stream) ¶hash-table-bucket
) stream) ¶Create a hash vector for a bucket. A hash vector has 2x the entries of the bucket, and is initialized to an empty record pointer. The high 24 bits of the hash value of a record pointer, mod the size of the vector, is used as a starting slot, and the vector is walked (wrapping at the end) to find the first free slot for positioning each record pointer entry.
zcdb
.
Call FUN with one argument, a CDB-WRITER instance to which records can be added with ADD-RECORD.
zcdb
.
Write the trailing hash tables and leading table pointers to the cdb file.
zcdb
.
zcdb
.
Write BUCKET’s hash table vector to STREAM.
zcdb
.
Write an (unsigned-byte 32) value to STREAM in little-endian order.
zcdb
.
Write the traililng hash tables to the end of the cdb file. Initializes the position of the buckets in the process.
zcdb
.
Write the leading hash table pointers to the beginning of the cdb file. Must be called after WRITE-HASH-TABLES, or the positions won’t be available.
zcdb
.
zcdb
.
cdb-writer
)) ¶automatically generated reader method
zcdb
.
cdb-writer
)) ¶automatically generated writer method
zcdb
.
cdb-writer
)) ¶automatically generated reader method
zcdb
.
cdb-writer
)) ¶automatically generated writer method
zcdb
.
hash-table-bucket
)) ¶hash-table-bucket
)) ¶A vector of record-pointers.
zcdb
.
hash-table-bucket
)) ¶zcdb
.
record-pointer
)) ¶record-pointer
)) ¶The hash value of the record key.
zcdb
.
cdb-writer
)) ¶automatically generated reader method
zcdb
.
cdb-writer
)) ¶automatically generated writer method
zcdb
.
record-pointer
)) ¶record-pointer
)) ¶The file position at which the record is stored.
zcdb
.
hash-table-bucket
)) ¶zcdb
.
hash-table-bucket
)) ¶hash-table-bucket
)) ¶The file position at which this table is (eventually) slotted.
zcdb
.
Initarg | Value |
---|---|
:end-of-records-position | 2048 |
:buckets | (map-into (make-array 256) (lambda nil (make-instance (quote hash-table-bucket)))) |
:buckets
:end-of-records-position
:output
During construction of the CDB, record pointers are
accumulated into one of 256 hash table buckets, depending on the low
8 bits of the hash value of the key. At the end of record writing,
these buckets are used to write out hash table vectors at the end of
the file, and write pointers to the hash table vectors at the start
of the file.
zcdb
.
Initarg | Value |
---|---|
:table-position | 0 |
:entries | (make-growable-vector) |
The file position at which this table is (eventually) slotted.
:table-position
A vector of record-pointers.
:entries
Every key/value record written to a CDB has a
corresponding record pointer, which tracks the key’s hash value and
the record’s position in the data file. When all records have been
written to the file, these record pointers are organized into hash
tables at the end of the cdb file.
zcdb
.
Initarg | Value |
---|---|
:hash-value | 0 |
:record-position | 0 |
The hash value of the record key.
:hash-value
The file position at which the record is stored.
:record-position
Jump to: | (
A B C E F G H L M O P R S T W |
---|
Jump to: | (
A B C E F G H L M O P R S T W |
---|
Jump to: | *
+
B C E H O R S T |
---|
Jump to: | *
+
B C E H O R S T |
---|
Jump to: | C F H P R S W Z |
---|
Jump to: | C F H P R S W Z |
---|