jigdo API
MkTemplate Class Reference
Create location list (jigdo) and image template (template) from one big file and a list of files. More...
#include <mktemplate.hh>
Public Member Functions | |
MkTemplate (JigdoCache *jcache, bistream *imageStream, JigdoConfig *jigdoInfo, bostream *templateStream, ProgressReporter &pr=noReport, int zipQuality=9, size_t readAmnt=128U *1024, bool addImage=true, bool addServers=true, bool useBzip2=false) | |
A create operation with no files known to it yet. | |
~MkTemplate () | |
void | setMatchExec (const string &me) |
Set command(s) to be executed when a file matches. | |
void | setGreedyMatching (bool x) |
Set and get whether to skip smaller matches if a larger match could be possible (with the risk to skip both). | |
bool | getGreedyMatching () const |
bool | run (const string &imageLeafName="image", const string &templLeafName="template") |
First scan through all the individual files, creating checksums, then read image file and find matches. | |
Static Public Attributes | |
static ProgressReporter | noReport |
Default reporter: Only prints error messages to stderr. | |
Friends | |
class | PartialMatchQueue |
Classes | |
class | Desc |
Build up a template DESC section by appending items to a JigdoDescVec. More... | |
class | PartialMatch |
One object for each offset in image where any file /might/ match. More... | |
class | PartialMatchQueue |
Queue of PartialMatch objects, always kept sorted by ascending nextEvent. More... | |
struct | PartIndex |
Index over JigdoParts by md5sum string. More... | |
struct | PartLine |
Line content with whitespace and '=' removed and left/right side swapped, i.e. More... | |
class | ProgressReporter |
Class allowing MkTemplate to convey information back to the creator of a MkTemplate object. More... |
Detailed Description
Create location list (jigdo) and image template (template) from one big file and a list of files.The template file contains a compressed version of the big file, excluding the data of any of the other files that are contained somewhere in the big file. Instead of their data, the image template file just lists their checksums.
Constructor & Destructor Documentation
MkTemplate::MkTemplate | ( | JigdoCache * | jcache, | |
bistream * | imageStream, | |||
JigdoConfig * | jigdoInfo, | |||
bostream * | templateStream, | |||
ProgressReporter & | pr = noReport , |
|||
int | zipQuality = 9 , |
|||
size_t | readAmnt = 128U*1024 , |
|||
bool | addImage = true , |
|||
bool | addServers = true , |
|||
bool | useBzip2 = false | |||
) |
A create operation with no files known to it yet.
- Parameters:
-
jcache Cache for the files (will not be deleted in dtor) imageStream The large image file jigdoInfo Where to output .jigdo data to templateStream Stream for outputting binary image template pr Function object which is called at regular intervals during run() to inform about files scanned, nr of bytes scanned, matches found etc. zipQuality 0 (fast) to 9 (smallest output) readAmnt Number of bytes that are read at a time with one read() call by the operation before the data is processed. Should not be too large because the OS copes best when small bits of I/O are interleaved with small bits of CPU work. In practice, the default seems to work well. addImage Add a [Image] section to the output .jigdo. addServers Add a [Servers] section to the output .jigdo. useBzip2 false=>gzip, true=>bzip2
MkTemplate::~MkTemplate | ( | ) | [inline] |
Member Function Documentation
void MkTemplate::setMatchExec | ( | const string & | me | ) | [inline] |
Set command(s) to be executed when a file matches.
void MkTemplate::setGreedyMatching | ( | bool | x | ) | [inline] |
Set and get whether to skip smaller matches if a larger match could be possible (with the risk to skip both).
True <=> prefer small matches; false <=> skip small, prefer large
bool MkTemplate::getGreedyMatching | ( | ) | const [inline] |
bool MkTemplate::run | ( | const string & | imageLeafName = "image" , |
|
const string & | templLeafName = "template" | |||
) |
First scan through all the individual files, creating checksums, then read image file and find matches.
Write .template and .jigdo files.
- Parameters:
-
imageLeafName Name for the image, which should be a relative path name. This does not need to be similar to the filename that the image has now - it is *only* used when creating the .jigdo file, nowhere else. It is the name that will be used when someone reassembles the image. templLeafName Name to write to jigdo file as template URL. Can be a full http/ftp URL, or a relative URL.
- Returns:
- returns FAILURE if any open/read/write/close failed, unless it was that of a file with reportErrors==false.
References append(), Assert, JigdoCache::begin(), bitWidth(), JigdoCache::deallocBuffer(), JigdoCache::end(), MD5Sum::finish(), ArrayAutoPtr< X >::get(), JigdoCache::getBlockLen(), JigdoCache::getMD5BlockLen(), JIGDO_VERSION, Paranoid, MD5Sum::update(), and writeBytes().
Referenced by main().
Friends And Related Function Documentation
friend class PartialMatchQueue [friend] |
Member Data Documentation
Default reporter: Only prints error messages to stderr.
The documentation for this class was generated from the following files:
Generated on Tue Sep 23 14:27:43 2008 for jigdo by
