1 |
<?xml version="1.0" encoding="iso-8859-1"?> |
2 |
<!DOCTYPE html |
3 |
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
4 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
5 |
|
6 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
7 |
<head> |
8 |
<title>Class: Estraier::Node</title> |
9 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
10 |
<meta http-equiv="Content-Script-Type" content="text/javascript" /> |
11 |
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> |
12 |
<script type="text/javascript"> |
13 |
// <![CDATA[ |
14 |
|
15 |
function popupCode( url ) { |
16 |
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") |
17 |
} |
18 |
|
19 |
function toggleCode( id ) { |
20 |
if ( document.getElementById ) |
21 |
elem = document.getElementById( id ); |
22 |
else if ( document.all ) |
23 |
elem = eval( "document.all." + id ); |
24 |
else |
25 |
return false; |
26 |
|
27 |
elemStyle = elem.style; |
28 |
|
29 |
if ( elemStyle.display != "block" ) { |
30 |
elemStyle.display = "block" |
31 |
} else { |
32 |
elemStyle.display = "none" |
33 |
} |
34 |
|
35 |
return true; |
36 |
} |
37 |
|
38 |
// Make codeblocks hidden by default |
39 |
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) |
40 |
|
41 |
// ]]> |
42 |
</script> |
43 |
|
44 |
</head> |
45 |
<body> |
46 |
|
47 |
|
48 |
|
49 |
<div id="classHeader"> |
50 |
<table class="header-table"> |
51 |
<tr class="top-aligned-row"> |
52 |
<td><strong>Class</strong></td> |
53 |
<td class="class-name-in-header">Estraier::Node</td> |
54 |
</tr> |
55 |
<tr class="top-aligned-row"> |
56 |
<td><strong>In:</strong></td> |
57 |
<td> |
58 |
<a href="../../files/estraier_rb.html"> |
59 |
estraier.rb |
60 |
</a> |
61 |
<br /> |
62 |
</td> |
63 |
</tr> |
64 |
|
65 |
<tr class="top-aligned-row"> |
66 |
<td><strong>Parent:</strong></td> |
67 |
<td> |
68 |
Object |
69 |
</td> |
70 |
</tr> |
71 |
</table> |
72 |
</div> |
73 |
<!-- banner header --> |
74 |
|
75 |
<div id="bodyContent"> |
76 |
|
77 |
|
78 |
|
79 |
<div id="contextContent"> |
80 |
|
81 |
<div id="description"> |
82 |
<p> |
83 |
Abstraction of connection to P2P node. |
84 |
</p> |
85 |
|
86 |
</div> |
87 |
|
88 |
|
89 |
</div> |
90 |
|
91 |
<div id="method-list"> |
92 |
<h3 class="section-bar">Methods</h3> |
93 |
|
94 |
<div class="name-list"> |
95 |
<a href="#M000016">doc_num</a> |
96 |
<a href="#M000009">get_doc</a> |
97 |
<a href="#M000011">get_doc_attr</a> |
98 |
<a href="#M000012">get_doc_attr_by_uri</a> |
99 |
<a href="#M000010">get_doc_by_uri</a> |
100 |
<a href="#M000015">label</a> |
101 |
<a href="#M000014">name</a> |
102 |
<a href="#M000022">new</a> |
103 |
<a href="#M000007">out_doc</a> |
104 |
<a href="#M000008">out_doc_by_uri</a> |
105 |
<a href="#M000006">put_doc</a> |
106 |
<a href="#M000019">search</a> |
107 |
<a href="#M000004">set_auth</a> |
108 |
<a href="#M000021">set_link</a> |
109 |
<a href="#M000002">set_proxy</a> |
110 |
<a href="#M000003">set_timeout</a> |
111 |
<a href="#M000001">set_url</a> |
112 |
<a href="#M000020">set_user</a> |
113 |
<a href="#M000018">size</a> |
114 |
<a href="#M000005">status</a> |
115 |
<a href="#M000013">uri_to_id</a> |
116 |
<a href="#M000017">word_num</a> |
117 |
</div> |
118 |
</div> |
119 |
|
120 |
</div> |
121 |
|
122 |
|
123 |
<!-- if includes --> |
124 |
|
125 |
<div id="section"> |
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
<!-- if method_list --> |
135 |
<div id="methods"> |
136 |
<h3 class="section-bar">Public Class methods</h3> |
137 |
|
138 |
<div id="method-M000022" class="method-detail"> |
139 |
<a name="M000022"></a> |
140 |
|
141 |
<div class="method-heading"> |
142 |
<a href="Node.src/M000022.html" target="Code" class="method-signature" |
143 |
onclick="popupCode('Node.src/M000022.html');return false;"> |
144 |
<span class="method-name">new</span><span class="method-args">()</span> |
145 |
</a> |
146 |
</div> |
147 |
|
148 |
<div class="method-description"> |
149 |
<p> |
150 |
Create a node connection object. |
151 |
</p> |
152 |
</div> |
153 |
</div> |
154 |
|
155 |
<h3 class="section-bar">Public Instance methods</h3> |
156 |
|
157 |
<div id="method-M000016" class="method-detail"> |
158 |
<a name="M000016"></a> |
159 |
|
160 |
<div class="method-heading"> |
161 |
<a href="Node.src/M000016.html" target="Code" class="method-signature" |
162 |
onclick="popupCode('Node.src/M000016.html');return false;"> |
163 |
<span class="method-name">doc_num</span><span class="method-args">()</span> |
164 |
</a> |
165 |
</div> |
166 |
|
167 |
<div class="method-description"> |
168 |
<p> |
169 |
Get the number of documents. The return value is the number of documents. |
170 |
On error, -1 is returned. |
171 |
</p> |
172 |
</div> |
173 |
</div> |
174 |
|
175 |
<div id="method-M000009" class="method-detail"> |
176 |
<a name="M000009"></a> |
177 |
|
178 |
<div class="method-heading"> |
179 |
<a href="Node.src/M000009.html" target="Code" class="method-signature" |
180 |
onclick="popupCode('Node.src/M000009.html');return false;"> |
181 |
<span class="method-name">get_doc</span><span class="method-args">(id)</span> |
182 |
</a> |
183 |
</div> |
184 |
|
185 |
<div class="method-description"> |
186 |
<p> |
187 |
Retrieve a document. `id’ specifies the ID number of a registered |
188 |
document. The return value is a document object. On error, nil is returned. |
189 |
</p> |
190 |
</div> |
191 |
</div> |
192 |
|
193 |
<div id="method-M000011" class="method-detail"> |
194 |
<a name="M000011"></a> |
195 |
|
196 |
<div class="method-heading"> |
197 |
<a href="Node.src/M000011.html" target="Code" class="method-signature" |
198 |
onclick="popupCode('Node.src/M000011.html');return false;"> |
199 |
<span class="method-name">get_doc_attr</span><span class="method-args">(id, name)</span> |
200 |
</a> |
201 |
</div> |
202 |
|
203 |
<div class="method-description"> |
204 |
<p> |
205 |
Retrieve the value of an attribute of a document. `id’ specifies the |
206 |
ID number of a registered document. `name’ specifies the name of an |
207 |
attribute. The return value is the value of the attribute or nil if it does |
208 |
not exist. |
209 |
</p> |
210 |
</div> |
211 |
</div> |
212 |
|
213 |
<div id="method-M000012" class="method-detail"> |
214 |
<a name="M000012"></a> |
215 |
|
216 |
<div class="method-heading"> |
217 |
<a href="Node.src/M000012.html" target="Code" class="method-signature" |
218 |
onclick="popupCode('Node.src/M000012.html');return false;"> |
219 |
<span class="method-name">get_doc_attr_by_uri</span><span class="method-args">(uri, name)</span> |
220 |
</a> |
221 |
</div> |
222 |
|
223 |
<div class="method-description"> |
224 |
<p> |
225 |
Retrieve the value of an attribute of a document specified by URI. |
226 |
`uri’ specifies the URI of a registered document. `name’ |
227 |
specifies the name of an attribute. The return value is the value of the |
228 |
attribute or nil if it does not exist. |
229 |
</p> |
230 |
</div> |
231 |
</div> |
232 |
|
233 |
<div id="method-M000010" class="method-detail"> |
234 |
<a name="M000010"></a> |
235 |
|
236 |
<div class="method-heading"> |
237 |
<a href="Node.src/M000010.html" target="Code" class="method-signature" |
238 |
onclick="popupCode('Node.src/M000010.html');return false;"> |
239 |
<span class="method-name">get_doc_by_uri</span><span class="method-args">(uri)</span> |
240 |
</a> |
241 |
</div> |
242 |
|
243 |
<div class="method-description"> |
244 |
<p> |
245 |
Retrieve a document. `uri’ specifies the URI of a registered |
246 |
document. The return value is a document object. On error, nil is returned. |
247 |
</p> |
248 |
</div> |
249 |
</div> |
250 |
|
251 |
<div id="method-M000015" class="method-detail"> |
252 |
<a name="M000015"></a> |
253 |
|
254 |
<div class="method-heading"> |
255 |
<a href="Node.src/M000015.html" target="Code" class="method-signature" |
256 |
onclick="popupCode('Node.src/M000015.html');return false;"> |
257 |
<span class="method-name">label</span><span class="method-args">()</span> |
258 |
</a> |
259 |
</div> |
260 |
|
261 |
<div class="method-description"> |
262 |
<p> |
263 |
Get the label. The return value is the label. On error, nil is returned. |
264 |
</p> |
265 |
</div> |
266 |
</div> |
267 |
|
268 |
<div id="method-M000014" class="method-detail"> |
269 |
<a name="M000014"></a> |
270 |
|
271 |
<div class="method-heading"> |
272 |
<a href="Node.src/M000014.html" target="Code" class="method-signature" |
273 |
onclick="popupCode('Node.src/M000014.html');return false;"> |
274 |
<span class="method-name">name</span><span class="method-args">()</span> |
275 |
</a> |
276 |
</div> |
277 |
|
278 |
<div class="method-description"> |
279 |
<p> |
280 |
Get the name. The return value is the name. On error, nil is returned. |
281 |
</p> |
282 |
</div> |
283 |
</div> |
284 |
|
285 |
<div id="method-M000007" class="method-detail"> |
286 |
<a name="M000007"></a> |
287 |
|
288 |
<div class="method-heading"> |
289 |
<a href="Node.src/M000007.html" target="Code" class="method-signature" |
290 |
onclick="popupCode('Node.src/M000007.html');return false;"> |
291 |
<span class="method-name">out_doc</span><span class="method-args">(id)</span> |
292 |
</a> |
293 |
</div> |
294 |
|
295 |
<div class="method-description"> |
296 |
<p> |
297 |
Remove a document. `id’ specifies the ID number of a registered |
298 |
document. The return value is true if success, else it is false. |
299 |
</p> |
300 |
</div> |
301 |
</div> |
302 |
|
303 |
<div id="method-M000008" class="method-detail"> |
304 |
<a name="M000008"></a> |
305 |
|
306 |
<div class="method-heading"> |
307 |
<a href="Node.src/M000008.html" target="Code" class="method-signature" |
308 |
onclick="popupCode('Node.src/M000008.html');return false;"> |
309 |
<span class="method-name">out_doc_by_uri</span><span class="method-args">(uri)</span> |
310 |
</a> |
311 |
</div> |
312 |
|
313 |
<div class="method-description"> |
314 |
<pre> |
315 |
Remove a document specified by URI. |
316 |
</pre> |
317 |
<p> |
318 |
`uri’ specifies the URI of a registered document. The return value is |
319 |
true if success, else it is false. |
320 |
</p> |
321 |
</div> |
322 |
</div> |
323 |
|
324 |
<div id="method-M000006" class="method-detail"> |
325 |
<a name="M000006"></a> |
326 |
|
327 |
<div class="method-heading"> |
328 |
<a href="Node.src/M000006.html" target="Code" class="method-signature" |
329 |
onclick="popupCode('Node.src/M000006.html');return false;"> |
330 |
<span class="method-name">put_doc</span><span class="method-args">(doc)</span> |
331 |
</a> |
332 |
</div> |
333 |
|
334 |
<div class="method-description"> |
335 |
<p> |
336 |
Add a document. `doc’ specifies a document object. The document |
337 |
object should have the URI attribute. The return value is true if success, |
338 |
else it is false. |
339 |
</p> |
340 |
</div> |
341 |
</div> |
342 |
|
343 |
<div id="method-M000019" class="method-detail"> |
344 |
<a name="M000019"></a> |
345 |
|
346 |
<div class="method-heading"> |
347 |
<a href="Node.src/M000019.html" target="Code" class="method-signature" |
348 |
onclick="popupCode('Node.src/M000019.html');return false;"> |
349 |
<span class="method-name">search</span><span class="method-args">(cond, depth)</span> |
350 |
</a> |
351 |
</div> |
352 |
|
353 |
<div class="method-description"> |
354 |
<p> |
355 |
Search documents corresponding a condition. `cond’ specifies a |
356 |
condition object. `depth’ specifies the depth of meta search. The |
357 |
return value is a node result object. On error, nil is returned. |
358 |
</p> |
359 |
</div> |
360 |
</div> |
361 |
|
362 |
<div id="method-M000004" class="method-detail"> |
363 |
<a name="M000004"></a> |
364 |
|
365 |
<div class="method-heading"> |
366 |
<a href="Node.src/M000004.html" target="Code" class="method-signature" |
367 |
onclick="popupCode('Node.src/M000004.html');return false;"> |
368 |
<span class="method-name">set_auth</span><span class="method-args">(name, password)</span> |
369 |
</a> |
370 |
</div> |
371 |
|
372 |
<div class="method-description"> |
373 |
<p> |
374 |
Set the authentication information. `name’ specifies the name of |
375 |
authentication. `passwd’ specifies the password of the |
376 |
authentication. |
377 |
</p> |
378 |
</div> |
379 |
</div> |
380 |
|
381 |
<div id="method-M000021" class="method-detail"> |
382 |
<a name="M000021"></a> |
383 |
|
384 |
<div class="method-heading"> |
385 |
<a href="Node.src/M000021.html" target="Code" class="method-signature" |
386 |
onclick="popupCode('Node.src/M000021.html');return false;"> |
387 |
<span class="method-name">set_link</span><span class="method-args">(url, label, credit)</span> |
388 |
</a> |
389 |
</div> |
390 |
|
391 |
<div class="method-description"> |
392 |
<p> |
393 |
Manage a link of a node. `url’ specifies the URL of the target node |
394 |
of a link. `label’ specifies the label of the link. `credit’ |
395 |
specifies the credit of the link. If it is negative, the link is removed. |
396 |
The return value is true if success, else it is false. |
397 |
</p> |
398 |
</div> |
399 |
</div> |
400 |
|
401 |
<div id="method-M000002" class="method-detail"> |
402 |
<a name="M000002"></a> |
403 |
|
404 |
<div class="method-heading"> |
405 |
<a href="Node.src/M000002.html" target="Code" class="method-signature" |
406 |
onclick="popupCode('Node.src/M000002.html');return false;"> |
407 |
<span class="method-name">set_proxy</span><span class="method-args">(host, port)</span> |
408 |
</a> |
409 |
</div> |
410 |
|
411 |
<div class="method-description"> |
412 |
<p> |
413 |
Set the proxy information. `host’ specifies the host name of a proxy |
414 |
server. `port’ specifies the port number of the proxy server. |
415 |
</p> |
416 |
</div> |
417 |
</div> |
418 |
|
419 |
<div id="method-M000003" class="method-detail"> |
420 |
<a name="M000003"></a> |
421 |
|
422 |
<div class="method-heading"> |
423 |
<a href="Node.src/M000003.html" target="Code" class="method-signature" |
424 |
onclick="popupCode('Node.src/M000003.html');return false;"> |
425 |
<span class="method-name">set_timeout</span><span class="method-args">(sec)</span> |
426 |
</a> |
427 |
</div> |
428 |
|
429 |
<div class="method-description"> |
430 |
<p> |
431 |
Set timeout of a connection. `sec’ specifies timeout of the |
432 |
connection in seconds. |
433 |
</p> |
434 |
</div> |
435 |
</div> |
436 |
|
437 |
<div id="method-M000001" class="method-detail"> |
438 |
<a name="M000001"></a> |
439 |
|
440 |
<div class="method-heading"> |
441 |
<a href="Node.src/M000001.html" target="Code" class="method-signature" |
442 |
onclick="popupCode('Node.src/M000001.html');return false;"> |
443 |
<span class="method-name">set_url</span><span class="method-args">(url)</span> |
444 |
</a> |
445 |
</div> |
446 |
|
447 |
<div class="method-description"> |
448 |
<p> |
449 |
Set the URL of a node server. `url’ specifies the URL of a node. |
450 |
</p> |
451 |
</div> |
452 |
</div> |
453 |
|
454 |
<div id="method-M000020" class="method-detail"> |
455 |
<a name="M000020"></a> |
456 |
|
457 |
<div class="method-heading"> |
458 |
<a href="Node.src/M000020.html" target="Code" class="method-signature" |
459 |
onclick="popupCode('Node.src/M000020.html');return false;"> |
460 |
<span class="method-name">set_user</span><span class="method-args">(name, mode)</span> |
461 |
</a> |
462 |
</div> |
463 |
|
464 |
<div class="method-description"> |
465 |
<p> |
466 |
Manage a user account of a node. `name’ specifies the name of a user. |
467 |
`mode’ specifies the operation mode. 0 means to delete the account. 1 |
468 |
means to set the account as an administrator. 2 means to set the account as |
469 |
a normal user. The return value is true if success, else it is false. |
470 |
</p> |
471 |
</div> |
472 |
</div> |
473 |
|
474 |
<div id="method-M000018" class="method-detail"> |
475 |
<a name="M000018"></a> |
476 |
|
477 |
<div class="method-heading"> |
478 |
<a href="Node.src/M000018.html" target="Code" class="method-signature" |
479 |
onclick="popupCode('Node.src/M000018.html');return false;"> |
480 |
<span class="method-name">size</span><span class="method-args">()</span> |
481 |
</a> |
482 |
</div> |
483 |
|
484 |
<div class="method-description"> |
485 |
<p> |
486 |
Get the size of the datbase. The return value is the size of the datbase. |
487 |
On error, -1.0 is returned. |
488 |
</p> |
489 |
</div> |
490 |
</div> |
491 |
|
492 |
<div id="method-M000005" class="method-detail"> |
493 |
<a name="M000005"></a> |
494 |
|
495 |
<div class="method-heading"> |
496 |
<a href="Node.src/M000005.html" target="Code" class="method-signature" |
497 |
onclick="popupCode('Node.src/M000005.html');return false;"> |
498 |
<span class="method-name">status</span><span class="method-args">()</span> |
499 |
</a> |
500 |
</div> |
501 |
|
502 |
<div class="method-description"> |
503 |
<p> |
504 |
Get the status code of the last request. The return value is the status |
505 |
code of the last request. -1 means failure of connection. |
506 |
</p> |
507 |
</div> |
508 |
</div> |
509 |
|
510 |
<div id="method-M000013" class="method-detail"> |
511 |
<a name="M000013"></a> |
512 |
|
513 |
<div class="method-heading"> |
514 |
<a href="Node.src/M000013.html" target="Code" class="method-signature" |
515 |
onclick="popupCode('Node.src/M000013.html');return false;"> |
516 |
<span class="method-name">uri_to_id</span><span class="method-args">(uri)</span> |
517 |
</a> |
518 |
</div> |
519 |
|
520 |
<div class="method-description"> |
521 |
<p> |
522 |
Get the ID of a document specified by URI. `uri’ specifies the URI of |
523 |
a registered document. The return value is the ID of the document. On |
524 |
error, -1 is returned. |
525 |
</p> |
526 |
</div> |
527 |
</div> |
528 |
|
529 |
<div id="method-M000017" class="method-detail"> |
530 |
<a name="M000017"></a> |
531 |
|
532 |
<div class="method-heading"> |
533 |
<a href="Node.src/M000017.html" target="Code" class="method-signature" |
534 |
onclick="popupCode('Node.src/M000017.html');return false;"> |
535 |
<span class="method-name">word_num</span><span class="method-args">()</span> |
536 |
</a> |
537 |
</div> |
538 |
|
539 |
<div class="method-description"> |
540 |
<p> |
541 |
Get the number of unique words. The return value is the number of unique |
542 |
words. On error, -1 is returned. |
543 |
</p> |
544 |
</div> |
545 |
</div> |
546 |
|
547 |
|
548 |
</div> |
549 |
|
550 |
|
551 |
</div> |
552 |
|
553 |
|
554 |
<div id="validator-badges"> |
555 |
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> |
556 |
</div> |
557 |
|
558 |
</body> |
559 |
</html> |