Public Types | |
| enum | { has_no_slot = -3 } |
| enum | { unallocated = -1, unassigned = -2 } |
| enum | { state_none, state_finished, state_create_files, state_full_check, state_allocating } |
Public Member Functions | |
| impl (torrent_info const &info, path const &path, file_pool &fp) | |
| bool | check_fastresume (aux::piece_checker_data &d, std::vector< bool > &pieces, int &num_pieces, bool compact_mode) |
| std::pair< bool, float > | check_files (std::vector< bool > &pieces, int &num_pieces, boost::recursive_mutex &mutex) |
| void | release_files () |
| void | allocate_slots (int num_slots) |
| void | mark_failed (int index) |
| unsigned long | piece_crc (int slot_index, int block_size, const std::bitset< 256 > &bitmask) |
| int | slot_for_piece (int piece_index) const |
| size_type | read (char *buf, int piece_index, int offset, int size) |
| void | write (const char *buf, int piece_index, int offset, int size) |
| path const & | save_path () const |
| bool | move_storage (path save_path) |
| void | export_piece_map (std::vector< int > &p) const |
| int | identify_data (const std::vector< char > &piece_data, int current_slot, std::vector< bool > &have_pieces, int &num_pieces, const std::multimap< sha1_hash, int > &hash_to_piece, boost::recursive_mutex &mutex) |
| int | allocate_slot_for_piece (int piece_index) |
| void | check_invariant () const |
Public Attributes | |
| storage | m_storage |
| bool | m_compact_mode |
| bool | m_fill_mode |
| std::vector< bool > | m_have_piece |
| torrent_info const & | m_info |
| std::vector< int > | m_unallocated_slots |
| std::vector< int > | m_free_slots |
| std::vector< int > | m_piece_to_slot |
| std::vector< int > | m_slot_to_piece |
| path | m_save_path |
| boost::recursive_mutex | m_mutex |
| bool | m_allocating |
| boost::mutex | m_allocating_monitor |
| boost::condition | m_allocating_condition |
| enum libtorrent::piece_manager::impl:: { ... } | m_state |
| int | m_current_slot |
| std::vector< char > | m_piece_data |
| std::multimap< sha1_hash, int > | m_hash_to_piece |
| std::vector< char > | m_scratch_buffer |
Friends | |
| class | invariant_access |
Definition at line 687 of file storage.cpp.
| anonymous enum |
| anonymous enum |
| anonymous enum |
Definition at line 815 of file storage.cpp.
| libtorrent::piece_manager::impl::impl | ( | torrent_info const & | info, | |
| path const & | path, | |||
| file_pool & | fp | |||
| ) |
| bool libtorrent::piece_manager::impl::check_fastresume | ( | aux::piece_checker_data & | d, | |
| std::vector< bool > & | pieces, | |||
| int & | num_pieces, | |||
| bool | compact_mode | |||
| ) |
Definition at line 1204 of file storage.cpp.
References has_no_slot, INVARIANT_CHECK, m_compact_mode, m_free_slots, m_info, m_mutex, m_piece_to_slot, m_slot_to_piece, m_state, m_unallocated_slots, libtorrent::torrent_info::num_pieces(), libtorrent::torrent_info::piece_length(), libtorrent::aux::piece_checker_data::piece_map, state_allocating, state_create_files, state_finished, unallocated, unassigned, and libtorrent::aux::piece_checker_data::unfinished_pieces.
| std::pair< bool, float > libtorrent::piece_manager::impl::check_files | ( | std::vector< bool > & | pieces, | |
| int & | num_pieces, | |||
| boost::recursive_mutex & | mutex | |||
| ) |
Definition at line 1296 of file storage.cpp.
References allocate_slots(), libtorrent::torrent_info::begin_files(), count, libtorrent::torrent_info::end_files(), has_no_slot, libtorrent::torrent_info::hash_for_piece(), identify_data(), asio::placeholders::iterator, m_compact_mode, m_current_slot, m_free_slots, m_hash_to_piece, m_info, m_piece_data, m_piece_to_slot, m_save_path, m_slot_to_piece, m_state, m_storage, m_unallocated_slots, libtorrent::torrent_info::num_pieces(), libtorrent::file::out, libtorrent::torrent_info::piece_length(), libtorrent::torrent_info::piece_size(), libtorrent::storage::read(), state_allocating, state_create_files, state_finished, state_full_check, unallocated, unassigned, and libtorrent::storage::write().
| void libtorrent::piece_manager::impl::release_files | ( | ) |
Definition at line 874 of file storage.cpp.
References m_storage, and libtorrent::storage::release_files().
| void libtorrent::piece_manager::impl::allocate_slots | ( | int | num_slots | ) |
Definition at line 1812 of file storage.cpp.
References has_no_slot, m_allocating, m_allocating_condition, m_allocating_monitor, m_fill_mode, m_free_slots, m_info, m_mutex, m_piece_to_slot, m_scratch_buffer, m_slot_to_piece, m_storage, m_unallocated_slots, libtorrent::torrent_info::piece_length(), libtorrent::torrent_info::piece_size(), piece_size, pos(), libtorrent::storage::read(), unassigned, and libtorrent::storage::write().
Referenced by allocate_slot_for_piece(), and check_files().
| void libtorrent::piece_manager::impl::mark_failed | ( | int | index | ) |
Definition at line 910 of file storage.cpp.
References has_no_slot, INVARIANT_CHECK, m_free_slots, m_mutex, m_piece_to_slot, m_slot_to_piece, and unassigned.
| unsigned long libtorrent::piece_manager::impl::piece_crc | ( | int | slot_index, | |
| int | block_size, | |||
| const std::bitset< 256 > & | bitmask | |||
| ) |
Definition at line 960 of file storage.cpp.
References libtorrent::adler32_crc::final(), m_info, m_storage, libtorrent::torrent_info::num_pieces(), libtorrent::torrent_info::piece_size(), libtorrent::storage::read(), and libtorrent::adler32_crc::update().
| int libtorrent::piece_manager::impl::slot_for_piece | ( | int | piece_index | ) | const |
Definition at line 946 of file storage.cpp.
References m_info, m_piece_to_slot, and libtorrent::torrent_info::num_pieces().
| size_type libtorrent::piece_manager::impl::read | ( | char * | buf, | |
| int | piece_index, | |||
| int | offset, | |||
| int | size | |||
| ) |
Definition at line 997 of file storage.cpp.
References m_piece_to_slot, m_slot_to_piece, m_storage, and libtorrent::storage::read().
| void libtorrent::piece_manager::impl::write | ( | const char * | buf, | |
| int | piece_index, | |||
| int | offset, | |||
| int | size | |||
| ) |
Definition at line 1022 of file storage.cpp.
References allocate_slot_for_piece(), m_piece_to_slot, m_slot_to_piece, m_storage, and libtorrent::storage::write().
| path const& libtorrent::piece_manager::impl::save_path | ( | ) | const [inline] |
Definition at line 730 of file storage.cpp.
| bool libtorrent::piece_manager::impl::move_storage | ( | path | save_path | ) | [inline] |
Definition at line 733 of file storage.cpp.
| void libtorrent::piece_manager::impl::export_piece_map | ( | std::vector< int > & | p | ) | const |
Definition at line 879 of file storage.cpp.
References INVARIANT_CHECK, m_mutex, m_slot_to_piece, and unallocated.
| int libtorrent::piece_manager::impl::identify_data | ( | const std::vector< char > & | piece_data, | |
| int | current_slot, | |||
| std::vector< bool > & | have_pieces, | |||
| int & | num_pieces, | |||
| const std::multimap< sha1_hash, int > & | hash_to_piece, | |||
| boost::recursive_mutex & | mutex | |||
| ) |
Definition at line 1046 of file storage.cpp.
References libtorrent::hasher::final(), has_no_slot, asio::placeholders::iterator, l, m_free_slots, m_info, m_piece_to_slot, m_slot_to_piece, libtorrent::torrent_info::num_pieces(), libtorrent::torrent_info::piece_length(), libtorrent::torrent_info::piece_size(), piece_size, unassigned, and libtorrent::hasher::update().
Referenced by check_files().
| int libtorrent::piece_manager::impl::allocate_slot_for_piece | ( | int | piece_index | ) |
Definition at line 1664 of file storage.cpp.
References allocate_slots(), has_no_slot, asio::placeholders::iterator, m_free_slots, m_info, m_mutex, m_piece_to_slot, m_slot_to_piece, m_storage, libtorrent::torrent_info::num_pieces(), libtorrent::torrent_info::piece_size(), print_to_log(), libtorrent::storage::read(), unassigned, and libtorrent::storage::write().
Referenced by write().
| void libtorrent::piece_manager::impl::check_invariant | ( | ) | const |
Definition at line 1877 of file storage.cpp.
References has_no_slot, m_free_slots, m_info, m_mutex, m_piece_to_slot, m_slot_to_piece, m_unallocated_slots, libtorrent::torrent_info::num_pieces(), unallocated, and unassigned.
friend class invariant_access [friend] |
Definition at line 689 of file storage.cpp.
Definition at line 763 of file storage.cpp.
Referenced by allocate_slot_for_piece(), allocate_slots(), check_files(), piece_crc(), read(), release_files(), and write().
| std::vector<bool> libtorrent::piece_manager::impl::m_have_piece |
Definition at line 777 of file storage.cpp.
Definition at line 779 of file storage.cpp.
Referenced by allocate_slot_for_piece(), allocate_slots(), check_fastresume(), check_files(), check_invariant(), identify_data(), piece_crc(), and slot_for_piece().
| std::vector<int> libtorrent::piece_manager::impl::m_unallocated_slots |
Definition at line 782 of file storage.cpp.
Referenced by allocate_slots(), check_fastresume(), check_files(), and check_invariant().
| std::vector<int> libtorrent::piece_manager::impl::m_free_slots |
Definition at line 784 of file storage.cpp.
Referenced by allocate_slot_for_piece(), allocate_slots(), check_fastresume(), check_files(), check_invariant(), identify_data(), and mark_failed().
| std::vector<int> libtorrent::piece_manager::impl::m_piece_to_slot |
Definition at line 793 of file storage.cpp.
Referenced by allocate_slot_for_piece(), allocate_slots(), check_fastresume(), check_files(), check_invariant(), identify_data(), mark_failed(), read(), slot_for_piece(), and write().
| std::vector<int> libtorrent::piece_manager::impl::m_slot_to_piece |
Definition at line 803 of file storage.cpp.
Referenced by allocate_slot_for_piece(), allocate_slots(), check_fastresume(), check_files(), check_invariant(), export_piece_map(), identify_data(), mark_failed(), read(), and write().
boost::recursive_mutex libtorrent::piece_manager::impl::m_mutex [mutable] |
Definition at line 807 of file storage.cpp.
Referenced by allocate_slot_for_piece(), allocate_slots(), check_fastresume(), check_invariant(), export_piece_map(), and mark_failed().
| boost::condition libtorrent::piece_manager::impl::m_allocating_condition |
| enum { ... } libtorrent::piece_manager::impl::m_state |
Referenced by check_fastresume(), and check_files().
| std::vector<char> libtorrent::piece_manager::impl::m_piece_data |
| std::multimap<sha1_hash, int> libtorrent::piece_manager::impl::m_hash_to_piece |
| std::vector<char> libtorrent::piece_manager::impl::m_scratch_buffer |
1.5.6