Author: sitharus Date: 2006-06-08 10:12:14 +0000 (Thu, 08 Jun 2006) New Revision: 9086
Added: trunk/apps/rubyFreenet/README trunk/apps/rubyFreenet/doc/ trunk/apps/rubyFreenet/doc/classes/ trunk/apps/rubyFreenet/doc/classes/Freenet.html trunk/apps/rubyFreenet/doc/classes/Freenet/ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000015.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000016.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000017.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000018.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000019.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000020.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000021.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000022.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000023.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/FCPConnectionError.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000009.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000010.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000011.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000012.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000013.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000014.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.src/ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.src/M000024.html trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFinished.html trunk/apps/rubyFreenet/doc/classes/Freenet/Site.html trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000030.html trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000031.html trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000032.html trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000033.html trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000034.html trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000035.html trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000036.html trunk/apps/rubyFreenet/doc/classes/Freenet/SiteError.html trunk/apps/rubyFreenet/doc/classes/Freenet/URI.html trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/ trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000025.html trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000026.html trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000027.html trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000028.html trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000029.html trunk/apps/rubyFreenet/doc/classes/Freenet/URIError.html trunk/apps/rubyFreenet/doc/classes/FreenetPage.html trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/ trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000001.html trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000002.html trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000003.html trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000004.html trunk/apps/rubyFreenet/doc/classes/FreenetPageError.html trunk/apps/rubyFreenet/doc/classes/IndexR.html trunk/apps/rubyFreenet/doc/classes/IndexR.src/ trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000005.html trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000006.html trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000007.html trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000008.html trunk/apps/rubyFreenet/doc/created.rid trunk/apps/rubyFreenet/doc/files/ trunk/apps/rubyFreenet/doc/files/freenet/ trunk/apps/rubyFreenet/doc/files/freenet/exceptions_rb.html trunk/apps/rubyFreenet/doc/files/freenet/fcp/ trunk/apps/rubyFreenet/doc/files/freenet/fcp/client_rb.html trunk/apps/rubyFreenet/doc/files/freenet/fcp/exceptions_rb.html trunk/apps/rubyFreenet/doc/files/freenet/fcp/message_rb.html trunk/apps/rubyFreenet/doc/files/freenet/fcp_rb.html trunk/apps/rubyFreenet/doc/files/freenet/uri_rb.html trunk/apps/rubyFreenet/doc/files/freenet_rb.html trunk/apps/rubyFreenet/doc/files/indexr/ trunk/apps/rubyFreenet/doc/files/indexr/indexer_rb.html trunk/apps/rubyFreenet/doc/files/rsite/ trunk/apps/rubyFreenet/doc/files/rsite/rsite_rb.html trunk/apps/rubyFreenet/doc/fr_class_index.html trunk/apps/rubyFreenet/doc/fr_file_index.html trunk/apps/rubyFreenet/doc/fr_method_index.html trunk/apps/rubyFreenet/doc/index.html trunk/apps/rubyFreenet/doc/rdoc-style.css trunk/apps/rubyFreenet/freenet.rb trunk/apps/rubyFreenet/freenet/ trunk/apps/rubyFreenet/freenet/exceptions.rb trunk/apps/rubyFreenet/freenet/fcp.rb trunk/apps/rubyFreenet/freenet/fcp/ trunk/apps/rubyFreenet/freenet/fcp/client.rb trunk/apps/rubyFreenet/freenet/fcp/exceptions.rb trunk/apps/rubyFreenet/freenet/fcp/message.rb trunk/apps/rubyFreenet/freenet/uri.rb trunk/apps/rubyFreenet/indexr/ trunk/apps/rubyFreenet/indexr/README trunk/apps/rubyFreenet/indexr/index.rhtml trunk/apps/rubyFreenet/indexr/indexr.rb trunk/apps/rubyFreenet/rsite/ trunk/apps/rubyFreenet/rsite/README trunk/apps/rubyFreenet/rsite/rsite.rb Log: Initial rubyFreenet import Added: trunk/apps/rubyFreenet/README =================================================================== --- trunk/apps/rubyFreenet/README 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/README 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,3 @@ +rubyFreenet: An FCP implementation in Ruby + +See freenet/doc/index.html for usage information. \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,492 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::FCP::Client</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::FCP::Client</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../../files/freenet/fcp/client_rb.html"> + freenet/fcp/client.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Object + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +Implements <a href="../../Freenet.html">Freenet</a> <a +href="Client.html">Client</a> Protocol client in Ruby. It is multithreaded +and mostly thread-safe. +</p> +<h2>Bugs</h2> +<p> +Probably many. This should get better. +</p> +<h2>Future Development</h2> +<p> +I hope to add more convinience methods, such as being able to insert data +from any IO object instead of strings only. ClientPutDir and +ClientPutComplexDir still need to be implemented. +</p> +<p> +Polling-based asynchronous use may be implemented if there’s demand. +</p> +<p> +I probably need to tidy up the exception structure. +</p> +<h2>Examples</h2> +<h3>Synchronous Use</h3> +<p> +Synchronous use is the easiest way to interface with <a +href="../FCP.html">FCP</a>. The calling thread will block until a response +is received from the server. This is limited in use as responses may take a +long time. +</p> +<p> +<a href="Client.html">Client</a> names are unique to an application. If +your application may have more than one instance per node then each +instance must have a unique name. In the event of a name conflict FRED +assumes that the original application has died and the new one is a +replacement and disconnects the oldest connection, +</p> +<pre> + require 'freenet/client' + client = Freenet::FCP::Client.new('MyFreenetClient', '127.0.0.1', 9481) + file = client.get("KSK at gpl.txt") +</pre> +<h3>Asynchronous Use</h3> +<p> +There are two methods to asynchronous requests, both with their own merits +</p> +<h4>Polling</h4> +<p> +Polling is not implemented yet, but Messages will have a ResponseQueue +where responses can be read in order or recipt. +</p> +<h4>Callbacks</h4> +<p> +<a href="Message.html">FCP::Message</a> can take a block to run as soon as +a reply is received. These blocks run in a separate thread, so they must be +thread safe if they use variables outside their scope. The block arguments +are |status, message, response|, message is the original message for +reference purposes. +</p> +<pre> + client.get("KSK at gpl.txt") do |status, message, response| + case status + when :finished then puts response.data + end + end +</pre> +<p> +See method details for possible status codes. All callbacks may get the +following +</p> +<dl> +<dt>:error</dt><dd><a href="../../Freenet.html">Freenet</a> reported a ProtocolError + +</dd> +</dl> +<h4>Thread safety</h4> +<p> +In callbacks the messages are locked before the callback runs. Always +acquire locks with <a href="Message.html#M000010">Message#lock</a> before +using, but don’t forget to release with <a +href="Message.html#M000011">Message#unlock</a>. +</p> +<p> +Message#synchronize may be implemented later. +</p> + + </div> + + + </div> + + <div id="method-list"> + <h3 class="section-bar">Methods</h3> + + <div class="name-list"> + <a href="#M000016">connect</a> + <a href="#M000017">disconnect</a> + <a href="#M000019">generate_keypair</a> + <a href="#M000020">get</a> + <a href="#M000018">load_request</a> + <a href="#M000015">new</a> + <a href="#M000021">put</a> + <a href="#M000022">putdir</a> + <a href="#M000023">request_status</a> + </div> + </div> + + </div> + + + <!-- if includes --> + <div id="includes"> + <h3 class="section-bar">Included Modules</h3> + + <div id="includes-list"> + <span class="include-name">Logger::Severity</span> + </div> + </div> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + <div id="methods"> + <h3 class="section-bar">Public Class methods</h3> + + <div id="method-M000015" class="method-detail"> + <a name="M000015"></a> + + <div class="method-heading"> + <a href="Client.src/M000015.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000015.html');return false;"> + <span class="method-name">new</span><span class="method-args">(client_name=nil, server="127.0.0.1", port=9481, options={})</span> + </a> + </div> + + <div class="method-description"> + <p> +Constructor, prepares various settings and connects to the <a +href="../../Freenet.html">Freenet</a> node +</p> +<dl> +<dt>client_name</dt><dd>A unique identifier to your client, it should be the same for all +connections. It allows persistent connections to find old requests + +</dd> +<dt>server</dt><dd>The IP of the <a href="../FCP.html">FCP</a> host, normally 127.0.0.1 + +</dd> +<dt>port</dt><dd>The associated TCP port, normally 9481 + +</dd> +<dt>options</dt><dd>Currently unused. + +</dd> +</dl> +<p> +raises <a href="FCPConnectionError.html">FCPConnectionError</a> if +connection fails +</p> + </div> + </div> + + <h3 class="section-bar">Public Instance methods</h3> + + <div id="method-M000016" class="method-detail"> + <a name="M000016"></a> + + <div class="method-heading"> + <a href="Client.src/M000016.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000016.html');return false;"> + <span class="method-name">connect</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Performs the connection and worker thread creation +</p> +<p> +raises <a href="FCPConnectionError.html">FCPConnectionError</a> if +something goes wrong +</p> + </div> + </div> + + <div id="method-M000017" class="method-detail"> + <a name="M000017"></a> + + <div class="method-heading"> + <a href="Client.src/M000017.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000017.html');return false;"> + <span class="method-name">disconnect</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Get the worker thread to disconnect. Doesn‘t guarantee immediate +disconnection as any message currently being read will still be processed +</p> + </div> + </div> + + <div id="method-M000019" class="method-detail"> + <a name="M000019"></a> + + <div class="method-heading"> + <a href="Client.src/M000019.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000019.html');return false;"> + <span class="method-name">generate_keypair</span><span class="method-args">(async, &callback)</span> + </a> + </div> + + <div class="method-description"> + <p> +Generates a keypair for SSK use. If used synchronously it returns +[InsertURI, RequestURI], otherwise extract InsertURI and RequestURI from +response.items +</p> + </div> + </div> + + <div id="method-M000020" class="method-detail"> + <a name="M000020"></a> + + <div class="method-heading"> + <a href="Client.src/M000020.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000020.html');return false;"> + <span class="method-name">get</span><span class="method-args">(uri, async=false, options=nil, &callback)</span> + </a> + </div> + + <div class="method-description"> + <h2>Request a file from <a href="../../Freenet.html">Freenet</a>.</h2> +<p> +Synchronous requests will either get the response message or a <a +href="RequestFailed.html">RequestFailed</a> exception +</p> +<p> +Asyncronous requests get a lot more status information. The messages are: +</p> +<dl> +<dt>:pending</dt><dd>The message is in <a href="../../Freenet.html">Freenet</a>’s queue. + +</dd> +<dt>:progress</dt><dd>A SimpleProgress message has been recieved + +</dd> +<dt>:redirect</dt><dd>The node has found a redirect for the file. This is returned to the client +so a new request can be started, redirects are <b>NOT</b> followed +automatically + +</dd> +<dt>:retrying</dt><dd>A non-fatal error has been encountered (eg remote node overloaded) and a +retry is automatically happening. This is controlled by Message#retries + +</dd> +<dt>:failed</dt><dd>The request has failed, more details in the response + +</dd> +<dt>:found</dt><dd>The data has been found, but not returned to the client. If ReturnType is +not direct (the default) now is the time to do something + +</dd> +<dt>:finished</dt><dd>The data has been returned to the client, response.data has it + +</dd> +</dl> +<h3>Usage Examples</h3> +<h4>Synchronous Use</h4> +<pre> + gpl = client.get('KSK at gpl.txt') +</pre> +<h4>Asynchronous use</h4> +<pre> + client.get('KSK at gpl.txt', false, 'Persistence'=>'connection') do |status, message, response| + case status + when :finished then puts response.data + end + end +</pre> + </div> + </div> + + <div id="method-M000018" class="method-detail"> + <a name="M000018"></a> + + <div class="method-heading"> + <a href="Client.src/M000018.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000018.html');return false;"> + <span class="method-name">load_request</span><span class="method-args">(message)</span> + </a> + </div> + + <div class="method-description"> + <p> +Loads a request in to the queue. This is for persistent requests, read the +notes above for more details +</p> + </div> + </div> + + <div id="method-M000021" class="method-detail"> + <a name="M000021"></a> + + <div class="method-heading"> + <a href="Client.src/M000021.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000021.html');return false;"> + <span class="method-name">put</span><span class="method-args">(uri, data=nil, async=false, options=nil, &callback)</span> + </a> + </div> + + <div class="method-description"> + <h3>Put data in to freenet</h3> +<p> +This is a very simple put, if you wish to insert a directory then use +Client#put_dir or Client#put_complex_dir. +</p> +<p> +Synchronous requests get the inserted <a href="../URI.html">URI</a> or a <a +href="RequestFailed.html">RequestFailed</a> exception. Asynchronous requsts +get the following callbacks: +</p> +<dl> +<dt>:uri_generated</dt><dd><a href="../../Freenet.html">Freenet</a> has generated the <a +href="../URI.html">URI</a> (in +response.items[‘<a +href="../URI.html">URI</a>’]+). Insertion hasn’t happened at +this stage, but the <a href="../URI.html">URI</a> is known + +</dd> +<dt>:success</dt><dd>The data has been inserted successfully. + +</dd> +<dt>:failed</dt><dd>The insertion has failed, response.items contains more information + +</dd> +</dl> +<h3>Usage Examples</h3> +<h4>Putting data from Ruby</h4> +<pre> + put('KSK at my-key', 'This is my text string', false, 'Metadata.ContentType'=> 'text/plain') +</pre> +<h4>Putting a file from disk (must be local to server, not client)</h4> +<pre> + put('KSK at my-key', nil, false, 'MetaData.ContentType'=>'text/plain', 'UploadFrom'=>'disk', 'Filename'=>'/full/path/to/file') +</pre> +<h4>Creating a redirect <a href="../URI.html">URI</a></h4> +<pre> + put('SSK at my-site-key/my-site/image.jpg', nil, false, 'UploadFrom'=>'redirect','TargetURI'=>'KSK at image.jpg') +</pre> + </div> + </div> + + <div id="method-M000022" class="method-detail"> + <a name="M000022"></a> + + <div class="method-heading"> + <a href="Client.src/M000022.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000022.html');return false;"> + <span class="method-name">putdir</span><span class="method-args">(uri, dir, async=false, options=nil, &callback)</span> + </a> + </div> + + <div class="method-description"> + <p> +Upload a directory to a key, either SSK or USK. This directory must be +local to the node we’re connecting to. +</p> + </div> + </div> + + <div id="method-M000023" class="method-detail"> + <a name="M000023"></a> + + <div class="method-heading"> + <a href="Client.src/M000023.html" target="Code" class="method-signature" + onclick="popupCode('Client.src/M000023.html');return false;"> + <span class="method-name">request_status</span><span class="method-args">(identifier, global, async=false)</span> + </a> + </div> + + <div class="method-description"> + <p> +Get the request status for a persistent request. Not useful in synchronous +systems. +</p> +<p> +Any replies will be directed to the async message’s callback +</p> + </div> + </div> + + + </div> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000015.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000015.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000015.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>new (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 84</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">client_name</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">server</span>=<span class="ruby-value str">"127.0.0.1"</span>, <span class="ruby-identifier">port</span>=<span class="ruby-value">9481</span>, <span class="ruby-identifier">options</span>={}) + <span class="ruby-ivar">@client_name</span> = <span class="ruby-identifier">client_name</span> <span class="ruby-operator">||</span> <span class="ruby-constant">MD5</span>.<span class="ruby-identifier">md5</span>(<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_s</span>) + <span class="ruby-ivar">@options</span>, <span class="ruby-ivar">@server</span>, <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">options</span>, <span class="ruby-identifier">server</span>, <span class="ruby-identifier">port</span> + <span class="ruby-ivar">@messages</span> = {} + <span class="ruby-ivar">@running</span> = <span class="ruby-keyword kw">false</span> + <span class="ruby-ivar">@lock</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span> + <span class="ruby-ivar">@logger_mutex</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span> + <span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Logger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'FCPClientLog'</span>,<span class="ruby-value str">'daily'</span>) + <span class="ruby-ivar">@message_queue</span> = <span class="ruby-constant">Queue</span>.<span class="ruby-identifier">new</span> + <span class="ruby-identifier">connect</span> + <span class="ruby-identifier">hello</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000016.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000016.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000016.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>connect (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 100</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connect</span> + <span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-identifier">log</span>(<span class="ruby-constant">INFO</span>, <span class="ruby-node">"Connecting to #{@server}:#{@port}"</span>) + <span class="ruby-ivar">@socket</span> = <span class="ruby-constant">TCPSocket</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@server</span>, <span class="ruby-ivar">@port</span>) + <span class="ruby-ivar">@running</span> = <span class="ruby-keyword kw">true</span> + <span class="ruby-ivar">@socket_thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {<span class="ruby-identifier">socket_thread</span>} + <span class="ruby-identifier">log</span>(<span class="ruby-constant">DEBUG</span>, <span class="ruby-value str">"Running thread"</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">rescue</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">FCPConnectionError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Connection failed'</span>) + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000017.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000017.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000017.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>disconnect (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 114</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">disconnect</span> + <span class="ruby-identifier">log</span>(<span class="ruby-constant">INFO</span>, <span class="ruby-value str">'Disconnecting'</span>) + <span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-ivar">@running</span> = <span class="ruby-keyword kw">false</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@socket_thread</span>.<span class="ruby-identifier">join</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@socket_thread</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000018.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000018.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000018.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>load_request (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 124</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">load_request</span>(<span class="ruby-identifier">message</span>) + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">load_only</span> = <span class="ruby-keyword kw">true</span> + <span class="ruby-ivar">@message_queue</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">message</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000019.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000019.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000019.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>generate_keypair (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 136</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate_keypair</span>(<span class="ruby-identifier">async</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">callback</span>) + <span class="ruby-identifier">message</span> = <span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'GenerateSSK'</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">callback</span>) + <span class="ruby-identifier">send</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">async</span>) + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">async</span> + <span class="ruby-identifier">message</span> + <span class="ruby-keyword kw">else</span> + [<span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'InsertURI'</span>], <span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'RequestURI'</span>]] + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000020.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000020.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000020.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>get (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 174</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">async</span>=<span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">options</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">callback</span>) + <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:uri</span> + <span class="ruby-identifier">async</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callback</span> + <span class="ruby-identifier">options</span> = {<span class="ruby-value str">'IgnoreDS'</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>, + <span class="ruby-value str">'DSOnly'</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>, + <span class="ruby-value str">'Verbosity'</span>=<span class="ruby-operator">></span><span class="ruby-value">1</span>, + <span class="ruby-value str">'ReturnType'</span>=<span class="ruby-operator">></span><span class="ruby-value str">'direct'</span>, + <span class="ruby-value str">'PriorityClass'</span>=<span class="ruby-operator">></span><span class="ruby-value">1</span>, + <span class="ruby-value str">'Persistence'</span>=<span class="ruby-operator">></span><span class="ruby-value str">'reboot'</span>, + <span class="ruby-value str">'Global'</span>=<span class="ruby-operator">></span><span class="ruby-keyword kw">false</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span> <span class="ruby-operator">||</span> {}) + <span class="ruby-identifier">options</span>[<span class="ruby-value str">'Persistence'</span>] = <span class="ruby-value str">'connection'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">async</span> + <span class="ruby-identifier">options</span>[<span class="ruby-value str">'URI'</span>] = <span class="ruby-identifier">uri</span> + <span class="ruby-identifier">message</span> = <span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ClientGet'</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">callback</span>) + <span class="ruby-identifier">send</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">async</span>) + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">async</span> + <span class="ruby-identifier">message</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">lock</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">type</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'AllData'</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'GetFailed'</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">RequestFailed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>) + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000021.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000021.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000021.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>put (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 228</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">put</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">data</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">async</span>=<span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">options</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">callback</span>) + <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:uri</span> + <span class="ruby-identifier">async</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callback</span> + <span class="ruby-identifier">options</span> = {<span class="ruby-value str">'Metadata.ContentType'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'application/octet-stream'</span>, + <span class="ruby-value str">'Verbosity'</span> =<span class="ruby-operator">></span> <span class="ruby-value">1</span>, + <span class="ruby-value str">'MaxRetries'</span> =<span class="ruby-operator">></span> <span class="ruby-value">10</span>, + <span class="ruby-value str">'Persistence'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'reboot'</span>, + <span class="ruby-value str">'UploadFrom'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'direct'</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span> <span class="ruby-operator">||</span> {}) + <span class="ruby-identifier">options</span>[<span class="ruby-value str">'Persistence'</span>] = <span class="ruby-value str">'connection'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">async</span> + <span class="ruby-identifier">options</span>[<span class="ruby-value str">'URI'</span>] = <span class="ruby-identifier">uri</span> + <span class="ruby-identifier">message</span> = <span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ClientPut'</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">callback</span>) + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">content</span><span class="ruby-operator">-</span><span class="ruby-identifier">type</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value str">'Metadata.ContentType'</span>] + <span class="ruby-identifier">send</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">async</span>) + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">async</span> + <span class="ruby-identifier">message</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">lock</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">type</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'PutSuccessful'</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'URI'</span>] + <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'PutFailed'</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">RequestFailed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>) + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000022.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000022.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000022.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>putdir (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 262</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">putdir</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">dir</span>, <span class="ruby-identifier">async</span>=<span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">options</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">callback</span>) + <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:uri</span> + <span class="ruby-identifier">async</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">callback</span> + <span class="ruby-identifier">options</span> = {<span class="ruby-value str">'Verbosity'</span> =<span class="ruby-operator">></span> <span class="ruby-value">1</span>, + <span class="ruby-value str">'MaxRetries'</span> =<span class="ruby-operator">></span> <span class="ruby-value">10</span>, + <span class="ruby-value str">'PriorityClass'</span> =<span class="ruby-operator">></span> <span class="ruby-value">3</span>, + <span class="ruby-value str">'DefaultName'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'index.html'</span>, + <span class="ruby-value str">'Filename'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">to_s</span> + <span class="ruby-value str">'AllowUnreadableFiles'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'true'</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span> <span class="ruby-operator">||</span> {}) + <span class="ruby-identifier">options</span>[<span class="ruby-value str">'Persistence'</span>] = <span class="ruby-value str">'connection'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">async</span> + <span class="ruby-identifier">options</span>[<span class="ruby-value str">'URI'</span>] = <span class="ruby-identifier">uri</span> + <span class="ruby-identifier">message</span> = <span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ClientPutDiskDir'</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">callback</span>) + <span class="ruby-identifier">send</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">async</span>) + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">async</span> + <span class="ruby-identifier">message</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">lock</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">type</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'PutSuccessful'</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'URI'</span>] + <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'PutFailed'</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">RequestFailed</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">message</span>.<span class="ruby-identifier">response</span>) + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">message</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000023.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000023.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Client.src/M000023.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>request_status (Freenet::FCP::Client)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/client.rb, line 297</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request_status</span>(<span class="ruby-identifier">identifier</span>, <span class="ruby-identifier">global</span>, <span class="ruby-identifier">async</span>=<span class="ruby-keyword kw">false</span>) + <span class="ruby-identifier">log</span>(<span class="ruby-constant">DEBUG</span>, <span class="ruby-value str">'Requesting status'</span>) + <span class="ruby-identifier">message</span> = <span class="ruby-constant">Message</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'GetRequestStatus'</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">'Identifier'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">identifier</span>, <span class="ruby-value str">'Global'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">global</span>) + <span class="ruby-identifier">send</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">async</span>) + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/FCPConnectionError.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/FCPConnectionError.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/FCPConnectionError.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::FCP::FCPConnectionError</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::FCP::FCPConnectionError</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../../files/freenet/fcp/exceptions_rb.html"> + freenet/fcp/exceptions.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Exception + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +Raised if an <a href="../FCP.html">FCP</a> connection can’t be made +or if the connection dies. +</p> + + </div> + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,328 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::FCP::Message</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::FCP::Message</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../../files/freenet/fcp/message_rb.html"> + freenet/fcp/message.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Object + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +An <a href="Message.html">FCP::Message</a> represents a communication +between the server and client. It handles basic information and thread +safety. When a response is received the original <a +href="Message.html">FCP::Message</a> gets its response attribute set to the +response <a href="Message.html">FCP::Message</a> +</p> +<p> +Attributes of interest +</p> +<dl> +<dt>load_only</dt><dd>Only load in to the message queue, don’t actually send. Used when +restoring persistent requests if a client dies + +</dd> +<dt>content_type</dt><dd>The content type of the data. Set automatically on response, set manually +when inserting. + +</dd> +</dl> +<p> +[retries] +</p> + + </div> + + + </div> + + <div id="method-list"> + <h3 class="section-bar">Methods</h3> + + <div class="name-list"> + <a href="#M000012">callback</a> + <a href="#M000010">lock</a> + <a href="#M000009">new</a> + <a href="#M000013">reply=</a> + <a href="#M000011">unlock</a> + <a href="#M000014">wait_for_response</a> + </div> + </div> + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + <div id="attribute-list"> + <h3 class="section-bar">Attributes</h3> + + <div class="name-list"> + <table> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">callback</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">content_type</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">data</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">data_found</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">identifier</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">items</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">load_only</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">response</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">retries</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">type</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + </table> + </div> + </div> + + + + <!-- if method_list --> + <div id="methods"> + <h3 class="section-bar">Public Class methods</h3> + + <div id="method-M000009" class="method-detail"> + <a name="M000009"></a> + + <div class="method-heading"> + <a href="Message.src/M000009.html" target="Code" class="method-signature" + onclick="popupCode('Message.src/M000009.html');return false;"> + <span class="method-name">new</span><span class="method-args">(type, data = nil, items = [], callback = nil)</span> + </a> + </div> + + <div class="method-description"> + <dl> +<dt>type</dt><dd>The <a href="../FCP.html">FCP</a> message type + +</dd> +<dt>data</dt><dd>Any data to send with the message + +</dd> +<dt>items</dt><dd>A hash of message parameters + +</dd> +<dt>callback</dt><dd>Callback for asynchronous messages + +</dd> +</dl> + </div> + </div> + + <h3 class="section-bar">Public Instance methods</h3> + + <div id="method-M000012" class="method-detail"> + <a name="M000012"></a> + + <div class="method-heading"> + <a href="Message.src/M000012.html" target="Code" class="method-signature" + onclick="popupCode('Message.src/M000012.html');return false;"> + <span class="method-name">callback</span><span class="method-args">(status)</span> + </a> + </div> + + <div class="method-description"> + <p> +Dispatch the callback. Private to <a href="Client.html">FCP::Client</a> +</p> + </div> + </div> + + <div id="method-M000010" class="method-detail"> + <a name="M000010"></a> + + <div class="method-heading"> + <a href="Message.src/M000010.html" target="Code" class="method-signature" + onclick="popupCode('Message.src/M000010.html');return false;"> + <span class="method-name">lock</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Lock the object. Call before using in async situations +</p> + </div> + </div> + + <div id="method-M000013" class="method-detail"> + <a name="M000013"></a> + + <div class="method-heading"> + <a href="Message.src/M000013.html" target="Code" class="method-signature" + onclick="popupCode('Message.src/M000013.html');return false;"> + <span class="method-name">reply=</span><span class="method-args">(response)</span> + </a> + </div> + + <div class="method-description"> + <p> +Sets the reply. This is private to <a href="Client.html">FCP::Client</a> +</p> + </div> + </div> + + <div id="method-M000011" class="method-detail"> + <a name="M000011"></a> + + <div class="method-heading"> + <a href="Message.src/M000011.html" target="Code" class="method-signature" + onclick="popupCode('Message.src/M000011.html');return false;"> + <span class="method-name">unlock</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Unlock. Call after using asychronously +</p> + </div> + </div> + + <div id="method-M000014" class="method-detail"> + <a name="M000014"></a> + + <div class="method-heading"> + <a href="Message.src/M000014.html" target="Code" class="method-signature" + onclick="popupCode('Message.src/M000014.html');return false;"> + <span class="method-name">wait_for_response</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Used to block until the reply is received for synchronous messages. May be +called from any thread. +</p> + </div> + </div> + + + </div> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000009.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000009.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000009.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>new (Freenet::FCP::Message)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/message.rb, line 23</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">data</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">items</span> = [], <span class="ruby-identifier">callback</span> = <span class="ruby-keyword kw">nil</span>) + <span class="ruby-ivar">@retries</span> = <span class="ruby-value">0</span> + <span class="ruby-ivar">@type</span>, <span class="ruby-ivar">@data</span>, <span class="ruby-ivar">@items</span> = <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">items</span> + <span class="ruby-ivar">@items</span> = {} <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Hash</span> + <span class="ruby-ivar">@items</span>[<span class="ruby-value str">'Identifier'</span>] <span class="ruby-operator">||=</span> <span class="ruby-node">"FCPMessage_#{MD5.md5(Time.now.to_s)}_#{rand(100000)}"</span> + <span class="ruby-ivar">@identifier</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-value str">'Identifier'</span>] + <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">'ClientHello'</span>,<span class="ruby-value str">'NodeHello'</span>].<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@type</span> + <span class="ruby-ivar">@identifier</span> = <span class="ruby-value str">'ClientHello'</span> + <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'Identifier'</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@callback</span> = <span class="ruby-identifier">callback</span> + <span class="ruby-ivar">@mutex</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span> + <span class="ruby-ivar">@load_only</span> = <span class="ruby-keyword kw">false</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000010.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000010.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000010.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>lock (Freenet::FCP::Message)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/message.rb, line 39</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lock</span>; <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">lock</span>; <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000011.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000011.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000011.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>unlock (Freenet::FCP::Message)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/message.rb, line 42</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unlock</span>; <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">unlock</span>; <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000012.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000012.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000012.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>callback (Freenet::FCP::Message)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/message.rb, line 45</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">callback</span>(<span class="ruby-identifier">status</span>) + <span class="ruby-ivar">@callback</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">status</span>, <span class="ruby-keyword kw">self</span>, <span class="ruby-ivar">@response</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@callback</span>.<span class="ruby-identifier">nil?</span> + <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"ERROR: Exception in callback: #{e}\n#{e.backtrace.join("\n")}"</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000013.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000013.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000013.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>reply= (Freenet::FCP::Message)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/message.rb, line 52</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reply=</span>(<span class="ruby-identifier">response</span>) + <span class="ruby-identifier">lock</span> + <span class="ruby-ivar">@response</span> = <span class="ruby-identifier">response</span> + <span class="ruby-identifier">unlock</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000014.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000014.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/Message.src/M000014.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>wait_for_response (Freenet::FCP::Message)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/message.rb, line 60</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wait_for_response</span> + <span class="ruby-keyword kw">until</span> <span class="ruby-ivar">@response</span> + <span class="ruby-identifier">sleep</span>(<span class="ruby-value">0</span><span class="ruby-value">.5</span>) + <span class="ruby-identifier">lock</span> + <span class="ruby-identifier">unlock</span> + <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">pass</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,171 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::FCP::RequestFailed</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::FCP::RequestFailed</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../../files/freenet/fcp/exceptions_rb.html"> + freenet/fcp/exceptions.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Exception + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +Raised if a synchronous request fails +</p> + + </div> + + + </div> + + <div id="method-list"> + <h3 class="section-bar">Methods</h3> + + <div class="name-list"> + <a href="#M000024">new</a> + </div> + </div> + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + <div id="attribute-list"> + <h3 class="section-bar">Attributes</h3> + + <div class="name-list"> + <table> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">code</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">description</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">extra</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">fatal</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + </table> + </div> + </div> + + + + <!-- if method_list --> + <div id="methods"> + <h3 class="section-bar">Public Class methods</h3> + + <div id="method-M000024" class="method-detail"> + <a name="M000024"></a> + + <div class="method-heading"> + <a href="RequestFailed.src/M000024.html" target="Code" class="method-signature" + onclick="popupCode('RequestFailed.src/M000024.html');return false;"> + <span class="method-name">new</span><span class="method-args">(original_message)</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + + </div> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.src/M000024.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.src/M000024.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFailed.src/M000024.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>new (Freenet::FCP::RequestFailed)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/fcp/exceptions.rb, line 16</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">original_message</span>) + <span class="ruby-ivar">@code</span> = <span class="ruby-identifier">original_message</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'Code'</span>] + <span class="ruby-ivar">@description</span> = <span class="ruby-identifier">original_message</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'CodeDescription'</span>] + <span class="ruby-ivar">@extra</span> = <span class="ruby-identifier">original_message</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'ExtraDescription'</span>] + <span class="ruby-ivar">@fatal</span> = <span class="ruby-identifier">original_message</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'Fatal'</span>] + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFinished.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFinished.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP/RequestFinished.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::FCP::RequestFinished</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::FCP::RequestFinished</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../../files/freenet/fcp/exceptions_rb.html"> + freenet/fcp/exceptions.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Exception + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +If raised by a callback the entry is removed from the message list and the +identifier can be reused properly +</p> + + </div> + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/FCP.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/FCP.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/FCP.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Module: Freenet::FCP</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Module</strong></td> + <td class="class-name-in-header">Freenet::FCP</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../files/freenet/fcp/client_rb.html"> + freenet/fcp/client.rb + </a> + <br /> + <a href="../../files/freenet/fcp/exceptions_rb.html"> + freenet/fcp/exceptions.rb + </a> + <br /> + <a href="../../files/freenet/fcp/message_rb.html"> + freenet/fcp/message.rb + </a> + <br /> + </td> + </tr> + + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + <div id="class-list"> + <h3 class="section-bar">Classes and Modules</h3> + + Class <a href="FCP/Client.html" class="link">Freenet::FCP::Client</a><br /> +Class <a href="FCP/FCPConnectionError.html" class="link">Freenet::FCP::FCPConnectionError</a><br /> +Class <a href="FCP/Message.html" class="link">Freenet::FCP::Message</a><br /> +Class <a href="FCP/RequestFailed.html" class="link">Freenet::FCP::RequestFailed</a><br /> +Class <a href="FCP/RequestFinished.html" class="link">Freenet::FCP::RequestFinished</a><br /> + + </div> + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/Site.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/Site.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::Site</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::Site</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../files/rsite/rsite_rb.html"> + rsite/rsite.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Object + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + + </div> + + <div id="method-list"> + <h3 class="section-bar">Methods</h3> + + <div class="name-list"> + <a href="#M000032">connect</a> + <a href="#M000033">generate_key</a> + <a href="#M000035">insert_file</a> + <a href="#M000034">insert_site</a> + <a href="#M000030">load</a> + <a href="#M000031">new</a> + <a href="#M000036">save</a> + </div> + </div> + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + <div id="attribute-list"> + <h3 class="section-bar">Attributes</h3> + + <div class="name-list"> + <table> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">keys</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">version</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + </table> + </div> + </div> + + + + <!-- if method_list --> + <div id="methods"> + <h3 class="section-bar">Public Class methods</h3> + + <div id="method-M000030" class="method-detail"> + <a name="M000030"></a> + + <div class="method-heading"> + <a href="Site.src/M000030.html" target="Code" class="method-signature" + onclick="popupCode('Site.src/M000030.html');return false;"> + <span class="method-name">load</span><span class="method-args">(file)</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + <div id="method-M000031" class="method-detail"> + <a name="M000031"></a> + + <div class="method-heading"> + <a href="Site.src/M000031.html" target="Code" class="method-signature" + onclick="popupCode('Site.src/M000031.html');return false;"> + <span class="method-name">new</span><span class="method-args">(type, path)</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + <h3 class="section-bar">Public Instance methods</h3> + + <div id="method-M000032" class="method-detail"> + <a name="M000032"></a> + + <div class="method-heading"> + <a href="Site.src/M000032.html" target="Code" class="method-signature" + onclick="popupCode('Site.src/M000032.html');return false;"> + <span class="method-name">connect</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + <div id="method-M000033" class="method-detail"> + <a name="M000033"></a> + + <div class="method-heading"> + <a href="Site.src/M000033.html" target="Code" class="method-signature" + onclick="popupCode('Site.src/M000033.html');return false;"> + <span class="method-name">generate_key</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + <div id="method-M000035" class="method-detail"> + <a name="M000035"></a> + + <div class="method-heading"> + <a href="Site.src/M000035.html" target="Code" class="method-signature" + onclick="popupCode('Site.src/M000035.html');return false;"> + <span class="method-name">insert_file</span><span class="method-args">(path, type = nil, site=nil)</span> + </a> + </div> + + <div class="method-description"> + <p> +Insert a single file. You probably want a CHK for this, use it to insert +large files that won’t change, eg media files. +</p> +<p> +path must be the full filesystem path to the file. +</p> +<p> +If the type is CHK then site isn’t used as CHKs are generated by the +node. You may append any text after the / in a CHK <a +href="URI.html">URI</a> +</p> +<p> +If the type is KSK then site is the key If the type is SSK or USK then it +must be sitename/filename +</p> + </div> + </div> + + <div id="method-M000034" class="method-detail"> + <a name="M000034"></a> + + <div class="method-heading"> + <a href="Site.src/M000034.html" target="Code" class="method-signature" + onclick="popupCode('Site.src/M000034.html');return false;"> + <span class="method-name">insert_site</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + <div id="method-M000036" class="method-detail"> + <a name="M000036"></a> + + <div class="method-heading"> + <a href="Site.src/M000036.html" target="Code" class="method-signature" + onclick="popupCode('Site.src/M000036.html');return false;"> + <span class="method-name">save</span><span class="method-args">(file)</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + + </div> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000030.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000030.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000030.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>load (Freenet::Site)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File rsite/rsite.rb, line 7</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">file</span>) + <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>)) + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000031.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000031.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000031.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>new (Freenet::Site)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File rsite/rsite.rb, line 11</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">path</span>) + <span class="ruby-identifier">raise</span> <span class="ruby-constant">SiteError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Invalid type'</span>) <span class="ruby-keyword kw">unless</span> [<span class="ruby-value str">'USK'</span>,<span class="ruby-value str">'SSK'</span>,<span class="ruby-value str">'CHK'</span>,<span class="ruby-value str">'KSK'</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">type</span> + <span class="ruby-ivar">@path</span>, <span class="ruby-ivar">@type</span> = <span class="ruby-identifier">path</span>, <span class="ruby-identifier">type</span> + <span class="ruby-ivar">@version</span> = <span class="ruby-value str">''</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000032.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000032.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000032.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>connect (Freenet::Site)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File rsite/rsite.rb, line 17</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connect</span> + <span class="ruby-ivar">@client</span> = <span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">FCP</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>() + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000033.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000033.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000033.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>generate_key (Freenet::Site)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File rsite/rsite.rb, line 21</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">generate_key</span> + <span class="ruby-ivar">@keys</span> = <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">generate_keypair</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000034.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000034.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000034.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>insert_site (Freenet::Site)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File rsite/rsite.rb, line 25</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">insert_site</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000035.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000035.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000035.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>insert_file (Freenet::Site)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File rsite/rsite.rb, line 38</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">insert_file</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">type</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">site</span>=<span class="ruby-keyword kw">nil</span>) + <span class="ruby-identifier">uri</span> = <span class="ruby-value str">''</span> + <span class="ruby-identifier">type</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@type</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'CHK'</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">uri</span> = <span class="ruby-value str">'CHK@'</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">SiteError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Invalid key'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">site</span> + <span class="ruby-identifier">uri</span> = <span class="ruby-node">"#{@type}@#{site}"</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-value str">'UploadFrom'</span>=<span class="ruby-operator">></span><span class="ruby-value str">'disk'</span>,<span class="ruby-value str">'Filename'</span>=<span class="ruby-operator">></span><span class="ruby-identifier">path</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">status</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">response</span><span class="ruby-operator">|</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:uri_generated</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"URI created: #{response.items['URI']}"</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:success</span> + <span class="ruby-identifier">puts</span> <span class="ruby-value str">"File inserted successfully"</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:failed</span> + <span class="ruby-identifier">puts</span> <span class="ruby-value str">"File insertion failed!"</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000036.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000036.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/Site.src/M000036.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>save (Freenet::Site)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File rsite/rsite.rb, line 57</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>(<span class="ruby-identifier">file</span>) + <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file</span>, <span class="ruby-value str">'w'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-keyword kw">self</span>))} + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/SiteError.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/SiteError.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/SiteError.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::SiteError</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::SiteError</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../files/rsite/rsite_rb.html"> + rsite/rsite.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + StandardError + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/URI.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/URI.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/URI.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,281 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::URI</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::URI</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../files/freenet/uri_rb.html"> + freenet/uri.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Object + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +Represents a <a href="../Freenet.html">Freenet</a> <a +href="URI.html">URI</a>. Provides manipulation with awareness of the <a +href="../Freenet.html">Freenet</a> structure, such as USK versioning. +</p> +<p> +This could be completely wrong. Any criticism welcome +</p> + + </div> + + + </div> + + <div id="method-list"> + <h3 class="section-bar">Methods</h3> + + <div class="name-list"> + <a href="#M000029"><=></a> + <a href="#M000027">merge</a> + <a href="#M000025">new</a> + <a href="#M000028">root?</a> + <a href="#M000026">uri</a> + </div> + </div> + + </div> + + + <!-- if includes --> + <div id="includes"> + <h3 class="section-bar">Included Modules</h3> + + <div id="includes-list"> + <span class="include-name">Comparable</span> + </div> + </div> + + <div id="section"> + + + + + + <div id="attribute-list"> + <h3 class="section-bar">Attributes</h3> + + <div class="name-list"> + <table> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">path</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">site</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">uri</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + </table> + </div> + </div> + + + + <!-- if method_list --> + <div id="methods"> + <h3 class="section-bar">Public Class methods</h3> + + <div id="method-M000025" class="method-detail"> + <a name="M000025"></a> + + <div class="method-heading"> + <a href="URI.src/M000025.html" target="Code" class="method-signature" + onclick="popupCode('URI.src/M000025.html');return false;"> + <span class="method-name">new</span><span class="method-args">(uri)</span> + </a> + </div> + + <div class="method-description"> + <p> +This can take a <a href="URI.html">URI</a> in following formats: +</p> +<pre> + /freenet:SSK at ... + SSK at ... +</pre> +<p> +Currently supports SSK, USK, KSK and CHK +</p> + </div> + </div> + + <h3 class="section-bar">Public Instance methods</h3> + + <div id="method-M000029" class="method-detail"> + <a name="M000029"></a> + + <div class="method-heading"> + <a href="URI.src/M000029.html" target="Code" class="method-signature" + onclick="popupCode('URI.src/M000029.html');return false;"> + <span class="method-name"><=></span><span class="method-args">(other)</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + <div id="method-M000027" class="method-detail"> + <a name="M000027"></a> + + <div class="method-heading"> + <a href="URI.src/M000027.html" target="Code" class="method-signature" + onclick="popupCode('URI.src/M000027.html');return false;"> + <span class="method-name">merge</span><span class="method-args">(uri)</span> + </a> + </div> + + <div class="method-description"> + <p> +Merge in a <a href="URI.html">URI</a> or a <a href="URI.html">URI</a> +fragment and provide the finished <a href="URI.html">URI</a>. Attempts to +do what a browser would +</p> +<pre> + uri.merge("image.jpg") +</pre> + </div> + </div> + + <div id="method-M000028" class="method-detail"> + <a name="M000028"></a> + + <div class="method-heading"> + <a href="URI.src/M000028.html" target="Code" class="method-signature" + onclick="popupCode('URI.src/M000028.html');return false;"> + <span class="method-name">root?</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Returns true if we’re at the ‘base’ page of a <a +href="URI.html">URI</a> using the following: +</p> +<ul> +<li>KSKs and CHKs only have one file, so always the base + +</li> +<li>SSKs have a ‘base’, eg SSK@…/mysite/ + +</li> +<li>USKs start with /sitename and end with /revision or -revision, though the +latter is technically wrong. + +</li> +</ul> +<p> +This may be completely wrong. Please tell me if it is. +</p> + </div> + </div> + + <div id="method-M000026" class="method-detail"> + <a name="M000026"></a> + + <div class="method-heading"> + <a href="URI.src/M000026.html" target="Code" class="method-signature" + onclick="popupCode('URI.src/M000026.html');return false;"> + <span class="method-name">uri</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Return a <a href="URI.html">URI</a> that can be fed to <a +href="../Freenet.html">Freenet</a> +</p> + </div> + </div> + + + </div> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000025.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000025.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000025.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>new (Freenet::URI)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/uri.rb, line 15</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">uri</span>) + <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:uri</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">dup</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">uri</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^\/?freenet:/</span> + <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/^\/?freenet:/</span>,<span class="ruby-value str">''</span>) + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^\//</span> + <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/^\//</span>, <span class="ruby-value str">''</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">URIError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"Invalid Freenet URI: #{uri}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^(?:[UKS]S|CH)K@/</span> + + <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">uri</span> + <span class="ruby-ivar">@site</span> = <span class="ruby-ivar">@uri</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^(?:[UKS]S|CH)K@[^\/]+/</span>)[<span class="ruby-value">0</span>] + <span class="ruby-ivar">@path</span> = <span class="ruby-ivar">@uri</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/(\/[^#\?]+)/</span>)[<span class="ruby-value">1</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@uri</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\/[^#\?]+/</span> + <span class="ruby-ivar">@anchor</span> = <span class="ruby-ivar">@uri</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/#(.+)/</span>)[<span class="ruby-value">1</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@uri</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/#.+/</span> + <span class="ruby-ivar">@query_string</span> = <span class="ruby-ivar">@uri</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/\?([^#]+)/</span>)[<span class="ruby-value">1</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@uri</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\?/</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000026.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000026.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000026.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>uri (Freenet::URI)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/uri.rb, line 33</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uri</span> + <span class="ruby-node">"#{@site}#{@path}#{"?#{@query_string}" if @query_string}#{"##{@anchor}" if @anchor}"</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000027.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000027.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000027.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>merge (Freenet::URI)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/uri.rb, line 40</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">merge</span>(<span class="ruby-identifier">uri</span>) + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\//</span> + <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">uri</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">strip</span> + <span class="ruby-keyword kw">begin</span> + <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:uri</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">site</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@site</span> + <span class="ruby-keyword kw">return</span> <span class="ruby-node">"#{@site}#{merge_paths(@path, uri.path)}"</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">URIError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span> <span class="ruby-comment cmt"># We have a fragment</span> + <span class="ruby-node">"#{@site}#{merge_paths(@path, uri)}"</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000028.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000028.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000028.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>root? (Freenet::URI)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/uri.rb, line 64</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">root?</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@site</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^CHK/</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">true</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^KSK/</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">true</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^SSK/</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@path</span> <span class="ruby-operator">==</span> <span class="ruby-regexp re">%r{/[^/]/}</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^USK/</span> <span class="ruby-keyword kw">then</span> <span class="ruby-ivar">@path</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%r{/[^/-]+[/-][0-9]+}i</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-keyword kw">false</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000029.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000029.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/URI.src/M000029.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title><=> (Freenet::URI)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File freenet/uri.rb, line 75</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">other</span>) + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">site</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@site</span> + <span class="ruby-identifier">other</span>.<span class="ruby-identifier">path</span> <span class="ruby-operator"><=></span> <span class="ruby-ivar">@path</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">other</span>.<span class="ruby-identifier">site</span> <span class="ruby-operator"><=></span> <span class="ruby-ivar">@site</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet/URIError.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet/URIError.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet/URIError.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: Freenet::URIError</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">Freenet::URIError</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../../files/freenet/exceptions_rb.html"> + freenet/exceptions.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Exception + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +Raised if a <a href="URI.html">URI</a> can’t be parsed or handled for +some reason +</p> + + </div> + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/Freenet.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/Freenet.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/Freenet.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Module: Freenet</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Module</strong></td> + <td class="class-name-in-header">Freenet</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../files/freenet/exceptions_rb.html"> + freenet/exceptions.rb + </a> + <br /> + <a href="../files/freenet/fcp/client_rb.html"> + freenet/fcp/client.rb + </a> + <br /> + <a href="../files/freenet/fcp/exceptions_rb.html"> + freenet/fcp/exceptions.rb + </a> + <br /> + <a href="../files/freenet/fcp/message_rb.html"> + freenet/fcp/message.rb + </a> + <br /> + <a href="../files/freenet/uri_rb.html"> + freenet/uri.rb + </a> + <br /> + <a href="../files/rsite/rsite_rb.html"> + rsite/rsite.rb + </a> + <br /> + </td> + </tr> + + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + <div id="class-list"> + <h3 class="section-bar">Classes and Modules</h3> + + Module <a href="Freenet/FCP.html" class="link">Freenet::FCP</a><br /> +Class <a href="Freenet/Site.html" class="link">Freenet::Site</a><br /> +Class <a href="Freenet/SiteError.html" class="link">Freenet::SiteError</a><br /> +Class <a href="Freenet/URI.html" class="link">Freenet::URI</a><br /> +Class <a href="Freenet/URIError.html" class="link">Freenet::URIError</a><br /> + + </div> + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/FreenetPage.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/FreenetPage.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/FreenetPage.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,238 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: FreenetPage</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">FreenetPage</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../files/indexr/indexer_rb.html"> + indexr/indexer.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Object + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +A page on <a href="Freenet.html">Freenet</a>, uses beautifulsoup to parse +non-XML-compliant HTML files, +</p> + + </div> + + + </div> + + <div id="method-list"> + <h3 class="section-bar">Methods</h3> + + <div class="name-list"> + <a href="#M000004"><=></a> + <a href="#M000003">categorize</a> + <a href="#M000001">new</a> + <a href="#M000002">run_rank</a> + </div> + </div> + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + <div id="attribute-list"> + <h3 class="section-bar">Attributes</h3> + + <div class="name-list"> + <table> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">category</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">links</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">meta</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">rank</td> + <td class="context-item-value"> [R] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">title</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">uri</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">url</td> + <td class="context-item-value"> [RW] </td> + <td class="context-item-desc"></td> + </tr> + </table> + </div> + </div> + + + + <!-- if method_list --> + <div id="methods"> + <h3 class="section-bar">Public Class methods</h3> + + <div id="method-M000001" class="method-detail"> + <a name="M000001"></a> + + <div class="method-heading"> + <a href="FreenetPage.src/M000001.html" target="Code" class="method-signature" + onclick="popupCode('FreenetPage.src/M000001.html');return false;"> + <span class="method-name">new</span><span class="method-args">(url, data)</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + <h3 class="section-bar">Public Instance methods</h3> + + <div id="method-M000004" class="method-detail"> + <a name="M000004"></a> + + <div class="method-heading"> + <a href="FreenetPage.src/M000004.html" target="Code" class="method-signature" + onclick="popupCode('FreenetPage.src/M000004.html');return false;"> + <span class="method-name"><=></span><span class="method-args">(other)</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + <div id="method-M000003" class="method-detail"> + <a name="M000003"></a> + + <div class="method-heading"> + <a href="FreenetPage.src/M000003.html" target="Code" class="method-signature" + onclick="popupCode('FreenetPage.src/M000003.html');return false;"> + <span class="method-name">categorize</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Magic voodoo of half-baked ideas. It’s supposed to sort pages in to +categories. +</p> + </div> + </div> + + <div id="method-M000002" class="method-detail"> + <a name="M000002"></a> + + <div class="method-heading"> + <a href="FreenetPage.src/M000002.html" target="Code" class="method-signature" + onclick="popupCode('FreenetPage.src/M000002.html');return false;"> + <span class="method-name">run_rank</span><span class="method-args">(rank, all_pages)</span> + </a> + </div> + + <div class="method-description"> + </div> + </div> + + + </div> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000001.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000001.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000001.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>new (FreenetPage)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File indexr/indexer.rb, line 192</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">data</span>) + <span class="ruby-ivar">@uri</span> = <span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">url</span>) + <span class="ruby-ivar">@rank</span> = <span class="ruby-value">0</span> + <span class="ruby-ivar">@data</span> = <span class="ruby-identifier">data</span> + <span class="ruby-ivar">@links</span> = [] + <span class="ruby-ivar">@meta</span> = {} + <span class="ruby-ivar">@category</span> = <span class="ruby-identifier">:unknown</span> + <span class="ruby-ivar">@page</span> = <span class="ruby-constant">BeautifulSoup</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">data</span>) + <span class="ruby-identifier">raise</span> <span class="ruby-constant">FreenetPageError</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">nil?</span> + <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-value str">'a'</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">link</span><span class="ruby-operator">|</span> + <span class="ruby-keyword kw">begin</span> + <span class="ruby-identifier">href</span> = <span class="ruby-identifier">link</span>[<span class="ruby-value str">'href'</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">next</span> + <span class="ruby-ivar">@links</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">href</span>) + <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">URIError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">puts</span> <span class="ruby-value str">'Invalid URI'</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + + <span class="ruby-ivar">@title</span> = <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">html</span>.<span class="ruby-identifier">head</span>.<span class="ruby-identifier">title</span>.<span class="ruby-identifier">string</span> <span class="ruby-operator">||</span> <span class="ruby-value str">"No Title"</span> + + <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-value str">'meta'</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">meta</span><span class="ruby-operator">|</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">meta</span>[<span class="ruby-value str">'name'</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">meta</span>[<span class="ruby-value str">'content'</span>] + <span class="ruby-ivar">@meta</span>[<span class="ruby-identifier">meta</span>[<span class="ruby-value str">'name'</span>].<span class="ruby-identifier">downcase</span>] = <span class="ruby-identifier">meta</span>[<span class="ruby-value str">'content'</span>] + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span> <span class="ruby-comment cmt"># Raise this if we can't make the page, for whatever reason.</span> + <span class="ruby-identifier">raise</span> <span class="ruby-constant">FreenetPageError</span>.<span class="ruby-identifier">new</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000002.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000002.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000002.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>run_rank (FreenetPage)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File indexr/indexer.rb, line 221</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run_rank</span>(<span class="ruby-identifier">rank</span>, <span class="ruby-identifier">all_pages</span>) + <span class="ruby-ivar">@rank</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">rank</span> + <span class="ruby-identifier">pass_rank</span> = <span class="ruby-identifier">rank</span>.<span class="ruby-identifier">to_f</span><span class="ruby-operator">/</span><span class="ruby-ivar">@page</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-value str">'a'</span>).<span class="ruby-identifier">size</span> + <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pass_rank</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span><span class="ruby-value">.01</span> + <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-value str">'a'</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">link</span><span class="ruby-operator">|</span> + <span class="ruby-keyword kw">begin</span> + <span class="ruby-identifier">href</span> = <span class="ruby-identifier">link</span>[<span class="ruby-value str">'href'</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">next</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri</span> = <span class="ruby-ivar">@uri</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">href</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">uri</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">all_pages</span>[<span class="ruby-identifier">uri</span>] + <span class="ruby-identifier">all_pages</span>[<span class="ruby-identifier">uri</span>].<span class="ruby-identifier">run_rank</span>(<span class="ruby-identifier">pass_rank</span>, <span class="ruby-identifier">all_pages</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">URIError</span>=<span class="ruby-operator">></span><span class="ruby-identifier">e</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000003.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000003.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000003.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>categorize (FreenetPage)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File indexr/indexer.rb, line 237</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">categorize</span> + <span class="ruby-identifier">links</span> = <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-value str">'a'</span>) + <span class="ruby-identifier">imgs</span> = <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-value str">'img'</span>) + <span class="ruby-identifier">total_count</span> = <span class="ruby-value">0</span> + <span class="ruby-identifier">tag_count</span> = <span class="ruby-ivar">@page</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">tag</span><span class="ruby-operator">|</span> <span class="ruby-identifier">total_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>} + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">imgs</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">/</span><span class="ruby-identifier">total_count</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span><span class="ruby-value">.3</span> <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">links</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">/</span><span class="ruby-identifier">imgs</span>.<span class="ruby-identifier">size</span>) <span class="ruby-operator">></span> <span class="ruby-value">0</span><span class="ruby-value">.8</span> + <span class="ruby-identifier">:image_gallery</span> + <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">links</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">/</span><span class="ruby-identifier">total_count</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span><span class="ruby-value">.3</span> + <span class="ruby-identifier">:link_directory</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@meta</span>[<span class="ruby-value str">'keywords'</span>] + <span class="ruby-identifier">keywords</span> = <span class="ruby-ivar">@meta</span>[<span class="ruby-value str">'keywords'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">','</span>) + <span class="ruby-identifier">keywords</span>.<span class="ruby-identifier">collect!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">kw</span><span class="ruby-operator">|</span> <span class="ruby-identifier">kw</span>.<span class="ruby-identifier">downcase</span>} + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">keywords</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value str">'index'</span> + <span class="ruby-identifier">:index_site</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">:unknown</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">:unknown</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000004.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000004.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/FreenetPage.src/M000004.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title><=> (FreenetPage)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File indexr/indexer.rb, line 261</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">other</span>) + <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">nil?</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@category</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">category</span> + <span class="ruby-ivar">@title</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">title</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-ivar">@category</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">category</span>.<span class="ruby-identifier">to_s</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/FreenetPageError.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/FreenetPageError.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/FreenetPageError.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: FreenetPageError</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">FreenetPageError</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../files/indexr/indexer_rb.html"> + indexr/indexer.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Exception + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +Generic <a href="FreenetPageError.html">FreenetPageError</a> +</p> + + </div> + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/IndexR.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/IndexR.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/IndexR.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,242 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Class: IndexR</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="classHeader"> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Class</strong></td> + <td class="class-name-in-header">IndexR</td> + </tr> + <tr class="top-aligned-row"> + <td><strong>In:</strong></td> + <td> + <a href="../files/indexr/indexer_rb.html"> + indexr/indexer.rb + </a> + <br /> + </td> + </tr> + + <tr class="top-aligned-row"> + <td><strong>Parent:</strong></td> + <td> + Object + </td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + <div id="description"> + <p> +Example for FreenetR useage. +</p> +<p> +This is a very simple freenet spider. It starts at a URI, follows all HTML +links if they have a valid <a href="Freenet.html">Freenet</a> URI and puts +them on a page. Basic categorization is done based on tag density and META +keywords and an erb file is called to produce HTML output. +</p> +<p> +This isn’t a pretty example, but it works. +</p> + + </div> + + + </div> + + <div id="method-list"> + <h3 class="section-bar">Methods</h3> + + <div class="name-list"> + <a href="#M000008">create_index_page</a> + <a href="#M000006">mine_page</a> + <a href="#M000005">new</a> + <a href="#M000007">process_page</a> + </div> + </div> + + </div> + + + <!-- if includes --> + + <div id="section"> + + + <div id="constants-list"> + <h3 class="section-bar">Constants</h3> + + <div class="name-list"> + <table summary="Constants"> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">RECURSE_DEPTH</td> + <td>=</td> + <td class="context-item-value">5</td> + <td width="3em"> </td> + <td class="context-item-desc"> +The depth to follow links to. Remember that the number of pages tends to +increase rapidly with a single depth increase + +</td> + </tr> + <tr class="top-aligned-row context-row"> + <td class="context-item-name">START_PAGES</td> + <td>=</td> + <td class="context-item-value">[ "USK at PFeLTa1si2Ml5sDeUy7eDhPso6TPdmw-2gWfQ4Jg02w,3ocfrqgUMVWA2PeorZx40TW0c-FiIOL-TWKQHoDbVdE,AQABAAE/Index/34/"</td> + <td width="3em"> </td> + <td class="context-item-desc"> +An array of URIs to start spidering with + +</td> + </tr> + </table> + </div> + </div> + + + + + + + <!-- if method_list --> + <div id="methods"> + <h3 class="section-bar">Public Class methods</h3> + + <div id="method-M000005" class="method-detail"> + <a name="M000005"></a> + + <div class="method-heading"> + <a href="IndexR.src/M000005.html" target="Code" class="method-signature" + onclick="popupCode('IndexR.src/M000005.html');return false;"> + <span class="method-name">new</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Start spidering +</p> + </div> + </div> + + <h3 class="section-bar">Public Instance methods</h3> + + <div id="method-M000008" class="method-detail"> + <a name="M000008"></a> + + <div class="method-heading"> + <a href="IndexR.src/M000008.html" target="Code" class="method-signature" + onclick="popupCode('IndexR.src/M000008.html');return false;"> + <span class="method-name">create_index_page</span><span class="method-args">()</span> + </a> + </div> + + <div class="method-description"> + <p> +Create index page. Sort pages and send to the erb template +</p> + </div> + </div> + + <div id="method-M000006" class="method-detail"> + <a name="M000006"></a> + + <div class="method-heading"> + <a href="IndexR.src/M000006.html" target="Code" class="method-signature" + onclick="popupCode('IndexR.src/M000006.html');return false;"> + <span class="method-name">mine_page</span><span class="method-args">(uri, depth=0)</span> + </a> + </div> + + <div class="method-description"> + <p> +Mine a page. uri is a <a href="Freenet/URI.html">Freenet::URI</a>. depth is +managed by <a href="IndexR.html#M000006">mine_page</a> to ensure that we +don’t exceed RECURSE_DEPTH +</p> + </div> + </div> + + <div id="method-M000007" class="method-detail"> + <a name="M000007"></a> + + <div class="method-heading"> + <a href="IndexR.src/M000007.html" target="Code" class="method-signature" + onclick="popupCode('IndexR.src/M000007.html');return false;"> + <span class="method-name">process_page</span><span class="method-args">(uri, page, depth)</span> + </a> + </div> + + <div class="method-description"> + <p> +Pull links out of a page and mine them deeper +</p> + </div> + </div> + + + </div> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000005.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000005.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000005.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>new (IndexR)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File indexr/indexer.rb, line 24</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> + <span class="ruby-ivar">@process_threads</span> = [] <span class="ruby-comment cmt"># all the processing threads, so we can cull them</span> + <span class="ruby-ivar">@waiting_urls</span> = [] <span class="ruby-comment cmt"># The URIs waiting for response from Freenet</span> + <span class="ruby-ivar">@all_uris</span> = [] <span class="ruby-comment cmt"># All URIs checked, to prevent doubleups</span> + <span class="ruby-ivar">@pages</span> = {} <span class="ruby-comment cmt"># All page objects created</span> + <span class="ruby-ivar">@pages_semaphore</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment cmt"># Used to sync operations on @pages</span> + <span class="ruby-ivar">@mutex</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment cmt"># Used for any other member variables</span> + <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">lock</span> + <span class="ruby-comment cmt"># Log in to the client. We specify a static client name so only one instance can run</span> + <span class="ruby-comment cmt"># at a time.</span> + <span class="ruby-ivar">@client</span> = <span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">FCP</span><span class="ruby-operator">::</span><span class="ruby-constant">Client</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'IndexR'</span>) + + <span class="ruby-comment cmt"># Start mining the pages</span> + <span class="ruby-constant">START_PAGES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">page</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">mine_page</span>(<span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">page</span>)) + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">unlock</span> + + <span class="ruby-identifier">puts</span> <span class="ruby-value str">'Starting processing'</span> + <span class="ruby-comment cmt"># This loop culls threads and checks if processing is complete</span> + <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">lock</span> + <span class="ruby-ivar">@process_threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"Thread count: #{@process_threads.length}"</span> + <span class="ruby-keyword kw">begin</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value">0</span><span class="ruby-value">.5</span>) + <span class="ruby-ivar">@process_threads</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span><span class="ruby-operator">==</span><span class="ruby-identifier">thread</span>} + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span> <span class="ruby-comment cmt"># Make sure a mistake in a thread doesn't kill everything... Could be done better</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"Exception in processing thread: #{e.to_s}"</span> + <span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>) + <span class="ruby-ivar">@process_threads</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span><span class="ruby-operator">==</span><span class="ruby-identifier">thread</span>} + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"URIs waiting: #{@waiting_urls.length}, Total Scanned: #{@all_uris.length}"</span> + <span class="ruby-identifier">puts</span> <span class="ruby-ivar">@waiting_urls</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@waiting_urls</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span> + <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-identifier">sleep</span>(<span class="ruby-value">5</span>) + <span class="ruby-comment cmt"># If there are no waiting URLs and no processing threads we're done.</span> + <span class="ruby-comment cmt"># We should lock here...</span> + <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@process_threads</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@waiting_urls</span>.<span class="ruby-identifier">empty?</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">puts</span> <span class="ruby-value str">'All processing done'</span> + <span class="ruby-identifier">create_index_page</span> <span class="ruby-comment cmt"># create the page</span> + <span class="ruby-identifier">puts</span> <span class="ruby-value str">'Disconnecting'</span> + <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">disconnect</span> <span class="ruby-comment cmt"># disconnect</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000006.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000006.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000006.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>mine_page (IndexR)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File indexr/indexer.rb, line 74</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mine_page</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">depth</span>=<span class="ruby-value">0</span>) + <span class="ruby-comment cmt"># Filter out pages we don't want (images, binaries)</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\.html$/</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\.htm$/</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\/$/</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-value str">''</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"Ignoring path '#{uri.path.to_s}'"</span> + <span class="ruby-keyword kw">return</span> + <span class="ruby-keyword kw">end</span> + + <span class="ruby-comment cmt"># Check that we don't duplicate the page request</span> + <span class="ruby-identifier">uri_queued</span> = <span class="ruby-keyword kw">false</span> + <span class="ruby-ivar">@pages_semaphore</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-identifier">uri_queued</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@all_uris</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> + <span class="ruby-ivar">@waiting_urls</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri_queued</span> + <span class="ruby-ivar">@all_uris</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">uri_queued</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-comment cmt"># If it's already being checked we stop</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uri_queued</span> + <span class="ruby-keyword kw">return</span> + <span class="ruby-keyword kw">end</span> + + <span class="ruby-comment cmt"># Get the page</span> + <span class="ruby-ivar">@client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>, <span class="ruby-keyword kw">true</span>, <span class="ruby-value str">"Persistence"</span>=<span class="ruby-operator">></span><span class="ruby-value str">'connection'</span>,<span class="ruby-value str">'PriorityClass'</span>=<span class="ruby-operator">></span><span class="ruby-value">3</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">status</span>, <span class="ruby-identifier">message</span>, <span class="ruby-identifier">response</span><span class="ruby-operator">|</span> + <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">lock</span> <span class="ruby-comment cmt"># Lock the object</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">status</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:finished</span> <span class="ruby-comment cmt"># If we have the data and it's text/html we process it.</span> + <span class="ruby-identifier">page</span> = <span class="ruby-identifier">response</span>.<span class="ruby-identifier">data</span> + <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">content_type</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^text\/html/</span> + <span class="ruby-identifier">thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-comment cmt"># Do it in a new thread, just because.</span> + <span class="ruby-keyword kw">begin</span> + <span class="ruby-identifier">process_page</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">response</span>.<span class="ruby-identifier">data</span>, <span class="ruby-identifier">depth</span>) + <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{e.to_s}"</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@process_threads</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">thread</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"Unknown content type: #{message.content_type} URI:#{uri.uri}"</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:failed</span> <span class="ruby-comment cmt"># If it failed then we ditch the URI</span> + <span class="ruby-ivar">@pages_semaphore</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-ivar">@waiting_urls</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">u</span><span class="ruby-operator">|</span> <span class="ruby-identifier">u</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>} + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:redirect</span> <span class="ruby-comment cmt"># In case of redirect we issue a new request for it.</span> + <span class="ruby-ivar">@pages_semaphore</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-ivar">@waiting_urls</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">u</span><span class="ruby-operator">|</span> <span class="ruby-identifier">u</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>} + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-identifier">mine_page</span>(<span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">response</span>.<span class="ruby-identifier">items</span>[<span class="ruby-value str">'RedirectURI'</span>]), <span class="ruby-identifier">depth</span>) + <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">lock</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:retrying</span> + <span class="ruby-identifier">puts</span> <span class="ruby-value str">"Got retry notification"</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:pending</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@mutex</span>.<span class="ruby-identifier">unlock</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000007.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000007.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000007.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>process_page (IndexR)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File indexr/indexer.rb, line 137</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_page</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">page</span>, <span class="ruby-identifier">depth</span>) + <span class="ruby-keyword kw">begin</span> + <span class="ruby-identifier">page</span> = <span class="ruby-constant">FreenetPage</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">page</span>) + <span class="ruby-identifier">page</span>.<span class="ruby-identifier">links</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">link</span><span class="ruby-operator">|</span> + <span class="ruby-comment cmt"># We only want to mine freenet pages, not anything that operates directly on FProxy, like</span> + <span class="ruby-comment cmt"># add bookmark links</span> + <span class="ruby-keyword kw">begin</span> + <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">link</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\/?([KSU]S|CH)K/</span> + <span class="ruby-identifier">mine_page</span>(<span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">link</span>),<span class="ruby-identifier">depth</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">depth</span> <span class="ruby-operator">==</span> <span class="ruby-constant">RECURSE_DEPTH</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^\//</span> + <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^\?/</span> + <span class="ruby-keyword kw">else</span> + <span class="ruby-identifier">mine_page</span>(<span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">URI</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">link</span>),<span class="ruby-identifier">depth</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">depth</span> <span class="ruby-operator">==</span> <span class="ruby-constant">RECURSE_DEPTH</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Freenet</span><span class="ruby-operator">::</span><span class="ruby-constant">URIError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"Bad URI: #{link}"</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@pages_semaphore</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-ivar">@pages</span>[<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>] = <span class="ruby-identifier">page</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span> <span class="ruby-comment cmt"># This is normally a bad URI or something that's not HTML</span> + <span class="ruby-identifier">puts</span> <span class="ruby-node">"Processing Exception: #{e.to_s}\n#{e.backtrace.join("\n")}"</span> + <span class="ruby-keyword kw">ensure</span> <span class="ruby-comment cmt"># Make sure we delete the URI from the waiting list no matter what</span> + <span class="ruby-ivar">@pages_semaphore</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-ivar">@waiting_urls</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">u</span><span class="ruby-operator">|</span> <span class="ruby-identifier">u</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">uri</span>} + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000008.html =================================================================== --- trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000008.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/classes/IndexR.src/M000008.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html> +<head> + <title>create_index_page (IndexR)</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> +</head> +<body class="standalone-code"> + <pre><span class="ruby-comment cmt"># File indexr/indexer.rb, line 169</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_index_page</span> + <span class="ruby-identifier">template</span> = <span class="ruby-keyword kw">nil</span> + <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-value str">'index.rhtml'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">template</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">'-'</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@pages_semaphore</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span> + <span class="ruby-ivar">@pages</span>.<span class="ruby-identifier">delete_if</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">uri</span>, <span class="ruby-identifier">page</span><span class="ruby-operator">|</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">nil?</span> } + <span class="ruby-constant">START_PAGES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">uri</span><span class="ruby-operator">|</span> + <span class="ruby-ivar">@pages</span>[<span class="ruby-identifier">uri</span>].<span class="ruby-identifier">run_rank</span>(<span class="ruby-value">5</span>, <span class="ruby-ivar">@pages</span>) + <span class="ruby-keyword kw">end</span> + <span class="ruby-ivar">@sorted_pages</span> = <span class="ruby-ivar">@pages</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">sort</span> + <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-value str">'index.html'</span>, <span class="ruby-value str">'w'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">template</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)) + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span> + <span class="ruby-keyword kw">end</span></pre> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/created.rid =================================================================== --- trunk/apps/rubyFreenet/doc/created.rid 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/created.rid 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1 @@ +Thu Jun 08 22:08:59 NZST 2006 Added: trunk/apps/rubyFreenet/doc/files/freenet/exceptions_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/freenet/exceptions_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/freenet/exceptions_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: exceptions.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>exceptions.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>freenet/exceptions.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 21:59:15 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/files/freenet/fcp/client_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/freenet/fcp/client_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/freenet/fcp/client_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: client.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>client.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>freenet/fcp/client.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 22:05:15 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + <div id="requires-list"> + <h3 class="section-bar">Required files</h3> + + <div class="name-list"> + md5 + socket + thread + logger + </div> + </div> + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/files/freenet/fcp/exceptions_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/freenet/fcp/exceptions_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/freenet/fcp/exceptions_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: exceptions.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>exceptions.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>freenet/fcp/exceptions.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 21:59:14 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/files/freenet/fcp/message_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/freenet/fcp/message_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/freenet/fcp/message_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: message.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>message.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>freenet/fcp/message.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 21:58:35 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + <div id="requires-list"> + <h3 class="section-bar">Required files</h3> + + <div class="name-list"> + md5 + thread + </div> + </div> + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/files/freenet/fcp_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/freenet/fcp_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/freenet/fcp_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: fcp.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>fcp.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>freenet/fcp.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 21:59:37 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + <div id="requires-list"> + <h3 class="section-bar">Required files</h3> + + <div class="name-list"> + fcp/exceptions + fcp/message + fcp/client + </div> + </div> + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/files/freenet/uri_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/freenet/uri_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/freenet/uri_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: uri.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>uri.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>freenet/uri.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 21:55:12 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/files/freenet_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/freenet_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/freenet_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: freenet.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>freenet.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>freenet.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 21:59:48 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + <div id="requires-list"> + <h3 class="section-bar">Required files</h3> + + <div class="name-list"> + <a href="freenet/exceptions_rb.html">freenet/exceptions</a> + <a href="freenet/uri_rb.html">freenet/uri</a> + <a href="freenet/fcp_rb.html">freenet/fcp</a> + </div> + </div> + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/files/indexr/indexer_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/indexr/indexer_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/indexr/indexer_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: indexer.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>indexer.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>indexr/indexer.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 22:00:39 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + <div id="requires-list"> + <h3 class="section-bar">Required files</h3> + + <div class="name-list"> + freenet_client + erb + rubyful_soup + </div> + </div> + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/files/rsite/rsite_rb.html =================================================================== --- trunk/apps/rubyFreenet/doc/files/rsite/rsite_rb.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/files/rsite/rsite_rb.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>File: rsite.rb</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> + <script type="text/javascript"> + // <![CDATA[ + + function popupCode( url ) { + window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") + } + + function toggleCode( id ) { + if ( document.getElementById ) + elem = document.getElementById( id ); + else if ( document.all ) + elem = eval( "document.all." + id ); + else + return false; + + elemStyle = elem.style; + + if ( elemStyle.display != "block" ) { + elemStyle.display = "block" + } else { + elemStyle.display = "none" + } + + return true; + } + + // Make codeblocks hidden by default + document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) + + // ]]> + </script> + +</head> +<body> + + + + <div id="fileHeader"> + <h1>rsite.rb</h1> + <table class="header-table"> + <tr class="top-aligned-row"> + <td><strong>Path:</strong></td> + <td>rsite/rsite.rb + </td> + </tr> + <tr class="top-aligned-row"> + <td><strong>Last Update:</strong></td> + <td>Thu Jun 08 21:51:49 NZST 2006</td> + </tr> + </table> + </div> + <!-- banner header --> + + <div id="bodyContent"> + + + + <div id="contextContent"> + + + <div id="requires-list"> + <h3 class="section-bar">Required files</h3> + + <div class="name-list"> + freenet_client + </div> + </div> + + </div> + + + </div> + + + <!-- if includes --> + + <div id="section"> + + + + + + + + + <!-- if method_list --> + + + </div> + + +<div id="validator-badges"> + <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> +</div> + +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/fr_class_index.html =================================================================== --- trunk/apps/rubyFreenet/doc/fr_class_index.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/fr_class_index.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,40 @@ + +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<!-- + + Classes + + --> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Classes</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="rdoc-style.css" type="text/css" /> + <base target="docwin" /> +</head> +<body> +<div id="index"> + <h1 class="section-bar">Classes</h1> + <div id="index-entries"> + <a href="classes/Freenet.html">Freenet</a><br /> + <a href="classes/Freenet/FCP.html">Freenet::FCP</a><br /> + <a href="classes/Freenet/FCP/Client.html">Freenet::FCP::Client</a><br /> + <a href="classes/Freenet/FCP/FCPConnectionError.html">Freenet::FCP::FCPConnectionError</a><br /> + <a href="classes/Freenet/FCP/Message.html">Freenet::FCP::Message</a><br /> + <a href="classes/Freenet/FCP/RequestFailed.html">Freenet::FCP::RequestFailed</a><br /> + <a href="classes/Freenet/FCP/RequestFinished.html">Freenet::FCP::RequestFinished</a><br /> + <a href="classes/Freenet/Site.html">Freenet::Site</a><br /> + <a href="classes/Freenet/SiteError.html">Freenet::SiteError</a><br /> + <a href="classes/Freenet/URI.html">Freenet::URI</a><br /> + <a href="classes/Freenet/URIError.html">Freenet::URIError</a><br /> + <a href="classes/FreenetPage.html">FreenetPage</a><br /> + <a href="classes/FreenetPageError.html">FreenetPageError</a><br /> + <a href="classes/IndexR.html">IndexR</a><br /> + </div> +</div> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/fr_file_index.html =================================================================== --- trunk/apps/rubyFreenet/doc/fr_file_index.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/fr_file_index.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,35 @@ + +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<!-- + + Files + + --> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Files</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="rdoc-style.css" type="text/css" /> + <base target="docwin" /> +</head> +<body> +<div id="index"> + <h1 class="section-bar">Files</h1> + <div id="index-entries"> + <a href="files/freenet_rb.html">freenet.rb</a><br /> + <a href="files/freenet/exceptions_rb.html">freenet/exceptions.rb</a><br /> + <a href="files/freenet/fcp_rb.html">freenet/fcp.rb</a><br /> + <a href="files/freenet/fcp/client_rb.html">freenet/fcp/client.rb</a><br /> + <a href="files/freenet/fcp/exceptions_rb.html">freenet/fcp/exceptions.rb</a><br /> + <a href="files/freenet/fcp/message_rb.html">freenet/fcp/message.rb</a><br /> + <a href="files/freenet/uri_rb.html">freenet/uri.rb</a><br /> + <a href="files/indexr/indexer_rb.html">indexr/indexer.rb</a><br /> + <a href="files/rsite/rsite_rb.html">rsite/rsite.rb</a><br /> + </div> +</div> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/fr_method_index.html =================================================================== --- trunk/apps/rubyFreenet/doc/fr_method_index.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/fr_method_index.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,62 @@ + +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<!-- + + Methods + + --> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>Methods</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> + <link rel="stylesheet" href="rdoc-style.css" type="text/css" /> + <base target="docwin" /> +</head> +<body> +<div id="index"> + <h1 class="section-bar">Methods</h1> + <div id="index-entries"> + <a href="classes/FreenetPage.html#M000004"><=> (FreenetPage)</a><br /> + <a href="classes/Freenet/URI.html#M000029"><=> (Freenet::URI)</a><br /> + <a href="classes/Freenet/FCP/Message.html#M000012">callback (Freenet::FCP::Message)</a><br /> + <a href="classes/FreenetPage.html#M000003">categorize (FreenetPage)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000016">connect (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/Site.html#M000032">connect (Freenet::Site)</a><br /> + <a href="classes/IndexR.html#M000008">create_index_page (IndexR)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000017">disconnect (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/Site.html#M000033">generate_key (Freenet::Site)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000019">generate_keypair (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000020">get (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/Site.html#M000035">insert_file (Freenet::Site)</a><br /> + <a href="classes/Freenet/Site.html#M000034">insert_site (Freenet::Site)</a><br /> + <a href="classes/Freenet/Site.html#M000030">load (Freenet::Site)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000018">load_request (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/FCP/Message.html#M000010">lock (Freenet::FCP::Message)</a><br /> + <a href="classes/Freenet/URI.html#M000027">merge (Freenet::URI)</a><br /> + <a href="classes/IndexR.html#M000006">mine_page (IndexR)</a><br /> + <a href="classes/FreenetPage.html#M000001">new (FreenetPage)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000015">new (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/FCP/Message.html#M000009">new (Freenet::FCP::Message)</a><br /> + <a href="classes/Freenet/Site.html#M000031">new (Freenet::Site)</a><br /> + <a href="classes/IndexR.html#M000005">new (IndexR)</a><br /> + <a href="classes/Freenet/FCP/RequestFailed.html#M000024">new (Freenet::FCP::RequestFailed)</a><br /> + <a href="classes/Freenet/URI.html#M000025">new (Freenet::URI)</a><br /> + <a href="classes/IndexR.html#M000007">process_page (IndexR)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000021">put (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000022">putdir (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/FCP/Message.html#M000013">reply= (Freenet::FCP::Message)</a><br /> + <a href="classes/Freenet/FCP/Client.html#M000023">request_status (Freenet::FCP::Client)</a><br /> + <a href="classes/Freenet/URI.html#M000028">root? (Freenet::URI)</a><br /> + <a href="classes/FreenetPage.html#M000002">run_rank (FreenetPage)</a><br /> + <a href="classes/Freenet/Site.html#M000036">save (Freenet::Site)</a><br /> + <a href="classes/Freenet/FCP/Message.html#M000011">unlock (Freenet::FCP::Message)</a><br /> + <a href="classes/Freenet/URI.html#M000026">uri (Freenet::URI)</a><br /> + <a href="classes/Freenet/FCP/Message.html#M000014">wait_for_response (Freenet::FCP::Message)</a><br /> + </div> +</div> +</body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/index.html =================================================================== --- trunk/apps/rubyFreenet/doc/index.html 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/index.html 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> + +<!-- + + RDoc Documentation + + --> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <title>RDoc Documentation</title> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> +</head> +<frameset rows="20%, 80%"> + <frameset cols="25%,35%,45%"> + <frame src="fr_file_index.html" title="Files" name="Files" /> + <frame src="fr_class_index.html" name="Classes" /> + <frame src="fr_method_index.html" name="Methods" /> + </frameset> + <frame src="classes/Freenet/FCP/Client.html" name="docwin" /> +</frameset> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/doc/rdoc-style.css =================================================================== --- trunk/apps/rubyFreenet/doc/rdoc-style.css 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/doc/rdoc-style.css 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,208 @@ + +body { + font-family: Verdana,Arial,Helvetica,sans-serif; + font-size: 90%; + margin: 0; + margin-left: 40px; + padding: 0; + background: white; +} + +h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; } +h1 { font-size: 150%; } +h2,h3,h4 { margin-top: 1em; } + +a { background: #eef; color: #039; text-decoration: none; } +a:hover { background: #039; color: #eef; } + +/* Override the base stylesheet's Anchor inside a table cell */ +td > a { + background: transparent; + color: #039; + text-decoration: none; +} + +/* and inside a section title */ +.section-title > a { + background: transparent; + color: #eee; + text-decoration: none; +} + +/* === Structural elements =================================== */ + +div#index { + margin: 0; + margin-left: -40px; + padding: 0; + font-size: 90%; +} + + +div#index a { + margin-left: 0.7em; +} + +div#index .section-bar { + margin-left: 0px; + padding-left: 0.7em; + background: #ccc; + font-size: small; +} + + +div#classHeader, div#fileHeader { + width: auto; + color: white; + padding: 0.5em 1.5em 0.5em 1.5em; + margin: 0; + margin-left: -40px; + border-bottom: 3px solid #006; +} + +div#classHeader a, div#fileHeader a { + background: inherit; + color: white; +} + +div#classHeader td, div#fileHeader td { + background: inherit; + color: white; +} + + +div#fileHeader { + background: #057; +} + +div#classHeader { + background: #048; +} + + +.class-name-in-header { + font-size: 180%; + font-weight: bold; +} + + +div#bodyContent { + padding: 0 1.5em 0 1.5em; +} + +div#description { + padding: 0.5em 1.5em; + background: #efefef; + border: 1px dotted #999; +} + +div#description h1,h2,h3,h4,h5,h6 { + color: #125;; + background: transparent; +} + +div#validator-badges { + text-align: center; +} +div#validator-badges img { border: 0; } + +div#copyright { + color: #333; + background: #efefef; + font: 0.75em sans-serif; + margin-top: 5em; + margin-bottom: 0; + padding: 0.5em 2em; +} + + +/* === Classes =================================== */ + +table.header-table { + color: white; + font-size: small; +} + +.type-note { + font-size: small; + color: #DEDEDE; +} + +.xxsection-bar { + background: #eee; + color: #333; + padding: 3px; +} + +.section-bar { + color: #333; + border-bottom: 1px solid #999; + margin-left: -20px; +} + + +.section-title { + background: #79a; + color: #eee; + padding: 3px; + margin-top: 2em; + margin-left: -30px; + border: 1px solid #999; +} + +.top-aligned-row { vertical-align: top } +.bottom-aligned-row { vertical-align: bottom } + +/* --- Context section classes ----------------------- */ + +.context-row { } +.context-item-name { font-family: monospace; font-weight: bold; color: black; } +.context-item-value { font-size: small; color: #448; } +.context-item-desc { color: #333; padding-left: 2em; } + +/* --- Method classes -------------------------- */ +.method-detail { + background: #efefef; + padding: 0; + margin-top: 0.5em; + margin-bottom: 1em; + border: 1px dotted #ccc; +} +.method-heading { + color: black; + background: #ccc; + border-bottom: 1px solid #666; + padding: 0.2em 0.5em 0 0.5em; +} +.method-signature { color: black; background: inherit; } +.method-name { font-weight: bold; } +.method-args { font-style: italic; } +.method-description { padding: 0 0.5em 0 0.5em; } + +/* --- Source code sections -------------------- */ + +a.source-toggle { font-size: 90%; } +div.method-source-code { + background: #262626; + color: #ffdead; + margin: 1em; + padding: 0.5em; + border: 1px dashed #999; + overflow: hidden; +} + +div.method-source-code pre { color: #ffdead; overflow: hidden; } + +/* --- Ruby keyword styles --------------------- */ + +.standalone-code { background: #221111; color: #ffdead; overflow: hidden; } + +.ruby-constant { color: #7fffd4; background: transparent; } +.ruby-keyword { color: #00ffff; background: transparent; } +.ruby-ivar { color: #eedd82; background: transparent; } +.ruby-operator { color: #00ffee; background: transparent; } +.ruby-identifier { color: #ffdead; background: transparent; } +.ruby-node { color: #ffa07a; background: transparent; } +.ruby-comment { color: #b22222; font-weight: bold; background: transparent; } +.ruby-regexp { color: #ffa07a; background: transparent; } +.ruby-value { color: #7fffd4; background: transparent; } \ No newline at end of file Added: trunk/apps/rubyFreenet/freenet/exceptions.rb =================================================================== --- trunk/apps/rubyFreenet/freenet/exceptions.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/freenet/exceptions.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,5 @@ +module Freenet + # Raised if a URI can't be parsed or handled for some reason + class URIError < Exception + end +end \ No newline at end of file Added: trunk/apps/rubyFreenet/freenet/fcp/client.rb =================================================================== --- trunk/apps/rubyFreenet/freenet/fcp/client.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/freenet/fcp/client.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,505 @@ +require 'md5' +require 'socket' +require 'thread' +require 'logger' + +module Freenet + module FCP + # Implements Freenet Client Protocol client in Ruby. It is multithreaded and mostly thread-safe. + # + # == Bugs + # + # Probably many. This should get better. + # + # == Future Development + # + # I hope to add more convinience methods, such as being able to insert data from any IO + # object instead of strings only. ClientPutDir and ClientPutComplexDir still need to be + # implemented. + # + # Polling-based asynchronous use may be implemented if there's demand. + # + # I probably need to tidy up the exception structure. + # + # == Examples + # + # === Synchronous Use + # + # Synchronous use is the easiest way to interface with FCP. The calling thread will block + # until a response is received from the server. This is limited in use as responses may + # take a long time. + # + # Client names are unique to an application. If your application may have more than one + # instance per node then each instance must have a unique name. In the event of a name + # conflict FRED assumes that the original application has died and the new one is a replacement + # and disconnects the oldest connection, + # + # require 'freenet/client' + # client = Freenet::FCP::Client.new('MyFreenetClient', '127.0.0.1', 9481) + # file = client.get("KSK at gpl.txt") + # + # === Asynchronous Use + # + # There are two methods to asynchronous requests, both with their own merits + # + # ==== Polling + # + # Polling is not implemented yet, but Messages will have a ResponseQueue where responses + # can be read in order or recipt. + # + # ==== Callbacks + # + # FCP::Message can take a block to run as soon as a reply is received. These blocks run + # in a separate thread, so they must be thread safe if they use variables outside their + # scope. The block arguments are |status, message, response|, message is the original + # message for reference purposes. + # + # client.get("KSK at gpl.txt") do |status, message, response| + # case status + # when :finished then puts response.data + # end + # end + # + # See method details for possible status codes. All callbacks may get the following + # [:error] Freenet reported a ProtocolError + # + # ==== Thread safety + # + # In callbacks the messages are locked before the callback runs. Always + # acquire locks with Message#lock before using, but don't forget to release with Message#unlock. + # + # Message#synchronize may be implemented later. + class Client + include Logger::Severity + + # Constructor, prepares various settings and connects to the Freenet node + # + # [client_name] A unique identifier to your client, it should be the same for all connections. + # It allows persistent connections to find old requests + # [server] The IP of the FCP host, normally 127.0.0.1 + # [port] The associated TCP port, normally 9481 + # [options] Currently unused. + # + # raises FCPConnectionError if connection fails + def initialize(client_name=nil, server="127.0.0.1", port=9481, options={}) + @client_name = client_name || MD5.md5(Time.now.to_s) + @options, @server, @port = options, server, port + @messages = {} + @running = false + @lock = Mutex.new + @logger_mutex = Mutex.new + @logger = Logger.new('FCPClientLog','daily') + @message_queue = Queue.new + connect + hello + end + + # Performs the connection and worker thread creation + # + # raises FCPConnectionError if something goes wrong + def connect + @lock.synchronize do + log(INFO, "Connecting to #{@server}:#{@port}") + @socket = TCPSocket.open(@server, @port) + @running = true + @socket_thread = Thread.new {socket_thread} + log(DEBUG, "Running thread") + end + rescue + raise FCPConnectionError.new('Connection failed') + end + + # Get the worker thread to disconnect. Doesn't guarantee immediate disconnection + # as any message currently being read will still be processed + def disconnect + log(INFO, 'Disconnecting') + @lock.synchronize do + @running = false + end + @socket_thread.join if @socket_thread + end + + # Loads a request in to the queue. This is for persistent requests, read the notes above for more + # details + def load_request(message) + message.load_only = true + @message_queue << message + end + + ### + # Request methods + ### + + # Generates a keypair for SSK use. If used synchronously it returns + # [InsertURI, RequestURI], otherwise extract InsertURI and RequestURI + # from response.items + def generate_keypair(async, &callback) + message = Message.new('GenerateSSK', nil, nil, callback) + send(message, async) + if async + message + else + [message.response.items['InsertURI'], message.response.items['RequestURI']] + end + end + + # == Request a file from Freenet. + # + # Synchronous requests will either get the response message or a RequestFailed exception + # + # Asyncronous requests get a lot more status information. The messages are: + # [:pending] The message is in Freenet's queue. + # [:progress] A SimpleProgress message has been recieved + # [:redirect] The node has found a redirect for the file. This is returned + # to the client so a new request can be started, redirects are + # *NOT* followed automatically + # [:retrying] A non-fatal error has been encountered (eg remote node overloaded) + # and a retry is automatically happening. This is controlled by + # Message#retries + # [:failed] The request has failed, more details in the response + # [:found] The data has been found, but not returned to the client. If ReturnType + # is not direct (the default) now is the time to do something + # [:finished] The data has been returned to the client, response.data has it + # + # === Usage Examples + # ==== Synchronous Use + # gpl = client.get('KSK at gpl.txt') + # + # ==== Asynchronous use + # client.get('KSK at gpl.txt', false, 'Persistence'=>'connection') do |status, message, response| + # case status + # when :finished then puts response.data + # end + # end + def get(uri, async=false, options=nil, &callback) + uri = uri.uri if uri.respond_to? :uri + async = true if callback + options = {'IgnoreDS'=>false, + 'DSOnly'=>false, + 'Verbosity'=>1, + 'ReturnType'=>'direct', + 'PriorityClass'=>1, + 'Persistence'=>'reboot', + 'Global'=>false}.merge(options || {}) + options['Persistence'] = 'connection' unless async + options['URI'] = uri + message = Message.new('ClientGet', nil, options, callback) + send(message, async) + if async + message + else + loop do + message.lock + case message.response.type + when 'AllData' + message.unlock + return message.response + when 'GetFailed' + message.unlock + raise RequestFailed.new(message.response) + else + message.unlock + end + end + end + end + + # === Put data in to freenet + # + # This is a very simple put, if you wish to insert a directory then use + # Client#put_dir or Client#put_complex_dir. + # + # Synchronous requests get the inserted URI or a RequestFailed exception. + # Asynchronous requsts get the following callbacks: + # [:uri_generated] Freenet has generated the URI (in +response.items['URI']+). + # Insertion hasn't happened at this stage, but the URI is known + # [:success] The data has been inserted successfully. + # [:failed] The insertion has failed, response.items contains more information + # + # === Usage Examples + # ==== Putting data from Ruby + # put('KSK at my-key', 'This is my text string', false, 'Metadata.ContentType'=> 'text/plain') + # + # ==== Putting a file from disk (must be local to server, not client) + # put('KSK at my-key', nil, false, 'MetaData.ContentType'=>'text/plain', 'UploadFrom'=>'disk', 'Filename'=>'/full/path/to/file') + # + # ==== Creating a redirect URI + # put('SSK at my-site-key/my-site/image.jpg', nil, false, 'UploadFrom'=>'redirect','TargetURI'=>'KSK at image.jpg') + def put(uri, data=nil, async=false, options=nil, &callback) + uri = uri.uri if uri.respond_to? :uri + async = true if callback + options = {'Metadata.ContentType' => 'application/octet-stream', + 'Verbosity' => 1, + 'MaxRetries' => 10, + 'Persistence' => 'reboot', + 'UploadFrom' => 'direct'}.merge(options || {}) + options['Persistence'] = 'connection' unless async + options['URI'] = uri + message = Message.new('ClientPut', data, options, callback) + message.content-type = options['Metadata.ContentType'] + send(message, async) + if async + message + else + loop do + message.lock + case message.response.type + when 'PutSuccessful' + message.unlock + return message.response.items['URI'] + when 'PutFailed' + message.unlock + raise RequestFailed.new(message.response) + else + message.unlock + end + end + end + end + + # Upload a directory to a key, either SSK or USK. This directory must be local to the + # node we're connecting to. + def putdir(uri, dir, async=false, options=nil, &callback) + uri = uri.uri if uri.respond_to? :uri + async = true if callback + options = {'Verbosity' => 1, + 'MaxRetries' => 10, + 'PriorityClass' => 3, + 'DefaultName' => 'index.html', + 'Filename' => dir.to_s + 'AllowUnreadableFiles' => 'true'}.merge(options || {}) + options['Persistence'] = 'connection' unless async + options['URI'] = uri + message = Message.new('ClientPutDiskDir', nil, options, callback) + send(message, async) + if async + message + else + loop do + message.lock + case message.response.type + when 'PutSuccessful' + message.unlock + return message.response.items['URI'] + when 'PutFailed' + message.unlock + raise RequestFailed.new(message.response) + else + message.unlock + end + end + end + end + + # Get the request status for a persistent request. Not useful in synchronous systems. + # + # Any replies will be directed to the async message's callback + def request_status(identifier, global, async=false) + log(DEBUG, 'Requesting status') + message = Message.new('GetRequestStatus', nil, 'Identifier'=>identifier, 'Global'=>global) + send(message, async) + end + + private + # Send the ClientHello message to the FCP server. + def hello + log(DEBUG, 'Sending ClientHello') + message = Message.new('ClientHello', nil, 'Name'=>@client_name, 'ExpectedVersion'=>'2.0') + send(message) + log(DEBUG, "Got NodeHello - Freenet #{message.response.items['Version']}") + if message.response.items['Testnet'] == 'true' + log(WARN, "Connected to Testnet, you have no anonymity!") + end + end + + # Logger utility method + def log(severity, message) + @logger_mutex.synchronize {@logger.add(severity, message)} + end + + # Queue the message for sending by the worker thread. + # [message] The FCP::Message to send to the server. You may retain object for later use, but + # it may block if it's in use. + # param asynchronous Whether the reader should block until a response is received + def send(message, asynchronous = false) + log(DEBUG, "Queuing #{message.type} - #{message.identifier}") + @message_queue << message + unless asynchronous + return message.wait_for_response + end + end + + # Worker thread, loops every second or so and checks for new messages to send then messages + # to receive. It is also responsible for culling the callback threads. + def socket_thread + @callback_threads = [] + loop do + @callback_threads.each do |thread| + begin + thread.join(0.1) + rescue RequestFinished=>e + @messages.delete(e.message) + rescue Exception=>e + puts "Callback exception #{e}" + end + end + @lock.synchronize do + if @running == false + @socket.close + Thread.exit + end + end + begin + while message = @message_queue.pop(true) + send_message(message) + end + rescue ThreadError => e + end + + if select([@socket], nil, nil, 1) + message = read_message + dispatch_message(message) + end + end + rescue Exception => e + log(FATAL, "Exception in socket thread: #{e.class}: #{e.message}") + raise e + ensure + @socket.close + end + + # Dispatch a message received from the server. Sets the reply on the original message and then + # calls any callback. See above for notes on callbacks. + def dispatch_message(message) + log(DEBUG, "Dispatching #{message.type} - #{message.identifier}") + if message.identifier + original_message = @messages[message.identifier] + if original_message + original_message.reply = message + thread = Thread.new do + original_message.lock + message.lock + case message.type + when 'SSKKeypair' + original_message.callback(:keypair) + when 'AllData' + original_message.callback(:finished) + when 'PersistentGet' + original_message.callback(:pending) + when 'SimpleProgress' + original_message.callback(:progress) + when 'ProtocolError' + original_message.callback(:failed) + when 'URIGenerated' + original_message.callback(:uri_generated) + when 'PutSuccessful' + original_message.callback(:success) + when 'PutFailed' + original_message.callback(:failed) + when 'ProtocolError' + original_message.callback(:error) + when 'DataFound' + original_message.callback(:found) + original_message.content_type = message.items['Metadata.ContentType'] + if original_message.items['Persistence'] != 'connection' and not original_message.data_found + original_message.data_found = true + request_status(message.identifier, message.items['Global'] || false, true) + end + when 'GetFailed' + if message.items['RedirectURI'] + original_message.callback(:redirect) + elsif message.items['Fatal'] == 'false' + case message.items['Code'] + when '15' # Node overloaded. Wait then re-request. We can re-use the ID as GetFailed removes the ID from FRED + if original_message.retries < 5 + original_message.retries += 1 + original_message.callback(:retrying) + log(DEBUG, "Retrying #{original_message.items['URI']}") + get(original_message.items['URI'], true, original_message.items) + else + original_message.callback(:failed) + end + else + original_message.callback(:failed) + end + else + original_message.callback(:failed) + end + end + message.unlock + original_message.unlock + end + @callback_threads << thread + else + log(WARN, 'Got a message for an unknown identifier. Did you forget to reload persistent requests?') + end + else + log(DEBUG, 'Got message with no identifier') + case message.type + when 'CloseConnectionDuplicateClientName' + raise FCPConnectionError.new('DuplicateClientName, disconnecting') + end + end + end + + # Writes an FCP::Message to the server + # + # raises FCPConnectionError if socket isn't connected + def send_message(message) + raise FCPConnectionError.new('Socket does not exist') unless @socket + log(DEBUG, "Sending #{message.type} #{message.identifier}") + @messages[message.identifier] ||= message + unless message.load_only + log(DEBUG, "W: #{message.type}") + @socket.write(message.type+"\n") + message.items.each do |key, value| + log(DEBUG, "W: #{key}=#{value}") + @socket.write("#{key}=#{value}\n") + end + + if message.data + @socket.write("DataLength=#{message.data.length}\n") + log(DEBUG, "W: DataLength=#{message.data.length}") + @socket.write("Data\n") + log(DEBUG, "W: Data") + @socket.write(message.data) + log(DEBUG, "W: #{message.data}") + else + @socket.write("EndMessage\n") + log(DEBUG, "W: EndMessage") + end + @socket.write("\n") + end + end + + # Reads a message from the server and returns an FCP::Message. Does not handle processing + # the message + # + # raises FCPConnectionError if socket isn't connected + def read_message + raise FCPConnectionError.new('Socket does not exist') unless @socket + items = {} + type = nil + data = nil + loop do + line = @socket.readline.strip + log(DEBUG, "R: #{line}") + case line + when "End","EndMessage" + break + when /=/ + key, value = line.split('=', 2) + items[key] = value + when "Data" + log(DEBUG, "Reading #{items['DataLength']} bytes") + data = @socket.read(items['DataLength'].to_i) + break + else + type = line if type == nil + end + end + return Message.new(type, data, items) + end + end + end +end \ No newline at end of file Added: trunk/apps/rubyFreenet/freenet/fcp/exceptions.rb =================================================================== --- trunk/apps/rubyFreenet/freenet/fcp/exceptions.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/freenet/fcp/exceptions.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,24 @@ +module Freenet + module FCP + # Raised if an FCP connection can't be made or if the + # connection dies. + class FCPConnectionError < Exception + end + + # If raised by a callback the entry is removed from the message list + # and the identifier can be reused properly + class RequestFinished < Exception + end + + # Raised if a synchronous request fails + class RequestFailed < Exception + attr_reader :code, :description, :extra, :fatal + def initialize(original_message) + @code = original_message.items['Code'] + @description = original_message.items['CodeDescription'] + @extra = original_message.items['ExtraDescription'] + @fatal = original_message.items['Fatal'] + end + end + end +end \ No newline at end of file Added: trunk/apps/rubyFreenet/freenet/fcp/message.rb =================================================================== --- trunk/apps/rubyFreenet/freenet/fcp/message.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/freenet/fcp/message.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,70 @@ +require 'md5' +require 'thread' + +module Freenet + module FCP + # An FCP::Message represents a communication between the server and client. It handles basic information + # and thread safety. When a response is received the original FCP::Message gets its response attribute + # set to the response FCP::Message + # + # Attributes of interest + # [load_only] Only load in to the message queue, don't actually send. Used when restoring persistent + # requests if a client dies + # [content_type] The content type of the data. Set automatically on response, set manually when inserting. + # [retries] + class Message + attr_reader :type, :data, :items, :identifier + attr_accessor :callback, :load_only, :response, :data_found, :content_type, :retries + + # [type] The FCP message type + # [data] Any data to send with the message + # [items] A hash of message parameters + # [callback] Callback for asynchronous messages + def initialize(type, data = nil, items = [], callback = nil) + @retries = 0 + @type, @data, @items = type.to_s, data, items + @items = {} unless @items.kind_of? Hash + @items['Identifier'] ||= "FCPMessage_#{MD5.md5(Time.now.to_s)}_#{rand(100000)}" + @identifier = @items['Identifier'] + if ['ClientHello','NodeHello'].include? @type + @identifier = 'ClientHello' + @items.delete('Identifier') + end + @callback = callback + @mutex = Mutex.new + @load_only = false + end + + # Lock the object. Call before using in async situations + def lock; @mutex.lock; end + + # Unlock. Call after using asychronously + def unlock; @mutex.unlock; end + + # Dispatch the callback. Private to FCP::Client + def callback(status) + @callback.call(status, self, @response) unless @callback.nil? + rescue => e + puts "ERROR: Exception in callback: #{e}\n#{e.backtrace.join("\n")}" + end + + # Sets the reply. This is private to FCP::Client + def reply=(response) + lock + @response = response + unlock + end + + # Used to block until the reply is received for synchronous messages. May be + # called from any thread. + def wait_for_response + until @response + sleep(0.5) + lock + unlock + Thread.pass + end + end + end + end +end \ No newline at end of file Added: trunk/apps/rubyFreenet/freenet/fcp.rb =================================================================== --- trunk/apps/rubyFreenet/freenet/fcp.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/freenet/fcp.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,3 @@ +require 'fcp/exceptions' +require 'fcp/message' +require 'fcp/client' \ No newline at end of file Added: trunk/apps/rubyFreenet/freenet/uri.rb =================================================================== --- trunk/apps/rubyFreenet/freenet/uri.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/freenet/uri.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,106 @@ +module Freenet + # Represents a Freenet URI. Provides manipulation with awareness of the Freenet structure, such + # as USK versioning. + # + # This could be completely wrong. Any criticism welcome + class URI + include Comparable + attr_reader :site, :path, :uri + + # This can take a URI in following formats: + # /freenet:SSK at ... + # SSK at ... + # + # Currently supports SSK, USK, KSK and CHK + def initialize(uri) + uri = uri.respond_to?(:uri) ? uri.uri : uri.dup + case uri + when /^\/?freenet:/ + uri.sub!(/^\/?freenet:/,'') + when /^\// + uri.sub!(/^\//, '') + end + raise URIError.new("Invalid Freenet URI: #{uri}") unless uri =~ /^(?:[UKS]S|CH)K@/ + + @uri = uri + @site = @uri.match(/^(?:[UKS]S|CH)K@[^\/]+/)[0] + @path = @uri.match(/(\/[^#\?]+)/)[1] if @uri =~ /\/[^#\?]+/ + @anchor = @uri.match(/#(.+)/)[1] if @uri =~ /#.+/ + @query_string = @uri.match(/\?([^#]+)/)[1] if @uri =~ /\?/ + end + + # Return a URI that can be fed to Freenet + def uri + "#{@site}#{@path}#{"?#{@query_string}" if @query_string}#{"##{@anchor}" if @anchor}" + end + + # Merge in a URI or a URI fragment and provide the finished URI. Attempts + # to do what a browser would + # uri.merge("image.jpg") + def merge(uri) + if uri =~ /^\// + return uri + end + uri = uri.strip + begin + uri = URI.new(uri) unless uri.respond_to? :uri + if uri.site == @site + return "#{@site}#{merge_paths(@path, uri.path)}" + else + return uri.uri + end + rescue URIError => e # We have a fragment + "#{@site}#{merge_paths(@path, uri)}" + end + end + + # Returns true if we're at the 'base' page of a URI using the following: + # - KSKs and CHKs only have one file, so always the base + # - SSKs have a 'base', eg SSK at .../mysite/ + # - USKs start with /sitename and end with /revision or -revision, though the latter + # is technically wrong. + # + # This may be completely wrong. Please tell me if it is. + def root? + case @site + when /^CHK/ then true + when /^KSK/ then true + when /^SSK/ then @path == %r{/[^/]/} + when /^USK/ then @path =~ %r{/[^/-]+[/-][0-9]+}i + else + false + end + end + + def <=>(other) + if other.site == @site + other.path <=> @path + else + other.site <=> @site + end + end + + private + def merge_paths(old_path, new_path) + case new_path + when /^\.\.\// + unless old_path =~ /\/$/ + old_path = old_path.gsub(/\/[^\/]+$/, '') + end + old_path = old_path.gsub(/\/[^\/]+$/,'/') + new_path = new_path.gsub(/^\.\.\//, '') + return merge_paths(old_path, new_path) + when /^\.\// + unless old_path =~ /\/$/ + old_path = old_path.gsub(/\/[^\/]+$/, '/') + end + new_path = new_path.gsub(/\.\//,'') + return "#{old_path}#{new_path}" + when /^\// + return new_path + else + return "#{old_path}#{new_path}" + end + end + end +end \ No newline at end of file Added: trunk/apps/rubyFreenet/freenet.rb =================================================================== --- trunk/apps/rubyFreenet/freenet.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/freenet.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,21 @@ +require 'freenet/exceptions' +require 'freenet/uri' +require 'freenet/fcp' + +if $0 == __FILE__ + client = Freenet::FCP::Client.new + index_url = "USK at PFeLTa1si2Ml5sDeUy7eDhPso6TPdmw-2gWfQ4Jg02w,3ocfrqgUMVWA2PeorZx40TW0c-FiIOL-TWKQHoDbVdE,AQABAAE/Index/34/" + #puts client.get(index_url).data + thread = Thread.new do + client.get(index_url, true) do |status, message, response| + case status + when :finished + puts "Request finished" + puts response.data + when :pending + end + end + end + thread.join + client.disconnect +end \ No newline at end of file Added: trunk/apps/rubyFreenet/indexr/README =================================================================== --- trunk/apps/rubyFreenet/indexr/README 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/indexr/README 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,3 @@ +Indexr is a basic freenet spider. It starts off at the darknet index and descends in to pages from there. + +It should be a decent example on how to use rubyFreenet, it's quite well documented. \ No newline at end of file Added: trunk/apps/rubyFreenet/indexr/index.rhtml =================================================================== --- trunk/apps/rubyFreenet/indexr/index.rhtml 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/indexr/index.rhtml 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,70 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html> + <head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> + <title>Indexr: The freenet spider</title> + <meta name="description" content="Indexr: An automated categorized Freenet spider" /> + <meta name="keywords" content="index directory links" /> + <style type="text/css" media="screen"> + /* <![CDATA[ */ + body { + margin: 0; + padding: 0; + font-family: 'Verdana','Helvetica','Arial','Geneva',sans-serif; + font-size: 90%; + } + h1 { + border-bottom: 1px solid rgb(200, 200, 200); + padding: 0.4em; + background: rgb(200, 250, 200); + margin: 0; + } + + h2 { + border-bottom: 1px solid rgb(200, 200, 200); + font-size: 120%; + padding: 0.2em; + padding-left: 1.5em; + margin: 0; + } + + #contents { + padding: 1em; + } + + .description { + padding-left: 2em; + } + + .page { + margin-bottom: .5em; + } + + a:link { + font-weight: bold; + } + /* ]]> */ + </style> + </head> + <body> + <h1>Indexr: <%=Time.now.strftime("%d/%m/%Y")%></h1> + <h2>Pages</h2> + <div id="contents"> + <% category = ''%> + <% @sorted_pages.each do |page| -%> + <% if category != page.category -%> + <h3><%= page.category.to_s %></h3> + <% category = page.category %> + <% end %> + <div class="page"> + <a href="/<%=page.uri.uri%>"><%=page.title%></a> <%=page.uri.path%> Rank: <%=((page.rank*100).ceil).to_f/100%><br /> + <% if page.meta['description'] -%> + <div class="description"><%=page.meta['description']%></div> + <div class="description"><%=page.meta['keywords']%></div> + <% end -%> + </div> + <% end -%> + </div> + </body> +</html> \ No newline at end of file Added: trunk/apps/rubyFreenet/indexr/indexr.rb =================================================================== --- trunk/apps/rubyFreenet/indexr/indexr.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/indexr/indexr.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,278 @@ +$:.push('../') +require 'freenet_client' +require 'erb' +require 'rubyful_soup' + +# Example for FreenetR useage. +# +# This is a very simple freenet spider. It starts at a URI, follows all HTML links if they have a valid Freenet +# URI and puts them on a page. Basic categorization is done based on tag density and META keywords and an erb file +# is called to produce HTML output. +# +# This isn't a pretty example, but it works. +class IndexR + # The depth to follow links to. Remember that the number of pages tends to increase rapidly + # with a single depth increase + RECURSE_DEPTH=5 + + # An array of URIs to start spidering with + START_PAGES = [ + "USK at PFeLTa1si2Ml5sDeUy7eDhPso6TPdmw-2gWfQ4Jg02w,3ocfrqgUMVWA2PeorZx40TW0c-FiIOL-TWKQHoDbVdE,AQABAAE/Index/34/" + ] + + # Start spidering + def initialize + @process_threads = [] # all the processing threads, so we can cull them + @waiting_urls = [] # The URIs waiting for response from Freenet + @all_uris = [] # All URIs checked, to prevent doubleups + @pages = {} # All page objects created + @pages_semaphore = Mutex.new # Used to sync operations on @pages + @mutex = Mutex.new # Used for any other member variables + @mutex.lock + # Log in to the client. We specify a static client name so only one instance can run + # at a time. + @client = Freenet::FCP::Client.new('IndexR') + + # Start mining the pages + START_PAGES.each do |page| + mine_page(Freenet::URI.new(page)) + end + @mutex.unlock + + puts 'Starting processing' + # This loop culls threads and checks if processing is complete + loop do + @mutex.lock + @process_threads.each do |thread| + puts "Thread count: #{@process_threads.length}" + begin + if thread.join(0.5) + @process_threads.delete_if {|x| x==thread} + end + rescue Exception => e # Make sure a mistake in a thread doesn't kill everything... Could be done better + puts "Exception in processing thread: #{e.to_s}" + puts e.backtrace.join("\n") + @process_threads.delete_if {|x| x==thread} + end + end + puts "URIs waiting: #{@waiting_urls.length}, Total Scanned: #{@all_uris.length}" + puts @waiting_urls.join("\n") if @waiting_urls.size < 3 + @mutex.unlock + sleep(5) + # If there are no waiting URLs and no processing threads we're done. + # We should lock here... + break if @process_threads.empty? and @waiting_urls.empty? + end + puts 'All processing done' + create_index_page # create the page + puts 'Disconnecting' + @client.disconnect # disconnect + end + + # Mine a page. uri is a Freenet::URI. depth is managed by mine_page to ensure + # that we don't exceed RECURSE_DEPTH + def mine_page(uri, depth=0) + # Filter out pages we don't want (images, binaries) + case uri.path + when /\.html$/ + when /\.htm$/ + when /\/$/ + when '' + when nil + else + puts "Ignoring path '#{uri.path.to_s}'" + return + end + + # Check that we don't duplicate the page request + uri_queued = false + @pages_semaphore.synchronize do + uri_queued = true if @all_uris.include? uri.uri + @waiting_urls << uri.uri unless uri_queued + @all_uris << uri.uri unless uri_queued + end + # If it's already being checked we stop + if uri_queued + return + end + + # Get the page + @client.get(uri.uri, true, "Persistence"=>'connection','PriorityClass'=>3) do |status, message, response| + @mutex.lock # Lock the object + case status + when :finished # If we have the data and it's text/html we process it. + page = response.data + if message.content_type =~ /^text\/html/ + thread = Thread.new do # Do it in a new thread, just because. + begin + process_page(uri, response.data, depth) + rescue Exception => e + puts "#{e.to_s}" + end + end + @process_threads << thread + else + puts "Unknown content type: #{message.content_type} URI:#{uri.uri}" + end + when :failed # If it failed then we ditch the URI + @pages_semaphore.synchronize do + @waiting_urls.delete_if {|u| u == uri.uri} + end + when :redirect # In case of redirect we issue a new request for it. + @pages_semaphore.synchronize do + @waiting_urls.delete_if {|u| u == uri.uri} + end + @mutex.unlock + mine_page(Freenet::URI.new(response.items['RedirectURI']), depth) + @mutex.lock + when :retrying + puts "Got retry notification" + when :pending + end + @mutex.unlock + end + end + + # Pull links out of a page and mine them deeper + def process_page(uri, page, depth) + begin + page = FreenetPage.new(uri.uri, page) + page.links.each do |link| + # We only want to mine freenet pages, not anything that operates directly on FProxy, like + # add bookmark links + begin + case link + when /\/?([KSU]S|CH)K/ + mine_page(Freenet::URI.new(link),depth+1) unless depth == RECURSE_DEPTH + when /^\// + when /^\?/ + else + mine_page(Freenet::URI.new(link),depth+1) unless depth == RECURSE_DEPTH + end + rescue Freenet::URIError => e + puts "Bad URI: #{link}" + end + end + @pages_semaphore.synchronize do + @pages[uri.uri] = page + end + rescue Exception => e # This is normally a bad URI or something that's not HTML + puts "Processing Exception: #{e.to_s}\n#{e.backtrace.join("\n")}" + ensure # Make sure we delete the URI from the waiting list no matter what + @pages_semaphore.synchronize do + @waiting_urls.delete_if {|u| u == uri.uri} + end + end + end + + # Create index page. Sort pages and send to the erb template + def create_index_page + template = nil + File.open('index.rhtml') do |f| + template = ERB.new(f.read, nil, '-') + end + @pages_semaphore.synchronize do + @pages.delete_if {|uri, page| page.nil? } + START_PAGES.each do |uri| + @pages[uri].run_rank(5, @pages) + end + @sorted_pages = @pages.values.sort + File.open('index.html', 'w') do |f| + f.write(template.result(binding)) + end + end + end +end + + +# A page on Freenet, uses beautifulsoup to parse non-XML-compliant HTML files, +class FreenetPage + attr_accessor :url, :title, :meta, :uri, :links, :category + attr_reader :rank + def initialize(url, data) + @uri = Freenet::URI.new(url) + @rank = 0 + @data = data + @links = [] + @meta = {} + @category = :unknown + @page = BeautifulSoup.new(data) + raise FreenetPageError.new if @page.nil? + @page.find_all('a').each do |link| + begin + href = link['href'] or next + @links << uri.merge(href) + rescue Freenet::URIError => e + puts 'Invalid URI' + end + end + + @title = @page.html.head.title.string || "No Title" + + @page.find_all('meta').each do |meta| + if meta['name'] and meta['content'] + @meta[meta['name'].downcase] = meta['content'] + end + end + rescue Exception => e # Raise this if we can't make the page, for whatever reason. + raise FreenetPageError.new + end + + def run_rank(rank, all_pages) + @rank += rank + pass_rank = rank.to_f/@page.find_all('a').size + return if pass_rank < 0.01 + @page.find_all('a').each do |link| + begin + href = link['href'] or next + if uri = @uri.merge(href) and uri != @uri.uri and all_pages[uri] + all_pages[uri].run_rank(pass_rank, all_pages) + end + rescue Freenet::URIError=>e + end + end + end + + # Magic voodoo of half-baked ideas. It's supposed to sort pages in to categories. + def categorize + links = @page.find_all('a') + imgs = @page.find_all('img') + total_count = 0 + tag_count = @page.find_all {|tag| total_count += 1} + if imgs.size/total_count.to_f > 0.3 or (links.size/imgs.size) > 0.8 + :image_gallery + elsif links.size/total_count.to_f > 0.3 + :link_directory + else + if @meta['keywords'] + keywords = @meta['keywords'].split(',') + keywords.collect! {|kw| kw.downcase} + if keywords.include? 'index' + :index_site + else + :unknown + end + else + :unknown + end + end + end + + def <=>(other) + return -1 if other.nil? + if @category == other.category + @title <=> other.title + else + @category.to_s <=> other.category.to_s + end + end +end + +# Generic FreenetPageError +class FreenetPageError < Exception +end + +if $0 == __FILE__ + i = IndexR.new + i.create_index_page +end \ No newline at end of file Added: trunk/apps/rubyFreenet/rsite/README =================================================================== --- trunk/apps/rubyFreenet/rsite/README 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/rsite/README 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,3 @@ +rsite is a Freenet site management utility currently in development. + +More documentation is forthcoming. \ No newline at end of file Added: trunk/apps/rubyFreenet/rsite/rsite.rb =================================================================== --- trunk/apps/rubyFreenet/rsite/rsite.rb 2006-06-08 09:49:16 UTC (rev 9085) +++ trunk/apps/rubyFreenet/rsite/rsite.rb 2006-06-08 10:12:14 UTC (rev 9086) @@ -0,0 +1,64 @@ +require 'freenet_client' + +module Freenet + class Site + attr_reader :keys + attr_accessor :version + def self.load(file) + Marshal.load(IO.read(file)) + end + + def initialize(type, path) + raise SiteError.new('Invalid type') unless ['USK','SSK','CHK','KSK'].include? type + @path, @type = path, type + @version = '' + end + + def connect + @client = Freenet::FCP::Client.new() + end + + def generate_key + @keys = @client.generate_keypair + end + + def insert_site + end + + # Insert a single file. You probably want a CHK for this, use it to insert + # large files that won't change, eg media files. + # + # path must be the full filesystem path to the file. + # + # If the type is CHK then site isn't used as CHKs are generated by the node. You may + # append any text after the / in a CHK URI + # + # If the type is KSK then site is the key + # If the type is SSK or USK then it must be sitename/filename + def insert_file(path, type = nil, site=nil) + uri = '' + type ||= @type + case type + when 'CHK' then uri = 'CHK@' + else + raise SiteError.new('Invalid key') unless site + uri = "#{@type}@#{site}" + end + @client.put(uri, nil, true, 'UploadFrom'=>'disk','Filename'=>path) do |status, message, response| + when :uri_generated + puts "URI created: #{response.items['URI']}" + when :success + puts "File inserted successfully" + when :failed + puts "File insertion failed!" + end + end + + def save(file) + File.open(file, 'w') {|f| f.write(Marshal.dump(self))} + end + end + + class SiteError < StandardError + end +end \ No newline at end of file
