AnyEvent-FCP
view release on metacpan or search on metacpan
Both $local_directory and $remote_directory must specify the same
directory - $local_directory is the directory path on the client
(where AnyEvent::FCP runs) and $remote_directory is the directory
path on the server (where the freenet node runs). When both are
running on the same node, the paths are generally identical.
$want_read and $want_write should be set to a true value when you
want to read (get) files or write (put) files, respectively.
On error, an exception is thrown. Otherwise, $can_read and
$can_write indicate whether you can reaqd or write to freenet via
the directory.
REQUEST CACHE
The "AnyEvent::FCP" class keeps a request cache, where it caches all
information from requests.
For these messages, it will store a copy of the key-value pairs,
together with a "type" slot, in "$fcp->{req}{$identifier}":
persistent_get
persistent_put
persistent_put_dir
This message updates the stored data:
persistent_request_modified
This message will remove this entry:
persistent_request_removed
These messages get merged into the cache entry, under their type, i.e. a
"simple_progress" message will be stored in
"$fcp->{req}{$identifier}{simple_progress}":
simple_progress # get/put
uri_generated # put
generated_metadata # put
started_compression # put
finished_compression # put
put_failed # put
put_fetchable # put
put_successful # put
sending_to_network # get
compatibility_mode # get
expected_hashes # get
expected_mime # get
expected_data_length # get
get_failed # get
data_found # get
enter_finite_cooldown # get
In addition, an event (basically a fake message) of type
"request_changed" is generated on every change, which will be called as
"$cb->($fcp, $kv, $type)", where $type is the type of the original
message triggering the change,
To fill this cache with the global queue and keep it updated, call
"watch_global" to subscribe to updates, followed by
"list_persistent_requests_sync".
$fcp->watch_global_sync_; # do not wait
$fcp->list_persistent_requests; # wait
To get a better idea of what is stored in the cache, here is an example
of what might be stored in "$fcp->{req}{"Frost-gpl.txt"}":
{
identifier => "Frost-gpl.txt",
uri => 'CHK@Fnx5kzdrfE,EImdzaVyEWl,AAIC--8/gpl.txt',
binary_blob => "false",
global => "true",
max_retries => -1,
max_size => 9223372036854775807,
persistence => "forever",
priority_class => 3,
real_time => "false",
return_type => "direct",
started => "true",
type => "persistent_get",
verbosity => 2147483647,
sending_to_network => {
identifier => "Frost-gpl.txt",
global => "true",
},
compatibility_mode => {
identifier => "Frost-gpl.txt",
definitive => "true",
dont_compress => "false",
global => "true",
max => "COMPAT_1255",
min => "COMPAT_1255",
},
expected_hashes => {
identifier => "Frost-gpl.txt",
global => "true",
hashes => {
ed2k => "d83596f5ee3b7...",
md5 => "e0894e4a2a6...",
sha1 => "...",
sha256 => "...",
sha512 => "...",
tth => "...",
},
},
expected_mime => {
identifier => "Frost-gpl.txt",
global => "true",
metadata => { content_type => "application/rar" },
},
expected_data_length => {
identifier => "Frost-gpl.txt",
data_length => 37576,
global => "true",
},
simple_progress => {
identifier => "Frost-gpl.txt",
failed => 0,
( run in 1.308 second using v1.01-cache-2.11-cpan-5837b0d9d2c )