Detail::Chunk Class Reference

Inheritance diagram for Detail::Chunk:

Inheritance graph
[legend]
Collaboration diagram for Detail::Chunk:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Chunk (PartData *parent, uint64_t begin, uint64_t end, uint32_t size, const HashBase *hash=0)
 Construct new chunk.
 Chunk (PartData *parent, Range64 range, uint32_t size, const HashBase *hash=0)
 Construct Chunk from pre-existing Range object.
void verify ()
 Schedules hash job to verify this chunk.
Getters
bool isVerified () const
bool isPartial () const
uint32_t getAvail () const
uint32_t getUseCnt () const
uint32_t getSize () const
bool isComplete () const
Setters
void setVerified (bool v)
void setPartial (bool p)
void setAvail (uint32_t a)
void setUseCnt (uint32_t u)

Public Attributes

PartDatam_parent
 File this chunk belongs to.
const HashBasem_hash
 Optional.
bool m_verified
 If it is verified.
bool m_partial
 If it is partially downloaded.
uint32_t m_avail
 Availability count.
uint32_t m_useCnt
 Use count.
uint32_t m_size
 Ideal size, e.g.

Private Member Functions

 Chunk ()
 Forbidden.
void write (uint64_t begin, const std::string &data)
 Allowed by LockedRange class.
void onHashEvent (HashWorkPtr w, HashEvent evt)

Friends

class Detail::LockedRange

Constructor & Destructor Documentation

Detail::Chunk::Chunk PartData parent,
uint64_t  begin,
uint64_t  end,
uint32_t  size,
const HashBase hash = 0
 

Construct new chunk.

Parameters:
parent Parent object
begin Begin offset (inclusive)
end End offset (inclusive)
size Ideal size for this chunk
hash Optional chunkhash for this data

Definition at line 268 of file partdata.cpp.

References logTrace(), m_partial, and TRACE_PARTDATA.

Here is the call graph for this function:

Detail::Chunk::Chunk PartData parent,
Range64  range,
uint32_t  size,
const HashBase hash = 0
 

Construct Chunk from pre-existing Range object.

Parameters:
parent Parent object
range The range
size Ideal size for this chunk
hash Optional chunkhash for this data

Definition at line 279 of file partdata.cpp.

References Range< uint64_t >::begin(), Range< uint64_t >::end(), logTrace(), m_partial, and TRACE_PARTDATA.

Here is the call graph for this function:

Detail::Chunk::Chunk  )  [private]
 

Forbidden.


Member Function Documentation

uint32_t Detail::Chunk::getAvail  )  const [inline]
 

Definition at line 90 of file partdata.cpp.

References m_avail.

uint32_t Detail::Chunk::getSize  )  const [inline]
 

Definition at line 92 of file partdata.cpp.

References m_size.

uint32_t Detail::Chunk::getUseCnt  )  const [inline]
 

Definition at line 91 of file partdata.cpp.

References m_useCnt.

bool Detail::Chunk::isComplete  )  const
 

Definition at line 357 of file partdata.cpp.

References PartData::isComplete(), and m_parent.

Referenced by write().

Here is the call graph for this function:

bool Detail::Chunk::isPartial  )  const [inline]
 

Definition at line 89 of file partdata.cpp.

References m_partial.

bool Detail::Chunk::isVerified  )  const [inline]
 

Definition at line 88 of file partdata.cpp.

References m_verified.

void Detail::Chunk::onHashEvent HashWorkPtr  w,
HashEvent  evt
[private]
 

Definition at line 329 of file partdata.cpp.

References Range< uint64_t >::begin(), PartData::doComplete(), Range< uint64_t >::end(), RangeList< RangeType >::erase(), HASH_FAILED, HASH_FATAL_ERROR, HASH_VERIFIED, PartData::isComplete(), logError(), logTrace(), logWarning(), PartData::m_complete, PartData::m_dest, PartData::m_fullJob, m_parent, m_partial, PartData::m_partStatus, PartData::m_pendingHashes, m_size, m_verified, and TRACE_PARTDATA.

Here is the call graph for this function:

void Detail::Chunk::setAvail uint32_t  a  )  [inline]
 

Definition at line 100 of file partdata.cpp.

References m_avail.

void Detail::Chunk::setPartial bool  p  )  [inline]
 

Definition at line 99 of file partdata.cpp.

References m_partial.

void Detail::Chunk::setUseCnt uint32_t  u  )  [inline]
 

Definition at line 101 of file partdata.cpp.

References m_useCnt.

void Detail::Chunk::setVerified bool  v  )  [inline]
 

Definition at line 98 of file partdata.cpp.

References m_verified.

void Detail::Chunk::verify  ) 
 

Schedules hash job to verify this chunk.

Definition at line 295 of file partdata.cpp.

References Range< uint64_t >::begin(), PartData::doComplete(), Range< uint64_t >::end(), WorkThread::instance(), PartData::isComplete(), logTrace(), logWarning(), PartData::m_dest, m_hash, PartData::m_loc, m_parent, m_partial, PartData::m_pendingHashes, m_verified, WorkThread::postWork(), PartData::save(), and TRACE_PARTDATA.

Referenced by write().

Here is the call graph for this function:

void Detail::Chunk::write uint64_t  begin,
const std::string &  data
[private]
 

Allowed by LockedRange class.

Definition at line 289 of file partdata.cpp.

References PartData::doWrite(), isComplete(), m_parent, and verify().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class Detail::LockedRange [friend]
 

Definition at line 119 of file partdata.cpp.


Member Data Documentation

uint32_t Detail::Chunk::m_avail
 

Availability count.

Definition at line 112 of file partdata.cpp.

Referenced by getAvail(), and setAvail().

const HashBase* Detail::Chunk::m_hash
 

Optional.

Definition at line 109 of file partdata.cpp.

Referenced by verify().

PartData* Detail::Chunk::m_parent
 

File this chunk belongs to.

Definition at line 108 of file partdata.cpp.

Referenced by isComplete(), onHashEvent(), verify(), and write().

bool Detail::Chunk::m_partial
 

If it is partially downloaded.

Definition at line 111 of file partdata.cpp.

Referenced by Chunk(), isPartial(), onHashEvent(), setPartial(), and verify().

uint32_t Detail::Chunk::m_size
 

Ideal size, e.g.

9500kb for ed2k-chunk etc. Note that the real size of the chunk may be lower (in case of last chunk)

Definition at line 116 of file partdata.cpp.

Referenced by getSize(), and onHashEvent().

uint32_t Detail::Chunk::m_useCnt
 

Use count.

Definition at line 113 of file partdata.cpp.

Referenced by getUseCnt(), and setUseCnt().

bool Detail::Chunk::m_verified
 

If it is verified.

Definition at line 110 of file partdata.cpp.

Referenced by isVerified(), onHashEvent(), setVerified(), and verify().


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