1 /*************************************************************************************************
2 * IDL for bindings of scripting languages
3 * Copyright (C) 2006-2008 Mikio Hirabayashi
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 *************************************************************************************************/
18 * namespace of Tokyo Cabinet
21 //----------------------------------------------------------------
22 // list of strings (substituted for by the native mechanism).
23 //----------------------------------------------------------------
25 string get(in long index);
27 //----------------------------------------------------------------
29 //----------------------------------------------------------------
31 const long ESUCCESS = 0;
32 const long ETHREAD = 1;
33 const long EINVALID = 2;
34 const long ENOFILE = 3;
35 const long ENOPERM = 4;
37 const long ERHEAD = 6;
39 const long ECLOSE = 8;
40 const long ETRUNC = 9;
41 const long ESYNC = 10;
42 const long ESTAT = 11;
43 const long ESEEK = 12;
44 const long EREAD = 13;
45 const long EWRITE = 14;
46 const long EMMAP = 15;
47 const long ELOCK = 16;
48 const long EUNLINK = 17;
49 const long ERENAME = 18;
50 const long EMKDIR = 19;
51 const long ERMDIR = 20;
52 const long EKEEP = 21;
53 const long ENOREC = 22;
54 const long EMISC = 9999;
55 string errmsg(in long ecode);
57 //----------------------------------------------------------------
58 // the hash database API
59 //----------------------------------------------------------------
60 interface HDB :ECODE {
61 const long TLARGE = 1 << 0;
62 const long TDEFLATE = 1 << 1;
63 const long TTCBS = 1 << 2;
64 const long OREADER = 1 << 0;
65 const long OWRITER = 1 << 1;
66 const long OCREAT = 1 << 2;
67 const long OTRUNC = 1 << 3;
68 const long ONOLCK = 1 << 4;
69 const long OLCKNB = 1 << 5;
71 boolean tune(in long long bnum, in long apow, in long fpow, in long opts);
72 boolean setcache(in long rcnum);
73 boolean open(in string path, in long omode);
75 boolean put(in string key, in string value);
76 boolean putkeep(in string key, in string value);
77 boolean putcat(in string key, in string value);
78 boolean putasync(in string key, in string value);
79 boolean out(in string key);
80 string get(in string key);
81 long vsiz(in string key);
84 List fwmkeys(in string prefix, in long max);
86 boolean optimize(in long long bnum, in long apow, in long fpow, in long opts);
88 boolean copy(in string path);
93 //----------------------------------------------------------------
94 // the B+ tree database API
95 //----------------------------------------------------------------
96 interface BDB :ECODE {
97 const long TLARGE = 1 << 0;
98 const long TDEFLATE = 1 << 1;
99 const long TTCBS = 1 << 2;
100 const long OREADER = 1 << 0;
101 const long OWRITER = 1 << 1;
102 const long OCREAT = 1 << 2;
103 const long OTRUNC = 1 << 3;
104 const long ONOLCK = 1 << 4;
105 const long OLCKNB = 1 << 5;
107 boolean tune(in long lmemb, in long nmemb,
108 in long long bnum, in long apow, in long fpow, in long opts);
109 boolean setcache(in long lcnum, in long ncnum);
110 boolean open(in string path, in long omode);
112 boolean put(in string key, in string value);
113 boolean putkeep(in string key, in string value);
114 boolean putcat(in string key, in string value);
115 boolean putdup(in string key, in string value);
116 boolean putlist(in string key, in List values);
117 boolean out(in string key);
118 boolean outlist(in string key);
119 string get(in string key);
120 List getlist(in string key);
121 long vnum(in string key);
122 long vsiz(in string key);
123 List range(in string bkey, in boolean binc, in string ekey, in boolean einc, in long max);
124 List fwmkeys(in string prefix, in long max);
126 boolean optimize(in long lmemb, in long nmemb,
127 in long long bnum, in long apow, in long fpow, in long opts);
129 boolean copy(in string path);
131 boolean trancommit();
137 //----------------------------------------------------------------
138 // the B+ tree cursor API
139 //----------------------------------------------------------------
141 const long CPCURRENT = 0;
142 const long CPBEFORE = 1;
143 const long CPAFTER = 2;
146 boolean jump(in string key);
149 boolean put(in string value, in long cpmode);