apt @VERSION@
Public Member Functions | Protected Types | Protected Attributes

pkgAcqIndexDiffs Class Reference

An item that is responsible for fetching all the patches {{{ that need to be applied to a given package index file. More...

#include <acquire-item.h>

Inheritance diagram for pkgAcqIndexDiffs:
pkgAcquire::Item WeakPointable

List of all members.

Public Member Functions

virtual void Failed (string Message, pkgAcquire::MethodConfig *Cnf)
 Called when the patch file failed to be downloaded.
virtual void Done (string Message, unsigned long Size, string Md5Hash, pkgAcquire::MethodConfig *Cnf)
 Invoked by the acquire worker when the object was fetched successfully.
virtual string DescURI ()
 A "descriptive" URI-like string.
 pkgAcqIndexDiffs (pkgAcquire *Owner, string URI, string URIDesc, string ShortDesc, HashString ExpectedHash, string ServerSha1, vector< DiffInfo > diffs=vector< DiffInfo >())
 Create an index diff item.

Protected Types

enum  DiffState { StateFetchUnkown, StateFetchDiff, StateUnzipDiff, StateApplyDiff }

Protected Attributes

bool Debug
 If true, debugging output will be written to std::clog.
pkgAcquire::ItemDesc Desc
 A description of the item that is currently being downloaded.
string RealURI
 The URI of the package index file that is being reconstructed.
HashString ExpectedHash
 The HashSum of the package index file that is being reconstructed.
string Description
vector< DiffInfoavailable_patches
string ServerSha1
enum pkgAcqIndexDiffs::DiffState State

Detailed Description

An item that is responsible for fetching all the patches {{{ that need to be applied to a given package index file.

After downloading and applying a single patch, this item will enqueue a new pkgAcqIndexDiffs to download and apply the remaining patches. If no patch can be found that applies to an intermediate file or if one of the patches cannot be downloaded, falls back to downloading the entire package index file using pkgAcqIndex.

See also:
pkgAcqDiffIndex, pkgAcqIndex

Member Enumeration Documentation

enum DiffState [protected]

The current status of this patch.

Enumerator:
StateFetchUnkown 

The diff is in an unknown state.

StateFetchDiff 

The diff is currently being fetched.

StateUnzipDiff 

The diff is currently being uncompressed.

StateApplyDiff 

The diff is currently being applied.


Constructor & Destructor Documentation

pkgAcqIndexDiffs ( pkgAcquire Owner,
string  URI,
string  URIDesc,
string  ShortDesc,
HashString  ExpectedHash,
string  ServerSha1,
vector< DiffInfo diffs = vector<DiffInfo>() 
)

Create an index diff item.

After filling in its basic fields, this invokes Finish(true) if #diffs is empty, or QueueNextDiff() otherwise.

Parameters:
OwnerThe pkgAcquire object that owns this item.
URIThe URI of the package index file being reconstructed.
URIDescA long description of this item.
ShortDescA brief description of this item.
ExpectedHashThe expected md5sum of the completely reconstructed package index file; the index file will be tested against this value when it is entirely reconstructed.
diffsThe remaining diffs from the index of diffs. They should be ordered so that each diff appears before any diff that depends on it.

References available_patches, Debug, Desc, Description, pkgAcquire::ItemDesc::Owner, pkgAcquire::Item::ShortDesc(), pkgAcquire::ItemDesc::ShortDesc, and StateFetchDiff.


Member Function Documentation

virtual string DescURI ( ) [inline, virtual]

A "descriptive" URI-like string.

Returns:
a URI that should be used to describe what is being fetched.

Implements pkgAcquire::Item.

References RealURI.

virtual void Done ( string  Message,
unsigned long  Size,
string  Hash,
pkgAcquire::MethodConfig Cnf 
) [virtual]

Invoked by the acquire worker when the object was fetched successfully.

Note that the object might not have been written to DestFile; check for the presence of an Alt-Filename entry in Message to find the file to which it was really written.

Done is often used to switch from one stage of the processing to the next (e.g. fetching, unpacking, copying). It is one branch of the continuation of the fetch process.

Parameters:
MessageData from the acquire method. Use LookupTag() to parse it.
SizeThe size of the object that was fetched.
HashThe HashSum of the object that was fetched.
CnfThe method via which the object was fetched.
See also:
pkgAcqMethod

Reimplemented from pkgAcquire::Item.

virtual void Failed ( string  Message,
pkgAcquire::MethodConfig Cnf 
) [virtual]

Called when the patch file failed to be downloaded.

This method will fall back to downloading the whole index file outright; its arguments are ignored.

Reimplemented from pkgAcquire::Item.


Member Data Documentation

vector<DiffInfo> available_patches [protected]

The patches that remain to be downloaded, including the patch being downloaded right now. This list should be ordered so that each diff appears before any diff that depends on it.

Todo:
These are indexed by sha1sum; why not use some sort of dictionary instead of relying on ordering and stripping them off the front?

Referenced by pkgAcqIndexDiffs().

string Description [protected]

A description of the file being downloaded.

Referenced by pkgAcqIndexDiffs().

string ServerSha1 [protected]

Stop applying patches when reaching that sha1


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