-
Notifications
You must be signed in to change notification settings - Fork 1
/
kyotocabinet.idl
263 lines (258 loc) · 10 KB
/
kyotocabinet.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/*************************************************************************************************
* IDL for bindings of scripting languages
* Copyright (C) 2009-2012 FAL Labs
* This file is part of Kyoto Cabinet.
* This program is free software: you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation, either version
* 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*************************************************************************************************/
/**
* namespace of Kyoto Cabinet
*/
module kyotocabinet {
//----------------------------------------------------------------
// prediction
//----------------------------------------------------------------
interface List;
interface Map;
interface Error;
interface Visitor;
interface FileProcessor;
interface Logger;
interface Cursor;
interface DB;
//----------------------------------------------------------------
// list of strings (substituted by the native mechanism)
//----------------------------------------------------------------
interface List {
string get(in long index);
};
//----------------------------------------------------------------
// map of strings (substituted by the native mechanism)
//----------------------------------------------------------------
interface Map {
string get(in string key);
};
//----------------------------------------------------------------
// error information
//----------------------------------------------------------------
interface Error {
const long SUCCESS = 0;
const long NOIMPL = 1;
const long INVALID = 2;
const long NOREPOS = 3;
const long NOPERM = 4;
const long BROKEN = 5;
const long DUPREC = 6;
const long NOREC = 7;
const long LOGIC = 8;
const long SYSTEM = 9;
const long MISC = 15;
long code();
string name();
string message();
};
//----------------------------------------------------------------
// record visitor
//----------------------------------------------------------------
interface Visitor {
const string NOP = "";
const string REMOVE = "";
string visit_full(in string key, in string value);
string visit_empty(in string key);
};
//----------------------------------------------------------------
// file processor
//----------------------------------------------------------------
interface FileProcessor {
boolean process(in string path, in long long count, in long long size);
};
//----------------------------------------------------------------
// event logger
//----------------------------------------------------------------
interface Logger {
const long INFO = 0;
const long WARN = 1;
const long ERROR = 2;
void log(in string file, in long line, in string func, in long kind, in string message);
};
//----------------------------------------------------------------
// meta operation trigger
//----------------------------------------------------------------
interface MetaTrigger {
const long OPEN = 0;
const long CLOSE = 1;
const long CLEAR = 2;
const long ITERATE = 3;
const long SYNCHRONIZE = 4;
const long OCCUPY = 5;
const long BEGINTRAN = 6;
const long COMMITTRAN = 7;
const long ABORTTRAN = 8;
const long MISC = 15;
void trigger(in long kind, in string message);
};
//----------------------------------------------------------------
// cursor
//----------------------------------------------------------------
interface Cursor {
boolean accept(inout Visitor visitor, in boolean writable, in boolean step);
boolean set_value(in string value, in boolean step);
boolean remove();
string get_key(in boolean step);
string get_value(in boolean step);
boolean jump();
boolean jump_(in string key);
boolean jump_back();
boolean jump_back_(in string key);
boolean step();
boolean step_back();
DB db();
Error error();
};
//----------------------------------------------------------------
// common database operations
//----------------------------------------------------------------
interface DB {
const long OREADER = 1 << 0;
const long OWRITER = 1 << 1;
const long OCREATE = 1 << 2;
const long OTRUNCATE = 1 << 3;
const long OAUTOTRAN = 1 << 4;
const long OAUTOSYNC = 1 << 5;
const long ONOLOCK = 1 << 6;
const long OTRYLOCK = 1 << 7;
const long ONOREPAIR = 1 << 8;
Error error();
boolean open(in string path, in long mode);
boolean close();
boolean accept(in string key, inout Visitor visitor, in boolean writable);
boolean accept_bulk(in List keys, inout Visitor visitor, in boolean writable);
boolean iterate(inout Visitor visitor, in boolean writable);
boolean scan_parallel(inout Visitor visitor, in long thnum);
boolean set(in string key, in string value);
boolean add(in string key, in string value);
boolean replace(in string key, in string value);
boolean append(in string key, in string value);
long long increment(in string key, in long long num, in long long orig);
double increment_double(in string key, in double num, in double orig);
boolean cas(in string key, in string oval, in string nval);
boolean remove(in string key);
string get(in string key);
long check(in string key);
string seize(in string key);
long long set_bulk(in Map recs);
long long remove_bulk(in List keys);
Map get_bulk(in List keys);
boolean clear();
boolean synchronize(in boolean hard, inout FileProcessor proc);
boolean occupy(in boolean writable, inout FileProcessor proc);
boolean copy(in string dest);
boolean begin_transaction(in boolean hard);
boolean end_transaction(in boolean commit);
boolean dump_snapshot(in string dest);
boolean load_snapshot(in string src);
long long count();
long long size();
string path();
Map status();
Cursor cursor();
boolean tune_logger(inout Logger logger);
boolean tune_meta_trigger(inout MetaTrigger trigger);
};
//----------------------------------------------------------------
// prototype hash database
//----------------------------------------------------------------
interface ProtoHashDB :DB {
};
//----------------------------------------------------------------
// prototype tree database
//----------------------------------------------------------------
interface ProtoTreeDB :DB {
};
//----------------------------------------------------------------
// stash database
//----------------------------------------------------------------
interface StashDB :DB {
boolean tune_buckets(in long long bnum);
};
//----------------------------------------------------------------
// cache hash database
//----------------------------------------------------------------
interface CacheDB :DB {
boolean tune_options(in long opts);
boolean tune_buckets(in long long bnum);
boolean cap_count(in long long count);
boolean cap_size(in long long size);
};
//----------------------------------------------------------------
// cache tree database
//----------------------------------------------------------------
interface GrassDB :DB {
boolean tune_options(in long opts);
boolean tune_buckets(in long long bnum);
boolean tune_page(in long psiz);
boolean tune_page_cache(in long long pccap);
};
//----------------------------------------------------------------
// file hash database
//----------------------------------------------------------------
interface HashDB :DB {
const long TSMALL = 1 << 0;
const long TLINEAR = 1 << 1;
const long TCOMPRESS = 1 << 2;
boolean tune_alignment(in long apow);
boolean tune_fbp(in long fpow);
boolean tune_options(in long opts);
boolean tune_buckets(in long long bnum);
boolean tune_map(in long long msiz);
boolean tune_defrag(in long dfunit);
};
//----------------------------------------------------------------
// file tree database
//----------------------------------------------------------------
interface TreeDB :DB {
const long TSMALL = 1 << 0;
const long TLINEAR = 1 << 1;
const long TCOMPRESS = 1 << 2;
boolean tune_alignment(in long apow);
boolean tune_fbp(in long fpow);
boolean tune_options(in long opts);
boolean tune_buckets(in long long bnum);
boolean tune_page(in long psiz);
boolean tune_map(in long long msiz);
boolean tune_defrag(in long dfunit);
boolean tune_page_cache(in long long pccap);
};
//----------------------------------------------------------------
// directory hash database
//----------------------------------------------------------------
interface DirDB :DB {
const long TCOMPRESS = 1 << 2;
boolean tune_options(in long opts);
};
//----------------------------------------------------------------
// directory tree database
//----------------------------------------------------------------
interface ForestDB :DB {
const long TCOMPRESS = 1 << 2;
boolean tune_options(in long opts);
boolean tune_buckets(in long long bnum);
boolean tune_page(in long psiz);
boolean tune_page_cache(in long long pccap);
};
//----------------------------------------------------------------
// polymorphic database
//----------------------------------------------------------------
interface PolyDB :DB {
List match_prefix(in string prefix, in long long max);
List match_regex(in string regex, in long long max);
List match_similar(in string origin, in long long range, in boolean utf, in long long max);
};
};
/* END OF FILE */