libtorrent::piece_manager::impl Class Reference

List of all members.

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< boolm_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


Detailed Description

Definition at line 687 of file storage.cpp.


Member Enumeration Documentation

anonymous enum

Enumerator:
has_no_slot 

Definition at line 786 of file storage.cpp.

anonymous enum

Enumerator:
unallocated 
unassigned 

Definition at line 795 of file storage.cpp.

anonymous enum

Enumerator:
state_none 
state_finished 
state_create_files 
state_full_check 
state_allocating 

Definition at line 815 of file storage.cpp.


Constructor & Destructor Documentation

libtorrent::piece_manager::impl::impl ( torrent_info const &  info,
path const &  path,
file_pool fp 
)

Definition at line 843 of file storage.cpp.

References m_save_path.


Member Function Documentation

bool libtorrent::piece_manager::impl::check_fastresume ( aux::piece_checker_data d,
std::vector< bool > &  pieces,
int &  num_pieces,
bool  compact_mode 
)

std::pair< bool, float > libtorrent::piece_manager::impl::check_files ( std::vector< bool > &  pieces,
int &  num_pieces,
boost::recursive_mutex &  mutex 
)

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  ) 

void libtorrent::piece_manager::impl::mark_failed ( int  index  ) 

unsigned long libtorrent::piece_manager::impl::piece_crc ( int  slot_index,
int  block_size,
const std::bitset< 256 > &  bitmask 
)

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 
)

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 
)

int libtorrent::piece_manager::impl::allocate_slot_for_piece ( int  piece_index  ) 

void libtorrent::piece_manager::impl::check_invariant (  )  const


Friends And Related Function Documentation

friend class invariant_access [friend]

Definition at line 689 of file storage.cpp.


Member Data Documentation

Definition at line 768 of file storage.cpp.

Referenced by check_fastresume(), and check_files().

Definition at line 774 of file storage.cpp.

Referenced by allocate_slots().

Definition at line 777 of file storage.cpp.

Definition at line 782 of file storage.cpp.

Referenced by allocate_slots(), check_fastresume(), check_files(), and check_invariant().

Definition at line 805 of file storage.cpp.

Referenced by check_files(), and impl().

boost::recursive_mutex libtorrent::piece_manager::impl::m_mutex [mutable]

Definition at line 809 of file storage.cpp.

Referenced by allocate_slots().

Definition at line 810 of file storage.cpp.

Referenced by allocate_slots().

Definition at line 811 of file storage.cpp.

Referenced by allocate_slots().

Referenced by check_fastresume(), and check_files().

Definition at line 827 of file storage.cpp.

Referenced by check_files().

Definition at line 829 of file storage.cpp.

Referenced by check_files().

Definition at line 834 of file storage.cpp.

Referenced by check_files().

Definition at line 840 of file storage.cpp.

Referenced by allocate_slots().


The documentation for this class was generated from the following file:

Generated on Sun May 25 00:21:43 2008 by  doxygen 1.5.6