1/*************************************************************************************************
2 * IDL for bindings of scripting languages
3 *                                                               Copyright (C) 2006-2012 FAL Labs
4 * This file is part of Tokyo Cabinet.
5 * Tokyo Cabinet is free software; you can redistribute it and/or modify it under the terms of
6 * the GNU Lesser General Public License as published by the Free Software Foundation; either
7 * version 2.1 of the License or any later version.  Tokyo Cabinet is distributed in the hope
8 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
10 * License for more details.
11 * You should have received a copy of the GNU Lesser General Public License along with Tokyo
12 * Cabinet; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
13 * Boston, MA 02111-1307 USA.
14 *************************************************************************************************/
15
16
17/**
18 * namespace of Tokyo Cabinet
19 */
20module tokyocabinet {
21  //----------------------------------------------------------------
22  // list of strings (substituted for by the native mechanism)
23  //----------------------------------------------------------------
24  interface List {
25    string get(in long index);
26  };
27  //----------------------------------------------------------------
28  // map of strings (substituted for by the native mechanism)
29  //----------------------------------------------------------------
30  interface Map {
31    string get(in string key);
32  };
33  //----------------------------------------------------------------
34  // the error codes
35  //----------------------------------------------------------------
36  interface ECODE {
37    const long ESUCCESS = 0;
38    const long ETHREAD = 1;
39    const long EINVALID = 2;
40    const long ENOFILE = 3;
41    const long ENOPERM = 4;
42    const long EMETA = 5;
43    const long ERHEAD = 6;
44    const long EOPEN = 7;
45    const long ECLOSE = 8;
46    const long ETRUNC = 9;
47    const long ESYNC = 10;
48    const long ESTAT = 11;
49    const long ESEEK = 12;
50    const long EREAD = 13;
51    const long EWRITE = 14;
52    const long EMMAP = 15;
53    const long ELOCK = 16;
54    const long EUNLINK = 17;
55    const long ERENAME = 18;
56    const long EMKDIR = 19;
57    const long ERMDIR = 20;
58    const long EKEEP = 21;
59    const long ENOREC = 22;
60    const long EMISC = 9999;
61    long ecode();
62    string errmsg(in long ecode);
63  };
64  //----------------------------------------------------------------
65  // the hash database API
66  //----------------------------------------------------------------
67  interface HDB :ECODE {
68    const long TLARGE = 1 << 0;
69    const long TDEFLATE = 1 << 1;
70    const long TBZIP = 1 << 2;
71    const long TTCBS = 1 << 3;
72    const long OREADER = 1 << 0;
73    const long OWRITER = 1 << 1;
74    const long OCREAT = 1 << 2;
75    const long OTRUNC = 1 << 3;
76    const long ONOLCK = 1 << 4;
77    const long OLCKNB = 1 << 5;
78    const long OTSYNC = 1 << 6;
79    boolean tune(in long long bnum, in long apow, in long fpow, in long opts);
80    boolean setcache(in long rcnum);
81    boolean setxmsiz(in long long xmsiz);
82    boolean setdfunit(in long dfunit);
83    boolean open(in string path, in long omode);
84    boolean close();
85    boolean put(in string key, in string value);
86    boolean putkeep(in string key, in string value);
87    boolean putcat(in string key, in string value);
88    boolean putasync(in string key, in string value);
89    boolean out(in string key);
90    string get(in string key);
91    long vsiz(in string key);
92    boolean iterinit();
93    string iternext();
94    List fwmkeys(in string prefix, in long max);
95    long addint(in string key, in long num);
96    double adddouble(in string key, in double num);
97    boolean sync();
98    boolean optimize(in long long bnum, in long apow, in long fpow, in long opts);
99    boolean vanish();
100    boolean copy(in string path);
101    boolean tranbegin();
102    boolean trancommit();
103    boolean tranabort();
104    string path();
105    long long rnum();
106    long long fsiz();
107  };
108  //----------------------------------------------------------------
109  // the B+ tree database API
110  //----------------------------------------------------------------
111  interface BDB :ECODE {
112    const long TLARGE = 1 << 0;
113    const long TDEFLATE = 1 << 1;
114    const long TBZIP = 1 << 2;
115    const long TTCBS = 1 << 3;
116    const long OREADER = 1 << 0;
117    const long OWRITER = 1 << 1;
118    const long OCREAT = 1 << 2;
119    const long OTRUNC = 1 << 3;
120    const long ONOLCK = 1 << 4;
121    const long OLCKNB = 1 << 5;
122    const long OTSYNC = 1 << 6;
123    boolean tune(in long lmemb, in long nmemb,
124                 in long long bnum, in long apow, in long fpow, in long opts);
125    boolean setcache(in long lcnum, in long ncnum);
126    boolean setxmsiz(in long long xmsiz);
127    boolean setdfunit(in long dfunit);
128    boolean open(in string path, in long omode);
129    boolean close();
130    boolean put(in string key, in string value);
131    boolean putkeep(in string key, in string value);
132    boolean putcat(in string key, in string value);
133    boolean putdup(in string key, in string value);
134    boolean putlist(in string key, in List values);
135    boolean out(in string key);
136    boolean outlist(in string key);
137    string get(in string key);
138    List getlist(in string key);
139    long vnum(in string key);
140    long vsiz(in string key);
141    List range(in string bkey, in boolean binc, in string ekey, in boolean einc, in long max);
142    List fwmkeys(in string prefix, in long max);
143    long addint(in string key, in long num);
144    double adddouble(in string key, in double num);
145    boolean sync();
146    boolean optimize(in long lmemb, in long nmemb,
147                     in long long bnum, in long apow, in long fpow, in long opts);
148    boolean vanish();
149    boolean copy(in string path);
150    boolean tranbegin();
151    boolean trancommit();
152    boolean tranabort();
153    string path();
154    long long rnum();
155    long long fsiz();
156  };
157  //----------------------------------------------------------------
158  // the B+ tree cursor API
159  //----------------------------------------------------------------
160  interface BDBCUR {
161    const long CPCURRENT = 0;
162    const long CPBEFORE = 1;
163    const long CPAFTER = 2;
164    boolean first();
165    boolean last();
166    boolean jump(in string key);
167    boolean prev();
168    boolean next();
169    boolean put(in string value, in long cpmode);
170    boolean out();
171    string key();
172    string val();
173  };
174  //----------------------------------------------------------------
175  // the fixed-length database API
176  //----------------------------------------------------------------
177  interface FDB :ECODE {
178    const long OREADER = 1 << 0;
179    const long OWRITER = 1 << 1;
180    const long OCREAT = 1 << 2;
181    const long OTRUNC = 1 << 3;
182    const long ONOLCK = 1 << 4;
183    const long OLCKNB = 1 << 5;
184    const long OTSYNC = 1 << 6;
185    boolean tune(in long width, in long long limsiz);
186    boolean open(in string path, in long omode);
187    boolean close();
188    boolean put(in string key, in string value);
189    boolean putkeep(in string key, in string value);
190    boolean putcat(in string key, in string value);
191    boolean out(in string key);
192    string get(in string key);
193    long vsiz(in string key);
194    boolean iterinit();
195    string iternext();
196    List range(in string interval, in long max);
197    long addint(in string key, in long num);
198    double adddouble(in string key, in double num);
199    boolean sync();
200    boolean optimize(in long width, in long long limsiz);
201    boolean vanish();
202    boolean copy(in string path);
203    boolean tranbegin();
204    boolean trancommit();
205    boolean tranabort();
206    string path();
207    long long rnum();
208    long long fsiz();
209  };
210  //----------------------------------------------------------------
211  // the table database API
212  //----------------------------------------------------------------
213  interface TDB :ECODE {
214    const long TLARGE = 1 << 0;
215    const long TDEFLATE = 1 << 1;
216    const long TBZIP = 1 << 2;
217    const long TTCBS = 1 << 3;
218    const long OREADER = 1 << 0;
219    const long OWRITER = 1 << 1;
220    const long OCREAT = 1 << 2;
221    const long OTRUNC = 1 << 3;
222    const long ONOLCK = 1 << 4;
223    const long OLCKNB = 1 << 5;
224    const long OTSYNC = 1 << 6;
225    const long ITLEXICAL = 0;
226    const long ITDECIMAL = 1;
227    const long ITTOKEN = 2;
228    const long ITQGRAM = 3;
229    const long ITOPT = 9998;
230    const long ITVOID = 9999;
231    const long ITKEEP = 1 << 24;
232    boolean tune(in long long bnum, in long apow, in long fpow, in long opts);
233    boolean setcache(in long rcnum, in long lcnum, in long ncnum);
234    boolean setxmsiz(in long long xmsiz);
235    boolean setdfunit(in long dfunit);
236    boolean open(in string path, in long omode);
237    boolean close();
238    boolean put(in string pkey, in Map cols);
239    boolean putkeep(in string pkey, in Map cols);
240    boolean putcat(in string pkey, in Map cols);
241    boolean out(in string pkey);
242    Map get(in string pkey);
243    long vsiz(in string pkey);
244    boolean iterinit();
245    string iternext();
246    List fwmkeys(in string prefix, in long max);
247    long addint(in string pkey, in long num);
248    double adddouble(in string pkey, in double num);
249    boolean sync();
250    boolean optimize(in long long bnum, in long apow, in long fpow, in long opts);
251    boolean vanish();
252    boolean copy(in string path);
253    boolean tranbegin();
254    boolean trancommit();
255    boolean tranabort();
256    string path();
257    long long rnum();
258    long long fsiz();
259    boolean setindex(in string name, in long type);
260    long long genuid();
261  };
262  //----------------------------------------------------------------
263  // the table query API
264  //----------------------------------------------------------------
265  interface TDBQRY {
266    const long QCSTREQ = 0;
267    const long QCSTRINC = 1;
268    const long QCSTRBW = 2;
269    const long QCSTREW = 3;
270    const long QCSTRAND = 4;
271    const long QCSTROR = 5;
272    const long QCSTROREQ = 6;
273    const long QCSTRRX = 7;
274    const long QCNUMEQ = 8;
275    const long QCNUMGT = 9;
276    const long QCNUMGE = 10;
277    const long QCNUMLT = 11;
278    const long QCNUMLE = 12;
279    const long QCNUMBT = 13;
280    const long QCNUMOREQ = 14;
281    const long QCFTSPH = 15;
282    const long QCFTSAND = 16;
283    const long QCFTSOR = 17;
284    const long QCFTSEX = 18;
285    const long QCNEGATE = 1 << 24;
286    const long QCNOIDX = 1 << 25;
287    const long QOSTRASC = 0;
288    const long QOSTRDESC = 1;
289    const long QONUMASC = 2;
290    const long QONUMDESC = 3;
291    const long MSUNION = 0;
292    const long MSISECT = 1;
293    const long MSDIFF = 2;
294    void addcond(in string name, in long op, in string expr);
295    void setorder(in string name, in long type);
296    void setlimit(in long max, in long skip);
297    List search();
298    boolean searchout();
299    string hint();
300    typedef sequence<TDBQRY> QueryList;
301    List metasearch(in QueryList qrys, in long type);
302  };
303  //----------------------------------------------------------------
304  // the abstract database API
305  //----------------------------------------------------------------
306  interface ADB {
307    boolean open(in string name);
308    boolean close();
309    boolean put(in string key, in string value);
310    boolean putkeep(in string key, in string value);
311    boolean putcat(in string key, in string value);
312    boolean out(in string key);
313    string get(in string key);
314    long vsiz(in string key);
315    boolean iterinit();
316    string iternext();
317    List fwmkeys(in string prefix, in long max);
318    long addint(in string key, in long num);
319    double adddouble(in string key, in double num);
320    boolean sync();
321    boolean optimize(in string params);
322    boolean vanish();
323    boolean copy(in string path);
324    boolean tranbegin();
325    boolean trancommit();
326    boolean tranabort();
327    string path();
328    long long rnum();
329    long long size();
330    List misc(in string name, in List args);
331  };
332};
333
334
335
336/* END OF FILE */
337