Class Estraier::Node
In: estraier.rb
Parent: Object

Abstraction of connection to P2P node.

Methods

Public Class methods

Create a node connection object.

Public Instance methods

Get the number of documents. The return value is the number of documents. On error, -1 is returned.

Retrieve a document. `id’ specifies the ID number of a registered document. The return value is a document object. On error, nil is returned.

Retrieve the value of an attribute of a document. `id’ specifies the ID number of a registered document. `name’ specifies the name of an attribute. The return value is the value of the attribute or nil if it does not exist.

Retrieve the value of an attribute of a document specified by URI. `uri’ specifies the URI of a registered document. `name’ specifies the name of an attribute. The return value is the value of the attribute or nil if it does not exist.

Retrieve a document. `uri’ specifies the URI of a registered document. The return value is a document object. On error, nil is returned.

Get the label. The return value is the label. On error, nil is returned.

Get the name. The return value is the name. On error, nil is returned.

Remove a document. `id’ specifies the ID number of a registered document. The return value is true if success, else it is false.

 Remove a document specified by URI.

`uri’ specifies the URI of a registered document. The return value is true if success, else it is false.

Add a document. `doc’ specifies a document object. The document object should have the URI attribute. The return value is true if success, else it is false.

Search documents corresponding a condition. `cond’ specifies a condition object. `depth’ specifies the depth of meta search. The return value is a node result object. On error, nil is returned.

Set the authentication information. `name’ specifies the name of authentication. `passwd’ specifies the password of the authentication.

Manage a link of a node. `url’ specifies the URL of the target node of a link. `label’ specifies the label of the link. `credit’ specifies the credit of the link. If it is negative, the link is removed. The return value is true if success, else it is false.

Set the proxy information. `host’ specifies the host name of a proxy server. `port’ specifies the port number of the proxy server.

Set timeout of a connection. `sec’ specifies timeout of the connection in seconds.

Set the URL of a node server. `url’ specifies the URL of a node.

Manage a user account of a node. `name’ specifies the name of a user. `mode’ specifies the operation mode. 0 means to delete the account. 1 means to set the account as an administrator. 2 means to set the account as a normal user. The return value is true if success, else it is false.

Get the size of the datbase. The return value is the size of the datbase. On error, -1.0 is returned.

Get the status code of the last request. The return value is the status code of the last request. -1 means failure of connection.

Get the ID of a document specified by URI. `uri’ specifies the URI of a registered document. The return value is the ID of the document. On error, -1 is returned.

Get the number of unique words. The return value is the number of unique words. On error, -1 is returned.

[Validate]