source: project/wiki/eggref/4/tokyocabinet @ 22498

Last change on this file since 22498 was 22498, checked in by sven, 10 years ago
File size: 4.8 KB
Line 
1== tokyocabinet
2[[toc:]]
3=== Description
4
5[[http://1978th.net/tokyocabinet/|Tokyo Cabinet DBM]] bindings for Chicken.
6
7=== Author
8
9[[Alex Shinn]]
10
11=== Requirements
12
13None
14
15=== Documentation
16
17The following flags and procedures are defined (currently only APIs for the hash database
18and the table database is provided - B-trees and fixed-length databases may be provided later).
19For more information, consult the {{tokyocabinet(3)}} manual pages.
20
21==== tc-hdb-open
22
23<procedure>(tc-hdb-open FILE #!key FLAGS TUNE-OPTS MUTEX? NUM-BUCKETS RECORD-ALIGNMENT NUM-FREE-BLOCKS CACHE-LIMIT MMAP-SIZE)</procedure>
24
25Returns a {{HDB}} object as a c-pointer.  FLAGS specifies creation and
26locking behavior; by default files are opened for reading
27(TC_HDBOREADER), writing (TC_HDBOWRITER) and creating (TC_HDBOCREAT).
28
29TUNE-OPTS, along with the other keywords specify options to the {{tchdbtune}}
30function.  MUTEX? opens the file under mutex mode (as with {{tchdbsetmutex}}).
31
32<constant>TC_HDBOWRITER</constant>
33<constant>TC_HDBOREADER</constant>
34<constant>TC_HDBOCREAT</constant>
35<constant>TC_HDBOTRUNC</constant>
36<constant>TC_HDBONOLCK</constant>
37<constant>TC_HDBOLCKNB</constant>
38
39These flags to {{tc-hdb-open}} specify creation and locking
40behavior.
41
42==== tc-hdb-close
43
44<procedure>(tc-hdb-close HDB)</procedure>
45
46Closes and frees the database handle.
47
48==== tc-hdb-put!
49
50<procedure>(tc-hdb-put! HDB KEY VALUE)</procedure>
51
52Put (KEY, VALUE) into hash database HDB.
53
54==== tc-hdb-delete!
55
56<procedure>(tc-hdb-delete! HDB KEY)</procedure>
57
58Delete KEY from hash database HDB.
59
60==== tc-hdb-get
61
62<procedure>(tc-hdb-get HDB KEY)</procedure>
63
64Returns the string VALUE associated with KEY in hash
65database HDB, or {{#f}} if KEY does not exist.
66
67==== tc-hdb-iter-init
68
69<procedure>(tc-hdb-iter-init HDB)</procedure>
70
71==== tc-hdb-iter-next
72
73<procedure>(tc-hdb-iter-next HDB)</procedure>
74
75Returns a {{STRING}}
76
77==== tc-hdb-fold
78
79<procedure>(tc-hdb-fold HDB KONS KNIL)</procedure>
80
81Returns the accumulated result.  Specify {{ALIST-CONS}} for
82the {{KONS}} to get an alist representation of the database.
83
84==== tc-tdb-open
85
86<procedure>(tc-tdb-open TDB #!key FLAGS MUTEX? NUM-BUCKETS RECORD-ALIGNMENT NUM-FREE-BLOCKS TUNE-OPTS CACHE-LIMIT LEAF-CACHE NON-LEAF-CACHE MMAP-SIZE)</procedure>
87
88Returns a TDB object as a c-pointer.
89
90==== tc-tdb-close
91
92<procedure>(tc-tdb-close TDB)</procedure>
93
94Closes the table database TDB.
95
96==== tc-tdb-get-tabcols
97
98<procedure>(tc-tdb-get-tabcols TDB KEY)</procedure>
99
100The attribute-value pairs for key KEY from table database TDB as one string with tab character as separator: attr1 TAB val1 TAB attr2 TAB val2 ...
101
102==== tc-tdb-vsize
103
104<procedure>(tc-tdb-vsize TDB KEY)</procedure>
105
106The size of the value for KEY (measured in bytes).
107
108=== Limitations
109
110Procedures which accept or return strings, such as
111[[#tc-hdb-get|tc-hdb-get]] and [[#tc-hdb-put|tc-hdb-put]], are subject
112to the maximum string length limit imposed by Chicken.  On 32-bit
113platforms, this is 16 megabytes.  On a 64-bit platform, it is 72
114petabytes.  If you try to store or retrieve objects exceeding this
115limit, an error will occur.
116
117For unknown reasons, table databases cannot be opened
118if mmap-size is greater than 0.
119
120=== Changelog
121
122* 1.0 Initial release
123* 2.01 some extensions for the table database
124* 2.2 Some fixes and extensions for the table database.
125
126=== License
127
128  Copyright (c) 2008-2011, Alex Shinn
129  All rights reserved.
130 
131  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
132  conditions are met:
133 
134    Redistributions of source code must retain the above copyright notice, this list of conditions and the following
135      disclaimer.
136    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
137      disclaimer in the documentation and/or other materials provided with the distribution.
138    Neither the name of the author nor the names of its contributors may be used to endorse or promote
139      products derived from this software without specific prior written permission.
140 
141  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
142  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
143  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
144  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
145  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
146  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
147  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
148  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
149  POSSIBILITY OF SUCH DAMAGE.
Note: See TracBrowser for help on using the repository browser.