This file is indexed.

/usr/share/doc/qdbm-doc/rbapidoc/curia.rb.html is in qdbm-doc 1.8.78-6build3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="contents" href="./" />
<link rev="made" href="mailto:mikio@fallabs.com" />
<title>curia (QDBM for Ruby)</title>
<style type="text/css">html { margin: 0em 0em; padding 0em 0em; background: #eeeeee none; }
body { background-color: #eeeeee; color: #111111; padding: 1.5em 2em; margin: 0em 0em;
  border-left: double 3.0em #eedddd; border-right: solid 1.0em #eedddd;
  font-style: normal; font-weight: normal; font-family: serif; }
h1 { margin-top: 0.8em; margin-bottom: 1.3em; font-weight: bold; font-family: sans-serif; }
h2 { margin-top: 1.8em; margin-bottom: 1.1em; font-weight: bold; font-family: sans-serif; }
h3 { margin-top: 1.8em; margin-bottom: 0.8em; font-weight: bold; font-family: sans-serif; }
p,ul,ol,dl { line-height: 140%; }
em { color: #111111; font-style: italic; font-weight: normal; font-family: serif; }
kbd { color: #111111; font-style: normal; font-weight: bold; font-family: monospace; }
a { color: #0022aa; text-decoration: none; }
a:hover { color: #0033ee; text-decoration: underline; }
a.head { color: #111111; text-decoration: none; }
.note { text-align: right; }
</style>
</head>
<body>
<div class="note">[<a href="index.html">Back</a>]</div>
<h1>API of curia</h1>
<hr />
<dl>
<dt><kbd>require 'curia'</kbd></dt>
<dd>
The library `curia' should be included in application codes.
An instance of the class `Curia' is used as a database handle.
`Curia' performs Mix-in of `Enumerable'.
Each method of `Curia' throws an exception of `Curia::EANY' or its sub classes when an error
occurs: `Curia::ENOERR', `Curia::EFATAL', `Curia::EMODE', `Curia::EBROKEN', `Curia::EKEEP',
`Curia::ENOITEM', `Curia::EALLOC', `Curia::EMAP', `Curia::EOPEN', `Curia::ECLOSE',
`Curia::ETRUNC', `Curia::ESYNC', `Curia::ESTAT', `Curia::ESEEK', `Curia::EREAD',
`Curia::EWRITE', `Curia::ELOCK', `Curia::EUNLINK', `Curia::EMKDIR', `Curia::ERMDIR' and
`Curia::EMISC'.
</dd>
</dl>
<dl>
<dt><kbd>curia = Curia::new(name, omode, bnum, dnum)</kbd></dt>
<dd>
Constructor: Get a database handle.
`name' specifies the name of a database directory.
`omode' specifies the connection mode: `Curia::OWRITER' as a writer, `Curia::OREADER' as a
reader.  If the mode is `Curia::OWRITER', the following may be added by bitwise or:
`Curia::OCREAT', which means it creates a new database if not exist, `Curia::OTRUNC', which
means it creates a new database regardless if one exists.  Both of `Curia::OREADER' and
`Curia::OWRITER' can be added to by bitwise or: `Curia::ONOLCK', which means it opens a
database directory without file locking, or `Curia::OLCKNB', which means locking is
performed without blocking.  `Curia::OCREAT' can be added to by bitwise or: `Curia::OSPARSE',
which means it creates database files as sparse files.  If it is omitted, `Curia::OREADER'
is specified.
`bnum' specifies the number of elements of the bucket array.  If it is omitted or not more
than 0, the default value is specified.  The size of a bucket array is determined on
creating, and can not be changed except for by optimization of the database.  Suggested
size of a bucket array is about from 0.5 to 4 times of the number of all records to store.
`dnum' specifies the number of division of the database.  If it is omitted or not more than
0, the default value is specified.  The number of division can not be changed from the
initial value.  The max number of division is 512.
The return value is the database handle.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
If a block parameter is given, this method works as an iterator.  A database handle is
opened and passed via the first argument of the block.  The database handle is surely
closed when the block is over.
While connecting as a writer, an exclusive lock is invoked to the database directory.
While connecting as a reader, a shared lock is invoked to the database directory.  The thread
blocks until the lock is achieved.  If `Curia::ONOLCK' is used, the application is
responsible for exclusion control.
</dd>
</dl>
<dl>
<dt><kbd>curia = Curia::open(name, omode, bnum, dnum)</kbd></dt>
<dd>
Constructor: An alias of `new'.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.close()</kbd></dt>
<dd>
Method: Close the database handle.
The return value is always true.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
Because the region of a closed handle is released, it becomes impossible to use the handle.
Updating a database is assured to be written when the handle is closed.  If a writer opens
a database but does not close it appropriately, the database will be broken.
</dd>
</dl>
<dl>
<dt><kbd>curia.silent = bool</kbd></dt>
<dd>
Method: Set the flag whether to repress frequent exceptions.
The return value is the assigned value.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.put(key, val, dmode)</kbd></dt>
<dd>
Method: Store a record.
`key' specifies a key.  Although it must be an instance of String, binary data is okey.
`val' specifies a value.  Although it must be an instance of String, binary data is okey.
`dmode' specifies behavior when the key overlaps, by the following values: `Curia::DOVER',
which means the specified value overwrites the existing one, `Curia::DKEEP', which means
the existing value is kept, `Curia::DCAT', which means the specified value is concatenated
at the end of the existing value.  If it is omitted, `Curia::DOVER' is specified.
The return value is always true.  However, if the silent flag is true and replace is
cancelled, false is returned instead of exception.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or replace
is cancelled.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.store(key, val)</kbd></dt>
<dd>
Method: An alias of `put'.
</dd>
</dl>
<dl>
<dt><kbd>curia[key] = val</kbd></dt>
<dd>
Method: An alias of `put'.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.out(key)</kbd></dt>
<dd>
Method: Delete a record.
`key' specifies a key.  Although it must be an instance of String, binary data is okey.
The return value is always true.  However, if the silent flag is true and no record
corresponds, false is returned instead of exception.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or no record
corresponds.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.delete(key)</kbd></dt>
<dd>
Method: An alias of `out'.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.clear()</kbd></dt>
<dd>
Method: Delete all records.
The return value is always true.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
</dd>
</dl>
<dl>
<dt><kbd>str = curia.get(key, start, max)</kbd></dt>
<dd>
Method: Retrieve a record.
`key' specifies a key.  Although it must be an instance of String, binary data is okey.
`start' specifies the offset address of the beginning of the region of the value to be read.
If it is negative or omitted, the offset is specified as 0.
`max' specifies the max size to be read.  If it is negative or omitted, the size to read is
unlimited.
The return value is an instance of the value of the corresponding record.  If the silent flag
is true and no record corresponds, nil is returned instead of exception.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs, no record
corresponds, or the size of the value of the corresponding record is less than `max'.
</dd>
</dl>
<dl>
<dt><kbd>str = curia.fetch(key, defval)</kbd></dt>
<dd>
Method: Retrieve a record.
`key' specifies a key.  Although it must be an instance of String, binary data is okey.
`defval' specifies the default value used when no record corresponds.  If it is omitted, nil
is specified.
The return value is an instance of the value of the corresponding record, or the default
value if no record corresponds.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
</dd>
</dl>
<dl>
<dt><kbd>str = curia[key]</kbd></dt>
<dd>
Method: An alias of `fetch'.
</dd>
</dl>
<dl>
<dt><kbd>num = curia.vsiz(key)</kbd></dt>
<dd>
Method: Get the size of the value of a record.
`key' specifies a key.  Although it must be an instance of String, binary data is okey.
The return value is the size of the value of the corresponding record.  If the silent flag
is true and no record corresponds, -1 is returned instead of exception.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or no record
corresponds.
Because this method does not read the entity of a record, it is faster than `get'.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.iterinit()</kbd></dt>
<dd>
Method: Initialize the iterator of the database handle.
The return value is always true.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
The iterator is used in order to access the key of every record stored in a database.
</dd>
</dl>
<dl>
<dt><kbd>str = curia.iternext()</kbd></dt>
<dd>
Method: Get the next key of the iterator.
The return value is the value of the next key.  If the silent flag is true and no record
corresponds, nil is returned instead of exception.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or no record
is to be get out of the iterator.
It is possible to access every record by iteration of calling this method.  However, it is
not assured if updating the database is occurred while the iteration.  Besides, the order
of this traversal access method is arbitrary, so it is not assured that the order of
storing matches the one of the traversal access.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.setalign(align)</kbd></dt>
<dd>
Method: Set alignment of the database handle.
`align' specifies the basic size of alignment.  If it is omitted, alignment is cleared.
The return value is always true.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
If alignment is set to a database, the efficiency of overwriting values is improved.
The size of alignment is suggested to be average size of the values of the records to be
stored.  If alignment is positive, padding whose size is multiple number of the alignment
is placed.  If alignment is negative, as `vsiz' is the size of a value, the size of padding
is calculated with `(vsiz / pow(2, abs(align) - 1))'.  Because alignment setting is not
saved in a database, you should specify alignment every opening a database.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.setfbpsiz(size);</kbd></dt>
<dd>
Method: Set the size of the free block pool.
`size' specifies the size of the free block pool.  If it is undef, the free block pool is not
used.
The return value is always true.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
The default size of the free block pool is 16.  If the size is greater, the space efficiency
of overwriting values is improved with the time efficiency sacrificed.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.sync()</kbd></dt>
<dd>
Method: Synchronize updating contents with the files and the devices.
The return value is always true.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
This method is useful when another process uses the connected database directory.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.optimize(bnum)</kbd></dt>
<dd>
Method: Optimize the database.
`bnum' specifies the number of the elements of the bucket array.  If it is omitted or not
more than 0, the default value is specified.
The return value is always true.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
In an alternating succession of deleting and storing with overwrite or concatenate,
dispensable regions accumulate.  This method is useful to do away with them.
</dd>
</dl>
<dl>
<dt><kbd>num = curia.fsiz()</kbd></dt>
<dd>
Method: Get the total size of the database files.
The return value is the total size of the database files.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
If the total size is more than 2GB, the return value overflows.
</dd>
</dl>
<dl>
<dt><kbd>num = curia.bnum()</kbd></dt>
<dd>
Method: Get the total number of the elements of each bucket array.
The return value is the total number of the elements of each bucket array
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
</dd>
</dl>
<dl>
<dt><kbd>num = curia.rnum()</kbd></dt>
<dd>
Method: Get the number of the records stored in the database.
The return value is the number of the records stored in the database.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
</dd>
</dl>
<dl>
<dt><kbd>num = curia.length()</kbd></dt>
<dd>
Method: An alias of `rnum'.
</dd>
</dl>
<dl>
<dt><kbd>num = curia.size()</kbd></dt>
<dd>
Method: An alias of `rnum'.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.writable()</kbd></dt>
<dd>
Method: Check whether the database handle is a writer or not.
The return value is true if the handle is a writer, false if not.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
</dd>
</dl>
<dl>
<dt><kbd>bool = curia.fatalerror()</kbd></dt>
<dd>
Method: Check whether the database has a fatal error or not.
The return value is true if the database has a fatal error, false if not.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
</dd>
</dl>
<dl>
<dt><kbd>curia.each() do |key, val| ... end</kbd></dt>
<dd>
Iterator Method: Iterate a process with a pair of a key and a value of each record.
</dd>
</dl>
<dl>
<dt><kbd>curia.each_pair() do |key, val| ... end</kbd></dt>
<dd>
Iterator Method: An alias of `each'.
</dd>
</dl>
<dl>
<dt><kbd>curia.each_key() do |key| ... end</kbd></dt>
<dd>
Iterator Method: Iterate a process with a key of each record.
</dd>
</dl>
<dl>
<dt><kbd>curia.each_value() do |val| ... end</kbd></dt>
<dd>
Iterator Method: Iterate a process with a value of each record.
</dd>
</dl>
<dl>
<dt><kbd>ary = curia.keys()</kbd></dt>
<dd>
Method: Get an array of all keys.
The return value is an array of all keys.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
</dd>
</dl>
<dl>
<dt><kbd>ary = curia.values()</kbd></dt>
<dd>
Method: Get an array of all values.
The return value is an array of all values.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs.
</dd>
</dl>
<dl>
<dt><kbd>str = curia.index(val)</kbd></dt>
<dd>
Method: Retrieve a record with a value.
`val' specifies a value.  Although it must be an instance of String, binary data is okey.
The return value is the key of the record with the specified value.
An exception of `Curia::EANY' or its sub classes is thrown if an error occurs or no record
corresponds.
If two or more records correspond, the first found record is selected.
</dd>
</dl>
<dl>
<dt><kbd>num = curia.to_int()</kbd></dt>
<dd>
Method: An alias of `rnum'.
</dd>
</dl>
<dl>
<dt><kbd>num = curia.to_i()</kbd></dt>
<dd>
Method: An alias of `to_int'.
</dd>
</dl>
<dl>
<dt><kbd>str = curia.to_str()</kbd></dt>
<dd>
Method: Get string standing for the instance.
</dd>
</dl>
<dl>
<dt><kbd>str = curia.to_s()</kbd></dt>
<dd>
Method: An alias of `to_str'.
</dd>
</dl>
<dl>
<dt><kbd>ary = curia.to_ary()</kbd></dt>
<dd>
Method: Get an array of alternation of each pair of key and value.
</dd>
</dl>
<dl>
<dt><kbd>ary = curia.to_a()</kbd></dt>
<dd>
Method: An alias of `to_ary'.
</dd>
</dl>
<dl>
<dt><kbd>hash = curia.to_hash()</kbd></dt>
<dd>
Method: Get a hash storing all records.
</dd>
</dl>
<dl>
<dt><kbd>hash = curia.to_h()</kbd></dt>
<dd>
Method: An alias of `to_hash'.
</dd>
</dl>
<dl>
<dt><kbd>str = curia.inspect()</kbd></dt>
<dd>
Method: An alias of `to_str'.
</dd>
</dl>
<hr />
<div class="note">Generated by ./myrbdoc, 2010/08/05.</div>
</body>
</html>