jigdo API

FilePart Class Reference

One of the "parts" (=single files) that the image (=big file) consists of. More...

#include <scan.hh>

List of all members.


Public Member Functions

const string & getPath () const
 Sort FileParts by RsyncSum of first bytes.
LocationPathSet::iterator getLocation ()
const string & leafName () const
uint64 size () const
time_t mtime () const
const MD5getSums (JigdoCache *c, size_t blockNr)
 Returns null ptr if error and you don't throw it in your JigdoCache error handler.
const MD5SumgetMD5Sum (JigdoCache *c)
 Returns null ptr if error and you don't throw it.
const RsyncSum64getRsyncSum (JigdoCache *c)
 Returns null ptr if error and you don't throw it.
void markAsDeleted (JigdoCache *c)
 Mark the FilePart as deleted.
bool deleted () const
 True if this file will be ignored (but not destroyed with "delete") by JigdoCache because attempts to open/read it failed, or other reasons.
 ~FilePart ()
 Do not call - this is public only because list<> must be able to delete FileParts.

Friends

class JigdoCache
 Objects are only created by JigdoCache.
struct SerializeCacheEntry

Classes

struct  SerializeCacheEntry
 Opposite of unserializeCacheEntry; create byte stream from object. More...

Detailed Description

One of the "parts" (=single files) that the image (=big file) consists of.

The object is also responsible for scanning the file and creating a) an RsyncSum64 of the first blockLength bytes (as determined by JigdoCache). Caching is done in a "lazy" manner; first, only the file size and name is read, then the MD5 sum of the file's first block as well as the Rsync sum is calculated, and only when the 2nd MD5 sum or the entire file's sum is requested, the file is scanned til EOF.


Constructor & Destructor Documentation

FilePart::~FilePart (  )  [inline]

Do not call - this is public only because list<> must be able to delete FileParts.


Member Function Documentation

const string & FilePart::getPath (  )  const [inline]

Sort FileParts by RsyncSum of first bytes.

References deleted(), and Paranoid.

Referenced by fileToImage().

LocationPathSet::iterator FilePart::getLocation (  )  [inline]

const string & FilePart::leafName (  )  const [inline]

Returns:
The further dir names and the leafname, after what getPath() returns.

References deleted(), and Paranoid.

Referenced by fileToImage(), writeAll(), and writeMerge().

uint64 FilePart::size (  )  const [inline]

References deleted(), and Paranoid.

Referenced by fileToImage(), writeAll(), and writeMerge().

time_t FilePart::mtime (  )  const [inline]

References deleted(), and Paranoid.

const MD5 * FilePart::getSums ( JigdoCache c,
size_t  blockNr 
) [inline]

Returns null ptr if error and you don't throw it in your JigdoCache error handler.

References deleted(), and Paranoid.

const MD5Sum * FilePart::getMD5Sum ( JigdoCache c  )  [inline]

Returns null ptr if error and you don't throw it.

References deleted(), and Paranoid.

Referenced by writeAll(), and writeMerge().

const RsyncSum64 * FilePart::getRsyncSum ( JigdoCache c  )  [inline]

Returns null ptr if error and you don't throw it.

References deleted(), and Paranoid.

void FilePart::markAsDeleted ( JigdoCache c  )  [inline]

Mark the FilePart as deleted.

Unlike the STL containers' erase(), this means that any iterator pointing to the element stays valid, you just cannot access the element. TODO: Check whether this feature is really needed anywhere anymore - I suspect not, maybe we should just delete the element.

References JigdoCache::nrOfFiles.

bool FilePart::deleted (  )  const [inline]

True if this file will be ignored (but not destroyed with "delete") by JigdoCache because attempts to open/read it failed, or other reasons.

Referenced by getMD5Sum(), getPath(), getRsyncSum(), getSums(), leafName(), mtime(), and size().


Friends And Related Function Documentation

friend class JigdoCache [friend]

Objects are only created by JigdoCache.

friend struct SerializeCacheEntry [friend]


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

Generated on Tue Sep 23 14:27:42 2008 for jigdo by  doxygen 1.5.6