forked from premiere/premiere-libtorrent
updated documentation regarding storage_interface
This commit is contained in:
parent
4585264706
commit
7ac43da2ed
473
docs/manual.html
473
docs/manual.html
|
@ -24,158 +24,173 @@
|
|||
<div class="contents topic" id="table-of-contents">
|
||||
<p class="topic-title first"><a name="table-of-contents">Table of contents</a></p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference" href="#overview" id="id16" name="id16">overview</a></li>
|
||||
<li><a class="reference" href="#primitive-network-types" id="id17" name="id17">primitive network types</a></li>
|
||||
<li><a class="reference" href="#session" id="id18" name="id18">session</a><ul>
|
||||
<li><a class="reference" href="#id1" id="id19" name="id19">session()</a></li>
|
||||
<li><a class="reference" href="#id2" id="id20" name="id20">~session()</a></li>
|
||||
<li><a class="reference" href="#abort" id="id21" name="id21">abort()</a></li>
|
||||
<li><a class="reference" href="#add-torrent" id="id22" name="id22">add_torrent()</a></li>
|
||||
<li><a class="reference" href="#remove-torrent-find-torrent-get-torrents" id="id23" name="id23">remove_torrent() find_torrent() get_torrents()</a></li>
|
||||
<li><a class="reference" href="#set-upload-rate-limit-set-download-rate-limit-upload-rate-limit-download-rate-limit" id="id24" name="id24">set_upload_rate_limit() set_download_rate_limit() upload_rate_limit() download_rate_limit()</a></li>
|
||||
<li><a class="reference" href="#set-max-uploads-set-max-connections" id="id25" name="id25">set_max_uploads() set_max_connections()</a></li>
|
||||
<li><a class="reference" href="#num-uploads-num-connections" id="id26" name="id26">num_uploads() num_connections()</a></li>
|
||||
<li><a class="reference" href="#set-max-half-open-connections-max-half-open-connections" id="id27" name="id27">set_max_half_open_connections() max_half_open_connections()</a></li>
|
||||
<li><a class="reference" href="#set-ip-filter" id="id28" name="id28">set_ip_filter()</a></li>
|
||||
<li><a class="reference" href="#status" id="id29" name="id29">status()</a></li>
|
||||
<li><a class="reference" href="#is-listening-listen-port-listen-on" id="id30" name="id30">is_listening() listen_port() listen_on()</a></li>
|
||||
<li><a class="reference" href="#pop-alert-set-severity-level" id="id31" name="id31">pop_alert() set_severity_level()</a></li>
|
||||
<li><a class="reference" href="#add-extension" id="id32" name="id32">add_extension()</a></li>
|
||||
<li><a class="reference" href="#set-settings-set-pe-settings" id="id33" name="id33">set_settings() set_pe_settings()</a></li>
|
||||
<li><a class="reference" href="#set-peer-proxy-set-web-seed-proxy-set-tracker-proxy-set-dht-proxy" id="id34" name="id34">set_peer_proxy() set_web_seed_proxy() set_tracker_proxy() set_dht_proxy()</a></li>
|
||||
<li><a class="reference" href="#peer-proxy-web-seed-proxy-tracker-proxy-dht-proxy" id="id35" name="id35">peer_proxy() web_seed_proxy() tracker_proxy() dht_proxy()</a></li>
|
||||
<li><a class="reference" href="#start-dht-stop-dht-set-dht-settings-dht-state" id="id36" name="id36">start_dht() stop_dht() set_dht_settings() dht_state()</a></li>
|
||||
<li><a class="reference" href="#add-dht-node-add-dht-router" id="id37" name="id37">add_dht_node() add_dht_router()</a></li>
|
||||
<li><a class="reference" href="#overview" id="id18" name="id18">overview</a></li>
|
||||
<li><a class="reference" href="#primitive-network-types" id="id19" name="id19">primitive network types</a></li>
|
||||
<li><a class="reference" href="#session" id="id20" name="id20">session</a><ul>
|
||||
<li><a class="reference" href="#id1" id="id21" name="id21">session()</a></li>
|
||||
<li><a class="reference" href="#id2" id="id22" name="id22">~session()</a></li>
|
||||
<li><a class="reference" href="#abort" id="id23" name="id23">abort()</a></li>
|
||||
<li><a class="reference" href="#add-torrent" id="id24" name="id24">add_torrent()</a></li>
|
||||
<li><a class="reference" href="#remove-torrent-find-torrent-get-torrents" id="id25" name="id25">remove_torrent() find_torrent() get_torrents()</a></li>
|
||||
<li><a class="reference" href="#set-upload-rate-limit-set-download-rate-limit-upload-rate-limit-download-rate-limit" id="id26" name="id26">set_upload_rate_limit() set_download_rate_limit() upload_rate_limit() download_rate_limit()</a></li>
|
||||
<li><a class="reference" href="#set-max-uploads-set-max-connections" id="id27" name="id27">set_max_uploads() set_max_connections()</a></li>
|
||||
<li><a class="reference" href="#num-uploads-num-connections" id="id28" name="id28">num_uploads() num_connections()</a></li>
|
||||
<li><a class="reference" href="#set-max-half-open-connections-max-half-open-connections" id="id29" name="id29">set_max_half_open_connections() max_half_open_connections()</a></li>
|
||||
<li><a class="reference" href="#set-ip-filter" id="id30" name="id30">set_ip_filter()</a></li>
|
||||
<li><a class="reference" href="#status" id="id31" name="id31">status()</a></li>
|
||||
<li><a class="reference" href="#is-listening-listen-port-listen-on" id="id32" name="id32">is_listening() listen_port() listen_on()</a></li>
|
||||
<li><a class="reference" href="#pop-alert-set-severity-level" id="id33" name="id33">pop_alert() set_severity_level()</a></li>
|
||||
<li><a class="reference" href="#add-extension" id="id34" name="id34">add_extension()</a></li>
|
||||
<li><a class="reference" href="#set-settings-set-pe-settings" id="id35" name="id35">set_settings() set_pe_settings()</a></li>
|
||||
<li><a class="reference" href="#set-peer-proxy-set-web-seed-proxy-set-tracker-proxy-set-dht-proxy" id="id36" name="id36">set_peer_proxy() set_web_seed_proxy() set_tracker_proxy() set_dht_proxy()</a></li>
|
||||
<li><a class="reference" href="#peer-proxy-web-seed-proxy-tracker-proxy-dht-proxy" id="id37" name="id37">peer_proxy() web_seed_proxy() tracker_proxy() dht_proxy()</a></li>
|
||||
<li><a class="reference" href="#start-dht-stop-dht-set-dht-settings-dht-state" id="id38" name="id38">start_dht() stop_dht() set_dht_settings() dht_state()</a></li>
|
||||
<li><a class="reference" href="#add-dht-node-add-dht-router" id="id39" name="id39">add_dht_node() add_dht_router()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#entry" id="id38" name="id38">entry</a><ul>
|
||||
<li><a class="reference" href="#integer-string-list-dict-type" id="id39" name="id39">integer() string() list() dict() type()</a></li>
|
||||
<li><a class="reference" href="#operator" id="id40" name="id40">operator[]</a></li>
|
||||
<li><a class="reference" href="#find-key" id="id41" name="id41">find_key()</a></li>
|
||||
<li><a class="reference" href="#entry" id="id40" name="id40">entry</a><ul>
|
||||
<li><a class="reference" href="#integer-string-list-dict-type" id="id41" name="id41">integer() string() list() dict() type()</a></li>
|
||||
<li><a class="reference" href="#operator" id="id42" name="id42">operator[]</a></li>
|
||||
<li><a class="reference" href="#find-key" id="id43" name="id43">find_key()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#torrent-info" id="id42" name="id42">torrent_info</a><ul>
|
||||
<li><a class="reference" href="#id3" id="id43" name="id43">torrent_info()</a></li>
|
||||
<li><a class="reference" href="#set-comment-set-piece-size-set-creator-set-hash-add-tracker-add-file" id="id44" name="id44">set_comment() set_piece_size() set_creator() set_hash() add_tracker() add_file()</a></li>
|
||||
<li><a class="reference" href="#create-torrent" id="id45" name="id45">create_torrent()</a></li>
|
||||
<li><a class="reference" href="#remap-files" id="id46" name="id46">remap_files()</a></li>
|
||||
<li><a class="reference" href="#begin-files-end-files-rbegin-files-rend-files" id="id47" name="id47">begin_files() end_files() rbegin_files() rend_files()</a></li>
|
||||
<li><a class="reference" href="#num-files-file-at" id="id48" name="id48">num_files() file_at()</a></li>
|
||||
<li><a class="reference" href="#map-block" id="id49" name="id49">map_block()</a></li>
|
||||
<li><a class="reference" href="#map-file" id="id50" name="id50">map_file()</a></li>
|
||||
<li><a class="reference" href="#url-seeds-add-url-seed" id="id51" name="id51">url_seeds() add_url_seed()</a></li>
|
||||
<li><a class="reference" href="#print" id="id52" name="id52">print()</a></li>
|
||||
<li><a class="reference" href="#trackers" id="id53" name="id53">trackers()</a></li>
|
||||
<li><a class="reference" href="#total-size-piece-length-piece-size-num-pieces" id="id54" name="id54">total_size() piece_length() piece_size() num_pieces()</a></li>
|
||||
<li><a class="reference" href="#hash-for-piece-info-hash" id="id55" name="id55">hash_for_piece() info_hash()</a></li>
|
||||
<li><a class="reference" href="#name-comment-creation-date-creator" id="id56" name="id56">name() comment() creation_date() creator()</a></li>
|
||||
<li><a class="reference" href="#priv-set-priv" id="id57" name="id57">priv() set_priv()</a></li>
|
||||
<li><a class="reference" href="#nodes" id="id58" name="id58">nodes()</a></li>
|
||||
<li><a class="reference" href="#add-node" id="id59" name="id59">add_node()</a></li>
|
||||
<li><a class="reference" href="#torrent-info" id="id44" name="id44">torrent_info</a><ul>
|
||||
<li><a class="reference" href="#id3" id="id45" name="id45">torrent_info()</a></li>
|
||||
<li><a class="reference" href="#set-comment-set-piece-size-set-creator-set-hash-add-tracker-add-file" id="id46" name="id46">set_comment() set_piece_size() set_creator() set_hash() add_tracker() add_file()</a></li>
|
||||
<li><a class="reference" href="#create-torrent" id="id47" name="id47">create_torrent()</a></li>
|
||||
<li><a class="reference" href="#remap-files" id="id48" name="id48">remap_files()</a></li>
|
||||
<li><a class="reference" href="#begin-files-end-files-rbegin-files-rend-files" id="id49" name="id49">begin_files() end_files() rbegin_files() rend_files()</a></li>
|
||||
<li><a class="reference" href="#num-files-file-at" id="id50" name="id50">num_files() file_at()</a></li>
|
||||
<li><a class="reference" href="#map-block" id="id51" name="id51">map_block()</a></li>
|
||||
<li><a class="reference" href="#map-file" id="id52" name="id52">map_file()</a></li>
|
||||
<li><a class="reference" href="#url-seeds-add-url-seed" id="id53" name="id53">url_seeds() add_url_seed()</a></li>
|
||||
<li><a class="reference" href="#print" id="id54" name="id54">print()</a></li>
|
||||
<li><a class="reference" href="#trackers" id="id55" name="id55">trackers()</a></li>
|
||||
<li><a class="reference" href="#total-size-piece-length-piece-size-num-pieces" id="id56" name="id56">total_size() piece_length() piece_size() num_pieces()</a></li>
|
||||
<li><a class="reference" href="#hash-for-piece-info-hash" id="id57" name="id57">hash_for_piece() info_hash()</a></li>
|
||||
<li><a class="reference" href="#name-comment-creation-date-creator" id="id58" name="id58">name() comment() creation_date() creator()</a></li>
|
||||
<li><a class="reference" href="#priv-set-priv" id="id59" name="id59">priv() set_priv()</a></li>
|
||||
<li><a class="reference" href="#nodes" id="id60" name="id60">nodes()</a></li>
|
||||
<li><a class="reference" href="#add-node" id="id61" name="id61">add_node()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#torrent-handle" id="id60" name="id60">torrent_handle</a><ul>
|
||||
<li><a class="reference" href="#piece-priority-prioritize-pieces-piece-priorities-prioritize-files" id="id61" name="id61">piece_priority() prioritize_pieces() piece_priorities() prioritize_files()</a></li>
|
||||
<li><a class="reference" href="#file-progress" id="id62" name="id62">file_progress()</a></li>
|
||||
<li><a class="reference" href="#save-path" id="id63" name="id63">save_path()</a></li>
|
||||
<li><a class="reference" href="#move-storage" id="id64" name="id64">move_storage()</a></li>
|
||||
<li><a class="reference" href="#force-reannounce" id="id65" name="id65">force_reannounce()</a></li>
|
||||
<li><a class="reference" href="#connect-peer" id="id66" name="id66">connect_peer()</a></li>
|
||||
<li><a class="reference" href="#name" id="id67" name="id67">name()</a></li>
|
||||
<li><a class="reference" href="#set-ratio" id="id68" name="id68">set_ratio()</a></li>
|
||||
<li><a class="reference" href="#set-upload-limit-set-download-limit-upload-limit-download-limit" id="id69" name="id69">set_upload_limit() set_download_limit() upload_limit() download_limit()</a></li>
|
||||
<li><a class="reference" href="#set-sequenced-download-threshold" id="id70" name="id70">set_sequenced_download_threshold()</a></li>
|
||||
<li><a class="reference" href="#set-peer-upload-limit-set-peer-download-limit" id="id71" name="id71">set_peer_upload_limit() set_peer_download_limit()</a></li>
|
||||
<li><a class="reference" href="#pause-resume-is-paused" id="id72" name="id72">pause() resume() is_paused()</a></li>
|
||||
<li><a class="reference" href="#resolve-countries" id="id73" name="id73">resolve_countries()</a></li>
|
||||
<li><a class="reference" href="#is-seed" id="id74" name="id74">is_seed()</a></li>
|
||||
<li><a class="reference" href="#has-metadata" id="id75" name="id75">has_metadata()</a></li>
|
||||
<li><a class="reference" href="#set-tracker-login" id="id76" name="id76">set_tracker_login()</a></li>
|
||||
<li><a class="reference" href="#trackers-replace-trackers" id="id77" name="id77">trackers() replace_trackers()</a></li>
|
||||
<li><a class="reference" href="#add-url-seed-remove-url-seed-url-seeds" id="id78" name="id78">add_url_seed() remove_url_seed() url_seeds()</a></li>
|
||||
<li><a class="reference" href="#use-interface" id="id79" name="id79">use_interface()</a></li>
|
||||
<li><a class="reference" href="#info-hash" id="id80" name="id80">info_hash()</a></li>
|
||||
<li><a class="reference" href="#id5" id="id81" name="id81">set_max_uploads() set_max_connections()</a></li>
|
||||
<li><a class="reference" href="#write-resume-data" id="id82" name="id82">write_resume_data()</a></li>
|
||||
<li><a class="reference" href="#id6" id="id83" name="id83">status()</a></li>
|
||||
<li><a class="reference" href="#get-download-queue" id="id84" name="id84">get_download_queue()</a></li>
|
||||
<li><a class="reference" href="#get-peer-info" id="id85" name="id85">get_peer_info()</a></li>
|
||||
<li><a class="reference" href="#get-torrent-info" id="id86" name="id86">get_torrent_info()</a></li>
|
||||
<li><a class="reference" href="#is-valid" id="id87" name="id87">is_valid()</a></li>
|
||||
<li><a class="reference" href="#torrent-handle" id="id62" name="id62">torrent_handle</a><ul>
|
||||
<li><a class="reference" href="#piece-priority-prioritize-pieces-piece-priorities-prioritize-files" id="id63" name="id63">piece_priority() prioritize_pieces() piece_priorities() prioritize_files()</a></li>
|
||||
<li><a class="reference" href="#file-progress" id="id64" name="id64">file_progress()</a></li>
|
||||
<li><a class="reference" href="#save-path" id="id65" name="id65">save_path()</a></li>
|
||||
<li><a class="reference" href="#move-storage" id="id66" name="id66">move_storage()</a></li>
|
||||
<li><a class="reference" href="#force-reannounce" id="id67" name="id67">force_reannounce()</a></li>
|
||||
<li><a class="reference" href="#connect-peer" id="id68" name="id68">connect_peer()</a></li>
|
||||
<li><a class="reference" href="#name" id="id69" name="id69">name()</a></li>
|
||||
<li><a class="reference" href="#set-ratio" id="id70" name="id70">set_ratio()</a></li>
|
||||
<li><a class="reference" href="#set-upload-limit-set-download-limit-upload-limit-download-limit" id="id71" name="id71">set_upload_limit() set_download_limit() upload_limit() download_limit()</a></li>
|
||||
<li><a class="reference" href="#set-sequenced-download-threshold" id="id72" name="id72">set_sequenced_download_threshold()</a></li>
|
||||
<li><a class="reference" href="#set-peer-upload-limit-set-peer-download-limit" id="id73" name="id73">set_peer_upload_limit() set_peer_download_limit()</a></li>
|
||||
<li><a class="reference" href="#pause-resume-is-paused" id="id74" name="id74">pause() resume() is_paused()</a></li>
|
||||
<li><a class="reference" href="#resolve-countries" id="id75" name="id75">resolve_countries()</a></li>
|
||||
<li><a class="reference" href="#is-seed" id="id76" name="id76">is_seed()</a></li>
|
||||
<li><a class="reference" href="#has-metadata" id="id77" name="id77">has_metadata()</a></li>
|
||||
<li><a class="reference" href="#set-tracker-login" id="id78" name="id78">set_tracker_login()</a></li>
|
||||
<li><a class="reference" href="#trackers-replace-trackers" id="id79" name="id79">trackers() replace_trackers()</a></li>
|
||||
<li><a class="reference" href="#add-url-seed-remove-url-seed-url-seeds" id="id80" name="id80">add_url_seed() remove_url_seed() url_seeds()</a></li>
|
||||
<li><a class="reference" href="#use-interface" id="id81" name="id81">use_interface()</a></li>
|
||||
<li><a class="reference" href="#info-hash" id="id82" name="id82">info_hash()</a></li>
|
||||
<li><a class="reference" href="#id5" id="id83" name="id83">set_max_uploads() set_max_connections()</a></li>
|
||||
<li><a class="reference" href="#write-resume-data" id="id84" name="id84">write_resume_data()</a></li>
|
||||
<li><a class="reference" href="#id6" id="id85" name="id85">status()</a></li>
|
||||
<li><a class="reference" href="#get-download-queue" id="id86" name="id86">get_download_queue()</a></li>
|
||||
<li><a class="reference" href="#get-peer-info" id="id87" name="id87">get_peer_info()</a></li>
|
||||
<li><a class="reference" href="#get-torrent-info" id="id88" name="id88">get_torrent_info()</a></li>
|
||||
<li><a class="reference" href="#is-valid" id="id89" name="id89">is_valid()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#torrent-status" id="id88" name="id88">torrent_status</a></li>
|
||||
<li><a class="reference" href="#peer-info" id="id89" name="id89">peer_info</a></li>
|
||||
<li><a class="reference" href="#session-settings" id="id90" name="id90">session_settings</a></li>
|
||||
<li><a class="reference" href="#pe-settings" id="id91" name="id91">pe_settings</a></li>
|
||||
<li><a class="reference" href="#proxy-settings" id="id92" name="id92">proxy_settings</a></li>
|
||||
<li><a class="reference" href="#ip-filter" id="id93" name="id93">ip_filter</a><ul>
|
||||
<li><a class="reference" href="#id9" id="id94" name="id94">ip_filter()</a></li>
|
||||
<li><a class="reference" href="#add-rule" id="id95" name="id95">add_rule()</a></li>
|
||||
<li><a class="reference" href="#access" id="id96" name="id96">access()</a></li>
|
||||
<li><a class="reference" href="#export-filter" id="id97" name="id97">export_filter()</a></li>
|
||||
<li><a class="reference" href="#torrent-status" id="id90" name="id90">torrent_status</a></li>
|
||||
<li><a class="reference" href="#peer-info" id="id91" name="id91">peer_info</a></li>
|
||||
<li><a class="reference" href="#session-settings" id="id92" name="id92">session_settings</a></li>
|
||||
<li><a class="reference" href="#pe-settings" id="id93" name="id93">pe_settings</a></li>
|
||||
<li><a class="reference" href="#proxy-settings" id="id94" name="id94">proxy_settings</a></li>
|
||||
<li><a class="reference" href="#ip-filter" id="id95" name="id95">ip_filter</a><ul>
|
||||
<li><a class="reference" href="#id9" id="id96" name="id96">ip_filter()</a></li>
|
||||
<li><a class="reference" href="#add-rule" id="id97" name="id97">add_rule()</a></li>
|
||||
<li><a class="reference" href="#access" id="id98" name="id98">access()</a></li>
|
||||
<li><a class="reference" href="#export-filter" id="id99" name="id99">export_filter()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#big-number" id="id98" name="id98">big_number</a></li>
|
||||
<li><a class="reference" href="#hasher" id="id99" name="id99">hasher</a></li>
|
||||
<li><a class="reference" href="#fingerprint" id="id100" name="id100">fingerprint</a></li>
|
||||
<li><a class="reference" href="#free-functions" id="id101" name="id101">free functions</a><ul>
|
||||
<li><a class="reference" href="#identify-client" id="id102" name="id102">identify_client()</a></li>
|
||||
<li><a class="reference" href="#client-fingerprint" id="id103" name="id103">client_fingerprint()</a></li>
|
||||
<li><a class="reference" href="#bdecode-bencode" id="id104" name="id104">bdecode() bencode()</a></li>
|
||||
<li><a class="reference" href="#supports-sparse-files" id="id105" name="id105">supports_sparse_files()</a></li>
|
||||
<li><a class="reference" href="#big-number" id="id100" name="id100">big_number</a></li>
|
||||
<li><a class="reference" href="#hasher" id="id101" name="id101">hasher</a></li>
|
||||
<li><a class="reference" href="#fingerprint" id="id102" name="id102">fingerprint</a></li>
|
||||
<li><a class="reference" href="#free-functions" id="id103" name="id103">free functions</a><ul>
|
||||
<li><a class="reference" href="#identify-client" id="id104" name="id104">identify_client()</a></li>
|
||||
<li><a class="reference" href="#client-fingerprint" id="id105" name="id105">client_fingerprint()</a></li>
|
||||
<li><a class="reference" href="#bdecode-bencode" id="id106" name="id106">bdecode() bencode()</a></li>
|
||||
<li><a class="reference" href="#supports-sparse-files" id="id107" name="id107">supports_sparse_files()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#alerts" id="id106" name="id106">alerts</a><ul>
|
||||
<li><a class="reference" href="#listen-failed-alert" id="id107" name="id107">listen_failed_alert</a></li>
|
||||
<li><a class="reference" href="#portmap-error-alert" id="id108" name="id108">portmap_error_alert</a></li>
|
||||
<li><a class="reference" href="#portmap-alert" id="id109" name="id109">portmap_alert</a></li>
|
||||
<li><a class="reference" href="#file-error-alert" id="id110" name="id110">file_error_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-announce-alert" id="id111" name="id111">tracker_announce_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-alert" id="id112" name="id112">tracker_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-reply-alert" id="id113" name="id113">tracker_reply_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-warning-alert" id="id114" name="id114">tracker_warning_alert</a></li>
|
||||
<li><a class="reference" href="#url-seed-alert" id="id115" name="id115">url_seed_alert</a></li>
|
||||
<li><a class="reference" href="#hash-failed-alert" id="id116" name="id116">hash_failed_alert</a></li>
|
||||
<li><a class="reference" href="#peer-ban-alert" id="id117" name="id117">peer_ban_alert</a></li>
|
||||
<li><a class="reference" href="#peer-error-alert" id="id118" name="id118">peer_error_alert</a></li>
|
||||
<li><a class="reference" href="#invalid-request-alert" id="id119" name="id119">invalid_request_alert</a></li>
|
||||
<li><a class="reference" href="#torrent-finished-alert" id="id120" name="id120">torrent_finished_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-failed-alert" id="id121" name="id121">metadata_failed_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-received-alert" id="id122" name="id122">metadata_received_alert</a></li>
|
||||
<li><a class="reference" href="#fastresume-rejected-alert" id="id123" name="id123">fastresume_rejected_alert</a></li>
|
||||
<li><a class="reference" href="#peer-blocked-alert" id="id124" name="id124">peer_blocked_alert</a></li>
|
||||
<li><a class="reference" href="#storage-moved-alert" id="id125" name="id125">storage_moved_alert</a></li>
|
||||
<li><a class="reference" href="#torrent-paused-alert" id="id126" name="id126">torrent_paused_alert</a></li>
|
||||
<li><a class="reference" href="#dispatcher" id="id127" name="id127">dispatcher</a></li>
|
||||
<li><a class="reference" href="#alerts" id="id108" name="id108">alerts</a><ul>
|
||||
<li><a class="reference" href="#listen-failed-alert" id="id109" name="id109">listen_failed_alert</a></li>
|
||||
<li><a class="reference" href="#portmap-error-alert" id="id110" name="id110">portmap_error_alert</a></li>
|
||||
<li><a class="reference" href="#portmap-alert" id="id111" name="id111">portmap_alert</a></li>
|
||||
<li><a class="reference" href="#file-error-alert" id="id112" name="id112">file_error_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-announce-alert" id="id113" name="id113">tracker_announce_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-alert" id="id114" name="id114">tracker_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-reply-alert" id="id115" name="id115">tracker_reply_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-warning-alert" id="id116" name="id116">tracker_warning_alert</a></li>
|
||||
<li><a class="reference" href="#url-seed-alert" id="id117" name="id117">url_seed_alert</a></li>
|
||||
<li><a class="reference" href="#hash-failed-alert" id="id118" name="id118">hash_failed_alert</a></li>
|
||||
<li><a class="reference" href="#peer-ban-alert" id="id119" name="id119">peer_ban_alert</a></li>
|
||||
<li><a class="reference" href="#peer-error-alert" id="id120" name="id120">peer_error_alert</a></li>
|
||||
<li><a class="reference" href="#invalid-request-alert" id="id121" name="id121">invalid_request_alert</a></li>
|
||||
<li><a class="reference" href="#torrent-finished-alert" id="id122" name="id122">torrent_finished_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-failed-alert" id="id123" name="id123">metadata_failed_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-received-alert" id="id124" name="id124">metadata_received_alert</a></li>
|
||||
<li><a class="reference" href="#fastresume-rejected-alert" id="id125" name="id125">fastresume_rejected_alert</a></li>
|
||||
<li><a class="reference" href="#peer-blocked-alert" id="id126" name="id126">peer_blocked_alert</a></li>
|
||||
<li><a class="reference" href="#storage-moved-alert" id="id127" name="id127">storage_moved_alert</a></li>
|
||||
<li><a class="reference" href="#torrent-paused-alert" id="id128" name="id128">torrent_paused_alert</a></li>
|
||||
<li><a class="reference" href="#dispatcher" id="id129" name="id129">dispatcher</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#exceptions" id="id128" name="id128">exceptions</a><ul>
|
||||
<li><a class="reference" href="#invalid-handle" id="id129" name="id129">invalid_handle</a></li>
|
||||
<li><a class="reference" href="#duplicate-torrent" id="id130" name="id130">duplicate_torrent</a></li>
|
||||
<li><a class="reference" href="#invalid-encoding" id="id131" name="id131">invalid_encoding</a></li>
|
||||
<li><a class="reference" href="#type-error" id="id132" name="id132">type_error</a></li>
|
||||
<li><a class="reference" href="#invalid-torrent-file" id="id133" name="id133">invalid_torrent_file</a></li>
|
||||
<li><a class="reference" href="#exceptions" id="id130" name="id130">exceptions</a><ul>
|
||||
<li><a class="reference" href="#invalid-handle" id="id131" name="id131">invalid_handle</a></li>
|
||||
<li><a class="reference" href="#duplicate-torrent" id="id132" name="id132">duplicate_torrent</a></li>
|
||||
<li><a class="reference" href="#invalid-encoding" id="id133" name="id133">invalid_encoding</a></li>
|
||||
<li><a class="reference" href="#type-error" id="id134" name="id134">type_error</a></li>
|
||||
<li><a class="reference" href="#invalid-torrent-file" id="id135" name="id135">invalid_torrent_file</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#fast-resume" id="id134" name="id134">fast resume</a><ul>
|
||||
<li><a class="reference" href="#file-format" id="id135" name="id135">file format</a></li>
|
||||
<li><a class="reference" href="#storage-interface" id="id136" name="id136">storage_interface</a><ul>
|
||||
<li><a class="reference" href="#initialize" id="id137" name="id137">initialize()</a></li>
|
||||
<li><a class="reference" href="#read" id="id138" name="id138">read()</a></li>
|
||||
<li><a class="reference" href="#write" id="id139" name="id139">write()</a></li>
|
||||
<li><a class="reference" href="#id11" id="id140" name="id140">move_storage()</a></li>
|
||||
<li><a class="reference" href="#verify-resume-data" id="id141" name="id141">verify_resume_data()</a></li>
|
||||
<li><a class="reference" href="#id12" id="id142" name="id142">write_resume_data()</a></li>
|
||||
<li><a class="reference" href="#move-slot" id="id143" name="id143">move_slot()</a></li>
|
||||
<li><a class="reference" href="#swap-slots" id="id144" name="id144">swap_slots()</a></li>
|
||||
<li><a class="reference" href="#swap-slots3" id="id145" name="id145">swap_slots3()</a></li>
|
||||
<li><a class="reference" href="#hash-for-slot" id="id146" name="id146">hash_for_slot()</a></li>
|
||||
<li><a class="reference" href="#release-files" id="id147" name="id147">release_files()</a></li>
|
||||
<li><a class="reference" href="#delete-files" id="id148" name="id148">delete_files()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#threads" id="id136" name="id136">threads</a></li>
|
||||
<li><a class="reference" href="#storage-allocation" id="id137" name="id137">storage allocation</a><ul>
|
||||
<li><a class="reference" href="#sparse-allocation" id="id138" name="id138">sparse allocation</a></li>
|
||||
<li><a class="reference" href="#full-allocation" id="id139" name="id139">full allocation</a></li>
|
||||
<li><a class="reference" href="#compact-allocation" id="id140" name="id140">compact allocation</a></li>
|
||||
<li><a class="reference" href="#fast-resume" id="id149" name="id149">fast resume</a><ul>
|
||||
<li><a class="reference" href="#file-format" id="id150" name="id150">file format</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#extensions" id="id141" name="id141">extensions</a><ul>
|
||||
<li><a class="reference" href="#metadata-from-peers" id="id142" name="id142">metadata from peers</a></li>
|
||||
<li><a class="reference" href="#http-seeding" id="id143" name="id143">HTTP seeding</a></li>
|
||||
<li><a class="reference" href="#threads" id="id151" name="id151">threads</a></li>
|
||||
<li><a class="reference" href="#storage-allocation" id="id152" name="id152">storage allocation</a><ul>
|
||||
<li><a class="reference" href="#sparse-allocation" id="id153" name="id153">sparse allocation</a></li>
|
||||
<li><a class="reference" href="#full-allocation" id="id154" name="id154">full allocation</a></li>
|
||||
<li><a class="reference" href="#compact-allocation" id="id155" name="id155">compact allocation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#filename-checks" id="id144" name="id144">filename checks</a></li>
|
||||
<li><a class="reference" href="#acknowledgments" id="id145" name="id145">acknowledgments</a></li>
|
||||
<li><a class="reference" href="#extensions" id="id156" name="id156">extensions</a><ul>
|
||||
<li><a class="reference" href="#metadata-from-peers" id="id157" name="id157">metadata from peers</a></li>
|
||||
<li><a class="reference" href="#http-seeding" id="id158" name="id158">HTTP seeding</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#filename-checks" id="id159" name="id159">filename checks</a></li>
|
||||
<li><a class="reference" href="#acknowledgments" id="id160" name="id160">acknowledgments</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section">
|
||||
|
@ -198,7 +213,7 @@ the <tt class="docutils literal"><span class="pre">session</span></tt>, it conta
|
|||
</blockquote>
|
||||
</li>
|
||||
<li><p class="first">save resume data for all torrent_handles (optional, see
|
||||
<a class="reference" href="#write-resume-data">write_resume_data()</a>)</p>
|
||||
<a href="#id161" name="id162"><span class="problematic" id="id162">`write_resume_data()`_</span></a>)</p>
|
||||
</li>
|
||||
<li><p class="first">destruct session object</p>
|
||||
</li>
|
||||
|
@ -242,7 +257,7 @@ class session: public boost::noncopyable
|
|||
, char const* listen_interface = 0);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
torrent_info const& ti
|
||||
boost::intrusive_ptr<torrent_info> const& ti
|
||||
, boost::filesystem::path const& save_path
|
||||
, entry const& resume_data = entry()
|
||||
, bool compact_mode = true
|
||||
|
@ -370,12 +385,17 @@ public:
|
|||
<h2><a id="add-torrent" name="add-torrent">add_torrent()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
typedef storage_interface* (&storage_constructor_type)(
|
||||
boost::intrusive_ptr<torrent_info const>, fs::path const&
|
||||
, file_pool&);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
torrent_info const& ti
|
||||
boost::intrusive_ptr<torrent_info> const& ti
|
||||
, boost::filesystem::path const& save_path
|
||||
, entry const& resume_data = entry()
|
||||
, storage_mode_t storage_mode = storage_mode_sparse
|
||||
, bool paused = false);
|
||||
, bool paused = false
|
||||
, storage_constructor_type sc = default_storage_constructor);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
char const* tracker_url
|
||||
|
@ -384,7 +404,8 @@ torrent_handle add_torrent(
|
|||
, boost::filesystem::path const& save_path
|
||||
, entry const& resume_data = entry()
|
||||
, storage_mode_t storage_mode = storage_mode_sparse
|
||||
, bool paused = false);
|
||||
, bool paused = false
|
||||
, storage_constructor_type sc = default_storage_constructor);
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>You add torrents through the <tt class="docutils literal"><span class="pre">add_torrent()</span></tt> function where you give an
|
||||
|
@ -417,6 +438,11 @@ downloaded.</dd>
|
|||
a paused state. I.e. it won't connect to the tracker or any of the peers until it's
|
||||
resumed. This is typically a good way of avoiding race conditions when setting
|
||||
configuration options on torrents before starting them.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">storage_constructor</span></tt> can be used to customize how the data is stored. The default
|
||||
storage will simply write the data to the files it belongs to, but it could be
|
||||
overridden to save everything to a single file at a specific location or encrypt the
|
||||
content on disk for instance. For more information about the <tt class="docutils literal"><span class="pre">storage_interface</span></tt>
|
||||
that needs to be implemented for a custom storage, see <a class="reference" href="#storage-interface">storage_interface</a>.</p>
|
||||
<p>The <a class="reference" href="#torrent-handle">torrent_handle</a> returned by <tt class="docutils literal"><span class="pre">add_torrent()</span></tt> can be used to retrieve information
|
||||
about the torrent's progress, its peers etc. It is also used to abort a torrent.</p>
|
||||
<p>The second overload that takes a tracker url and an info-hash instead of metadata
|
||||
|
@ -1102,6 +1128,8 @@ what the files on disk are called.</p>
|
|||
<p>The return value indicates if the remap was successful or not. True means success and
|
||||
false means failure. The sum of all the files passed in through <tt class="docutils literal"><span class="pre">map</span></tt> has to be exactly
|
||||
the same as the total_size of the torrent.</p>
|
||||
<p>Changing this mapping for an existing torrent will not move or rename files. If some files
|
||||
should be renamed, this can be done before the torrent is added.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="begin-files-end-files-rbegin-files-rend-files" name="begin-files-end-files-rbegin-files-rend-files">begin_files() end_files() rbegin_files() rend_files()</a></h2>
|
||||
|
@ -3377,6 +3405,175 @@ struct invalid_torrent_file: std::exception
|
|||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h1><a id="storage-interface" name="storage-interface">storage_interface</a></h1>
|
||||
<p>The storage interface is a pure virtual class that can be implemented to
|
||||
change the behavior of the actual file storage. The interface looks like
|
||||
this:</p>
|
||||
<pre class="literal-block">
|
||||
struct storage_interface
|
||||
{
|
||||
virtual void initialize(bool allocate_files) = 0;
|
||||
virtual size_type read(char* buf, int slot, int offset, int size) = 0;
|
||||
virtual void write(const char* buf, int slot, int offset, int size) = 0;
|
||||
virtual bool move_storage(fs::path save_path) = 0;
|
||||
virtual bool verify_resume_data(entry& rd, std::string& error) = 0;
|
||||
virtual void write_resume_data(entry& rd) const = 0;
|
||||
virtual void move_slot(int src_slot, int dst_slot) = 0;
|
||||
virtual void swap_slots(int slot1, int slot2) = 0;
|
||||
virtual void swap_slots3(int slot1, int slot2, int slot3) = 0;
|
||||
virtual sha1_hash hash_for_slot(int slot, partial_hash& h, int piece_size) = 0;
|
||||
virtual void release_files() = 0;
|
||||
virtual void delete_files() = 0;
|
||||
virtual ~storage_interface() {}
|
||||
};
|
||||
</pre>
|
||||
<div class="section">
|
||||
<h2><a id="initialize" name="initialize">initialize()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void initialize(bool allocate_files) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function is called when the storage is to be initialized. The default storage
|
||||
will create directories and empty files at this point. If <tt class="docutils literal"><span class="pre">allocate_files</span></tt> is true,
|
||||
it will also <tt class="docutils literal"><span class="pre">ftruncate</span></tt> all files to their target size.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="read" name="read">read()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
size_type read(char* buf, int slot, int offset, int size) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should read the data in the given slot and at the given offset
|
||||
and <tt class="docutils literal"><span class="pre">size</span></tt> number of bytes. The data is to be copied to <tt class="docutils literal"><span class="pre">buf</span></tt>.</p>
|
||||
<p>The return value is the number of bytes actually read.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="write" name="write">write()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void write(const char* buf, int slot, int offset, int size) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should write the data in <tt class="docutils literal"><span class="pre">buf</span></tt> to the given slot (<tt class="docutils literal"><span class="pre">slot</span></tt>) at offset
|
||||
<tt class="docutils literal"><span class="pre">offset</span></tt> in that slot. The buffer size is <tt class="docutils literal"><span class="pre">size</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="id11" name="id11">move_storage()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
bool move_storage(fs::path save_path) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should move all the files belonging to the storage to the new save_path.
|
||||
The default storage moves the single file or the directory of the torrent.</p>
|
||||
<p>Before moving the files, any open file handles may have to be closed, like
|
||||
<tt class="docutils literal"><span class="pre">release_files()</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="verify-resume-data" name="verify-resume-data">verify_resume_data()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
bool verify_resume_data(entry& rd, std::string& error) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should verify the resume data <tt class="docutils literal"><span class="pre">rd</span></tt> with the files
|
||||
on disk. If the resume data seems to be up-to-date, return true. If
|
||||
not, set <tt class="docutils literal"><span class="pre">error</span></tt> to a description of what mismatched and return false.</p>
|
||||
<p>The default storage may compare file sizes and time stamps of the files.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="id12" name="id12">write_resume_data()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void write_resume_data(entry& rd) const = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should fill in resume data, the current state of the
|
||||
storage, in <tt class="docutils literal"><span class="pre">rd</span></tt>. The default storage adds file timestamps and
|
||||
sizes.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="move-slot" name="move-slot">move_slot()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void move_slot(int src_slot, int dst_slot) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should copy or move the data in slot <tt class="docutils literal"><span class="pre">src_slot</span></tt> to
|
||||
the slot <tt class="docutils literal"><span class="pre">dst_slot</span></tt>. This is only used in compact mode.</p>
|
||||
<p>If the storage caches slots, this could be implemented more
|
||||
efficient than reading and writing the data.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="swap-slots" name="swap-slots">swap_slots()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void swap_slots(int slot1, int slot2) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should swap the data in <tt class="docutils literal"><span class="pre">slot1</span></tt> and <tt class="docutils literal"><span class="pre">slot2</span></tt>. The default
|
||||
storage uses a scratch buffer to read the data into, then moving the other
|
||||
slot and finally writing back the temporary slot's data</p>
|
||||
<p>This is only used in compact mode.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="swap-slots3" name="swap-slots3">swap_slots3()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void swap_slots3(int slot1, int slot2, int slot3) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should do a 3-way swap, or shift of the slots. <tt class="docutils literal"><span class="pre">slot1</span></tt>
|
||||
should move to <tt class="docutils literal"><span class="pre">slot2</span></tt>, which should be moved to <tt class="docutils literal"><span class="pre">slot3</span></tt> which in turn
|
||||
should be moved to <tt class="docutils literal"><span class="pre">slot1</span></tt>.</p>
|
||||
<p>This is only used in compact mode.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="hash-for-slot" name="hash-for-slot">hash_for_slot()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
sha1_hash hash_for_slot(int slot, partial_hash& h, int piece_size) = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>The function should read the remaining bytes of the slot and hash it with the
|
||||
sha-1 state in <tt class="docutils literal"><span class="pre">partion_hash</span></tt>. The <tt class="docutils literal"><span class="pre">partial_hash</span></tt> struct looks like this:</p>
|
||||
<pre class="literal-block">
|
||||
struct partial_hash
|
||||
{
|
||||
partial_hash();
|
||||
int offset;
|
||||
hasher h;
|
||||
};
|
||||
</pre>
|
||||
<p><tt class="docutils literal"><span class="pre">offset</span></tt> is the number of bytes in the slot that has already been hashed, and
|
||||
<tt class="docutils literal"><span class="pre">h</span></tt> is the sha-1 state of that hash. <tt class="docutils literal"><span class="pre">piece_size</span></tt> is the size of the piece
|
||||
that is stored in the given slot.</p>
|
||||
<p>The function should return the hash of the piece stored in the slot.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="release-files" name="release-files">release_files()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void release_files() = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should release all the file handles that it keeps open to files
|
||||
belonging to this storage. The default implementation just calls
|
||||
<tt class="docutils literal"><span class="pre">file_pool::release_files(this)</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h2><a id="delete-files" name="delete-files">delete_files()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void delete_files() = 0;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>This function should delete all files and directories belonging to this storage.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h1><a id="fast-resume" name="fast-resume">fast resume</a></h1>
|
||||
<p>The fast resume mechanism is a way to remember which pieces are downloaded
|
||||
and where they are put between sessions. You can generate fast resume data by
|
||||
|
@ -3789,6 +3986,12 @@ scripts.</p>
|
|||
<p>Project is hosted by sourceforge.</p>
|
||||
<p><a class="reference" href="http://sourceforge.net"><img alt="sf_logo" src="http://sourceforge.net/sflogo.php?group_id=7994" /></a></p>
|
||||
</div>
|
||||
<div class="system-messages section">
|
||||
<h1>Docutils System Messages</h1>
|
||||
<div class="system-message" id="id161">
|
||||
<p class="system-message-title">System Message: <a name="id161">ERROR/3</a> (<tt class="docutils">manual.rst</tt>, line 28); <em><a href="#id162">backlink</a></em></p>
|
||||
Duplicate target name, cannot be used as a unique reference: "write_resume_data()".</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
212
docs/manual.rst
212
docs/manual.rst
|
@ -71,7 +71,7 @@ The ``session`` class has the following synopsis::
|
|||
, char const* listen_interface = 0);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
torrent_info const& ti
|
||||
boost::intrusive_ptr<torrent_info> const& ti
|
||||
, boost::filesystem::path const& save_path
|
||||
, entry const& resume_data = entry()
|
||||
, bool compact_mode = true
|
||||
|
@ -204,12 +204,17 @@ add_torrent()
|
|||
|
||||
::
|
||||
|
||||
typedef storage_interface* (&storage_constructor_type)(
|
||||
boost::intrusive_ptr<torrent_info const>, fs::path const&
|
||||
, file_pool&);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
torrent_info const& ti
|
||||
boost::intrusive_ptr<torrent_info> const& ti
|
||||
, boost::filesystem::path const& save_path
|
||||
, entry const& resume_data = entry()
|
||||
, storage_mode_t storage_mode = storage_mode_sparse
|
||||
, bool paused = false);
|
||||
, bool paused = false
|
||||
, storage_constructor_type sc = default_storage_constructor);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
char const* tracker_url
|
||||
|
@ -218,7 +223,8 @@ add_torrent()
|
|||
, boost::filesystem::path const& save_path
|
||||
, entry const& resume_data = entry()
|
||||
, storage_mode_t storage_mode = storage_mode_sparse
|
||||
, bool paused = false);
|
||||
, bool paused = false
|
||||
, storage_constructor_type sc = default_storage_constructor);
|
||||
|
||||
You add torrents through the ``add_torrent()`` function where you give an
|
||||
object representing the information found in the torrent file and the path where you
|
||||
|
@ -257,6 +263,12 @@ a paused state. I.e. it won't connect to the tracker or any of the peers until i
|
|||
resumed. This is typically a good way of avoiding race conditions when setting
|
||||
configuration options on torrents before starting them.
|
||||
|
||||
``storage_constructor`` can be used to customize how the data is stored. The default
|
||||
storage will simply write the data to the files it belongs to, but it could be
|
||||
overridden to save everything to a single file at a specific location or encrypt the
|
||||
content on disk for instance. For more information about the ``storage_interface``
|
||||
that needs to be implemented for a custom storage, see `storage_interface`_.
|
||||
|
||||
The torrent_handle_ returned by ``add_torrent()`` can be used to retrieve information
|
||||
about the torrent's progress, its peers etc. It is also used to abort a torrent.
|
||||
|
||||
|
@ -1023,6 +1035,9 @@ The return value indicates if the remap was successful or not. True means succes
|
|||
false means failure. The sum of all the files passed in through ``map`` has to be exactly
|
||||
the same as the total_size of the torrent.
|
||||
|
||||
Changing this mapping for an existing torrent will not move or rename files. If some files
|
||||
should be renamed, this can be done before the torrent is added.
|
||||
|
||||
|
||||
begin_files() end_files() rbegin_files() rend_files()
|
||||
-----------------------------------------------------
|
||||
|
@ -3521,6 +3536,195 @@ doesn't meet the requirements on what information has to be present in a torrent
|
|||
};
|
||||
|
||||
|
||||
storage_interface
|
||||
=================
|
||||
|
||||
The storage interface is a pure virtual class that can be implemented to
|
||||
change the behavior of the actual file storage. The interface looks like
|
||||
this::
|
||||
|
||||
struct storage_interface
|
||||
{
|
||||
virtual void initialize(bool allocate_files) = 0;
|
||||
virtual size_type read(char* buf, int slot, int offset, int size) = 0;
|
||||
virtual void write(const char* buf, int slot, int offset, int size) = 0;
|
||||
virtual bool move_storage(fs::path save_path) = 0;
|
||||
virtual bool verify_resume_data(entry& rd, std::string& error) = 0;
|
||||
virtual void write_resume_data(entry& rd) const = 0;
|
||||
virtual void move_slot(int src_slot, int dst_slot) = 0;
|
||||
virtual void swap_slots(int slot1, int slot2) = 0;
|
||||
virtual void swap_slots3(int slot1, int slot2, int slot3) = 0;
|
||||
virtual sha1_hash hash_for_slot(int slot, partial_hash& h, int piece_size) = 0;
|
||||
virtual void release_files() = 0;
|
||||
virtual void delete_files() = 0;
|
||||
virtual ~storage_interface() {}
|
||||
};
|
||||
|
||||
|
||||
initialize()
|
||||
------------
|
||||
|
||||
::
|
||||
|
||||
void initialize(bool allocate_files) = 0;
|
||||
|
||||
This function is called when the storage is to be initialized. The default storage
|
||||
will create directories and empty files at this point. If ``allocate_files`` is true,
|
||||
it will also ``ftruncate`` all files to their target size.
|
||||
|
||||
|
||||
read()
|
||||
------
|
||||
|
||||
::
|
||||
|
||||
size_type read(char* buf, int slot, int offset, int size) = 0;
|
||||
|
||||
This function should read the data in the given slot and at the given offset
|
||||
and ``size`` number of bytes. The data is to be copied to ``buf``.
|
||||
|
||||
The return value is the number of bytes actually read.
|
||||
|
||||
|
||||
write()
|
||||
-------
|
||||
|
||||
::
|
||||
|
||||
void write(const char* buf, int slot, int offset, int size) = 0;
|
||||
|
||||
This function should write the data in ``buf`` to the given slot (``slot``) at offset
|
||||
``offset`` in that slot. The buffer size is ``size``.
|
||||
|
||||
|
||||
move_storage()
|
||||
--------------
|
||||
|
||||
::
|
||||
|
||||
bool move_storage(fs::path save_path) = 0;
|
||||
|
||||
This function should move all the files belonging to the storage to the new save_path.
|
||||
The default storage moves the single file or the directory of the torrent.
|
||||
|
||||
Before moving the files, any open file handles may have to be closed, like
|
||||
``release_files()``.
|
||||
|
||||
|
||||
verify_resume_data()
|
||||
--------------------
|
||||
|
||||
::
|
||||
|
||||
bool verify_resume_data(entry& rd, std::string& error) = 0;
|
||||
|
||||
This function should verify the resume data ``rd`` with the files
|
||||
on disk. If the resume data seems to be up-to-date, return true. If
|
||||
not, set ``error`` to a description of what mismatched and return false.
|
||||
|
||||
The default storage may compare file sizes and time stamps of the files.
|
||||
|
||||
|
||||
write_resume_data()
|
||||
-------------------
|
||||
|
||||
::
|
||||
|
||||
void write_resume_data(entry& rd) const = 0;
|
||||
|
||||
This function should fill in resume data, the current state of the
|
||||
storage, in ``rd``. The default storage adds file timestamps and
|
||||
sizes.
|
||||
|
||||
|
||||
move_slot()
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
void move_slot(int src_slot, int dst_slot) = 0;
|
||||
|
||||
This function should copy or move the data in slot ``src_slot`` to
|
||||
the slot ``dst_slot``. This is only used in compact mode.
|
||||
|
||||
If the storage caches slots, this could be implemented more
|
||||
efficient than reading and writing the data.
|
||||
|
||||
|
||||
swap_slots()
|
||||
------------
|
||||
|
||||
::
|
||||
|
||||
void swap_slots(int slot1, int slot2) = 0;
|
||||
|
||||
This function should swap the data in ``slot1`` and ``slot2``. The default
|
||||
storage uses a scratch buffer to read the data into, then moving the other
|
||||
slot and finally writing back the temporary slot's data
|
||||
|
||||
This is only used in compact mode.
|
||||
|
||||
|
||||
swap_slots3()
|
||||
-------------
|
||||
|
||||
::
|
||||
|
||||
void swap_slots3(int slot1, int slot2, int slot3) = 0;
|
||||
|
||||
This function should do a 3-way swap, or shift of the slots. ``slot1``
|
||||
should move to ``slot2``, which should be moved to ``slot3`` which in turn
|
||||
should be moved to ``slot1``.
|
||||
|
||||
This is only used in compact mode.
|
||||
|
||||
|
||||
hash_for_slot()
|
||||
---------------
|
||||
|
||||
::
|
||||
|
||||
sha1_hash hash_for_slot(int slot, partial_hash& h, int piece_size) = 0;
|
||||
|
||||
The function should read the remaining bytes of the slot and hash it with the
|
||||
sha-1 state in ``partion_hash``. The ``partial_hash`` struct looks like this::
|
||||
|
||||
struct partial_hash
|
||||
{
|
||||
partial_hash();
|
||||
int offset;
|
||||
hasher h;
|
||||
};
|
||||
|
||||
``offset`` is the number of bytes in the slot that has already been hashed, and
|
||||
``h`` is the sha-1 state of that hash. ``piece_size`` is the size of the piece
|
||||
that is stored in the given slot.
|
||||
|
||||
The function should return the hash of the piece stored in the slot.
|
||||
|
||||
|
||||
release_files()
|
||||
---------------
|
||||
|
||||
::
|
||||
|
||||
void release_files() = 0;
|
||||
|
||||
This function should release all the file handles that it keeps open to files
|
||||
belonging to this storage. The default implementation just calls
|
||||
``file_pool::release_files(this)``.
|
||||
|
||||
|
||||
delete_files()
|
||||
--------------
|
||||
|
||||
::
|
||||
|
||||
void delete_files() = 0;
|
||||
|
||||
This function should delete all files and directories belonging to this storage.
|
||||
|
||||
|
||||
fast resume
|
||||
===========
|
||||
|
||||
|
|
Loading…
Reference in New Issue