libzypp 17.31.23
|
This class allows to retrieve a group of files in a confortable way, providing some smartness that does not belong to the media layer like: More...
#include <Fetcher.h>
Classes | |
class | Impl |
Fetcher implementation. More... | |
Public Types | |
enum | Option { AutoAddContentFileIndexes = 0x0001 , AutoAddChecksumsIndexes = 0x0002 , AutoAddIndexes = AutoAddContentFileIndexes | AutoAddChecksumsIndexes } |
Various option flags to change behavior. More... | |
Public Member Functions | |
ZYPP_DECLARE_FLAGS (Options, Option) | |
Fetcher () | |
Default ctor. | |
virtual | ~Fetcher () |
Dtor. | |
void | setOptions (Options options) |
Set the Fetcher options. | |
Options | options () const |
Get current options. | |
void | addIndex (const OnMediaLocation &resource) |
Adds an index containing metadata (for example checksums ) that will be retrieved and read before the job processing starts. | |
void | enqueue (const OnMediaLocation &resource, const FileChecker &checker=FileChecker()) |
Enqueue a object for transferal, they will not be transferred until start() is called. | |
void | enqueueDigested (const OnMediaLocation &resource, const FileChecker &checker=FileChecker()) |
Enqueue a object for transferal, they will not be transferred until start() is called. | |
ZYPP_DEPRECATED void | enqueueDigested (const OnMediaLocation &resource, const FileChecker &checker, const Pathname &deltafile) |
void | enqueueDir (const OnMediaLocation &resource, bool recursive=false, const FileChecker &checker=FileChecker()) |
Enqueue a directory. | |
void | enqueueDigestedDir (const OnMediaLocation &resource, bool recursive=false, const FileChecker &checker=FileChecker()) |
Enqueue a directory and always check for checksums. | |
void | addCachePath (const Pathname &cache_dir) |
adds a directory to the list of directories where to look for cached files | |
void | reset () |
Reset the transfer (jobs) list. | |
void | setMediaSetAccess (MediaSetAccess &media) |
Sets the media set access that will be used to precache and to download the files when start is called. | |
void | start (const Pathname &dest_dir, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc()) |
start the transfer to a destination directory dest_dir The media has to be provides with setMediaSetAccess before calling this version of start. | |
void | start (const Pathname &dest_dir, MediaSetAccess &media, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc()) |
start the transfer to a destination directory dest_dir You have to provde a media set access media to get the files from The file tree will be replicated inside this directory | |
Private Attributes | |
RWCOW_pointer< Impl > | _pimpl |
Pointer to implementation. | |
Friends | |
std::ostream & | operator<< (std::ostream &str, const Fetcher &obj) |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &str, const Fetcher &obj) |
Stream output. | |
This class allows to retrieve a group of files in a confortable way, providing some smartness that does not belong to the media layer like:
To use the checkers. just create a functor implementing bool operator()(const Pathname &file)
If you need to use more than one checker
Additionally, you can automatically enqueue a job with a checksum checker by using enqueueDigested which will use the OnMediaLocation checksum automatically.
Additionally, Fetcher supports checking the downloaded content by using signed indexes on the remote side.
Indexes are supported in CHECKSUMS format (simple text file) with checksum and file name, or content file, whith HASH SHA1 line entries.
zypp::Fetcher::Fetcher | ( | ) |
Default ctor.
Definition at line 839 of file Fetcher.cc.
|
virtual |
Dtor.
Definition at line 843 of file Fetcher.cc.
zypp::Fetcher::ZYPP_DECLARE_FLAGS | ( | Options | , |
Option | |||
) |
void zypp::Fetcher::setOptions | ( | Options | options | ) |
Fetcher::Options zypp::Fetcher::options | ( | ) | const |
void zypp::Fetcher::addIndex | ( | const OnMediaLocation & | resource | ) |
Adds an index containing metadata (for example checksums ) that will be retrieved and read before the job processing starts.
Nothing will be transferred or checked until start() is called.
The index is relative to the media path, and the listed files too.
Indexes in the SHA1SUM format, and YaST content file
The file has to be signed or the user will be warned that the file is unsigned. You can place the signature next to the file adding the .asc extension.
If you expect the key to not to be in the target system, then you can place it next to the index using adding the .key extension.
Definition at line 881 of file Fetcher.cc.
void zypp::Fetcher::enqueue | ( | const OnMediaLocation & | resource, |
const FileChecker & | checker = FileChecker() |
||
) |
Enqueue a object for transferal, they will not be transferred until start() is called.
Definition at line 887 of file Fetcher.cc.
void zypp::Fetcher::enqueueDigested | ( | const OnMediaLocation & | resource, |
const FileChecker & | checker = FileChecker() |
||
) |
Enqueue a object for transferal, they will not be transferred until start() is called.
Definition at line 861 of file Fetcher.cc.
void zypp::Fetcher::enqueueDigested | ( | const OnMediaLocation & | resource, |
const FileChecker & | checker, | ||
const Pathname & | deltafile | ||
) |
Definition at line 856 of file Fetcher.cc.
void zypp::Fetcher::enqueueDir | ( | const OnMediaLocation & | resource, |
bool | recursive = false , |
||
const FileChecker & | checker = FileChecker() |
||
) |
Enqueue a directory.
As the files to be enqueued are not known in advance, all files whose checksum can be found in some index are enqueued with checksum checking. Otherwise they are not.
Some index may provide the checksums, either by addIndex or using AutoAddIndexes flag.
Files are checked by providing a CHECKSUMS or content file listing <checksum> filename and a respective CHECKSUMS.asc/content.asc which has the signature for the checksums.
If you expect the user to not have the key of the signature either in the trusted or untrusted keyring, you can offer it as CHECKSUMS.key (or content.key)
recursive | True if the complete tree should be enqueued. |
Definition at line 866 of file Fetcher.cc.
void zypp::Fetcher::enqueueDigestedDir | ( | const OnMediaLocation & | resource, |
bool | recursive = false , |
||
const FileChecker & | checker = FileChecker() |
||
) |
Enqueue a directory and always check for checksums.
As the files to be enqueued are not known in advance, all files are enqueued with checksum checking. If the checksum of some file is not in some index, then there will be a verification warning ( DigestReport ).
Therefore some index will need to provide the checksums, either by addIndex or using AutoAddIndexes flag.
Files are checked by providing a CHECKSUMS or content file listing <checksum> filename and a respective CHECKSUMS.asc/content.asc which has the signature for the checksums.
If you expect the user to not have the key of the signature either in the trusted or untrusted keyring, you can offer it as CHECKSUMS.key (or content.key)
recursive | True if the complete tree should be enqueued. |
Definition at line 873 of file Fetcher.cc.
void zypp::Fetcher::addCachePath | ( | const Pathname & | cache_dir | ) |
adds a directory to the list of directories where to look for cached files
Definition at line 893 of file Fetcher.cc.
void zypp::Fetcher::reset | ( | ) |
Reset the transfer (jobs) list.
Definition at line 898 of file Fetcher.cc.
void zypp::Fetcher::setMediaSetAccess | ( | MediaSetAccess & | media | ) |
Sets the media set access that will be used to precache and to download the files when start is called.
Calling start will reset the media access.
Definition at line 903 of file Fetcher.cc.
void zypp::Fetcher::start | ( | const Pathname & | dest_dir, |
const ProgressData::ReceiverFnc & | progress = ProgressData::ReceiverFnc() |
||
) |
start the transfer to a destination directory dest_dir The media has to be provides with setMediaSetAccess before calling this version of start.
The file tree will be replicated inside this directory
Definition at line 908 of file Fetcher.cc.
void zypp::Fetcher::start | ( | const Pathname & | dest_dir, |
MediaSetAccess & | media, | ||
const ProgressData::ReceiverFnc & | progress = ProgressData::ReceiverFnc() |
||
) |
start the transfer to a destination directory dest_dir You have to provde a media set access media to get the files from The file tree will be replicated inside this directory
Definition at line 913 of file Fetcher.cc.
|
friend |
Definition at line 920 of file Fetcher.cc.
|
related |
Stream output.
Definition at line 920 of file Fetcher.cc.
|
private |