AnyEvent-FCP

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        error will instead result in "$cv->croak ($error)".

        This is also a popular choice.

    An array with two callbacks "[$success, $failure]"
        The $success callback will be invoked with the results, while the
        $failure callback will be invoked on any errors.

        The $failure callback will be invoked with the error object from the
        server.

    "undef"
        This is the same thing as specifying "sub { }" as callback, i.e. on
        success, the results are ignored, while on failure, the "on_failure"
        hook is invoked or the module dies with a backtrace.

        This is good for quick scripts, or when you really aren't interested
        in the results.

    $peers = $fcp->list_peers ([$with_metdata[, $with_volatile]])
    $notes = $fcp->list_peer_notes ($node_identifier)
    $fcp->watch_global ($enabled[, $verbosity_mask])
    $reqs = $fcp->list_persistent_requests
    $sync = $fcp->modify_persistent_request ($global, $identifier[,
    $client_token[, $priority_class]])
        Update either the "client_token" or "priority_class" of a request
        identified by $global and $identifier, depending on which of
        $client_token and $priority_class are not "undef".

    $info = $fcp->get_plugin_info ($name, $detailed)
    $status = $fcp->client_get ($uri, $identifier, %kv)
        %kv can contain (<http://wiki.freenetproject.org/FCP2p0ClientGet>).

        ignore_ds, ds_only, verbosity, max_size, max_temp_size, max_retries,
        priority_class, persistence, client_token, global, return_type,
        binary_blob, allowed_mime_types, filename, temp_filename

    $status = $fcp->remove_request ($identifier[, $global])
        Remove the request with the given isdentifier. Returns true if
        successful, false on error.

    ($can_read, $can_write) = $fcp->test_dda ($local_directory,
    $remote_directory, $want_read, $want_write))
        The DDA test in FCP is probably the single most broken protocol -
        only one directory test can be outstanding at any time, and some
        guessing and heuristics are involved in mangling the paths.

        This function combines "TestDDARequest" and "TestDDAResponse" in one
        request, handling file reading and writing as well, and tries very
        hard to do the right thing.

        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"}":



( run in 1.333 second using v1.01-cache-2.11-cpan-39bf76dae61 )