1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Fetcher.cc
17 #include "zypp/base/Easy.h"
18 #include "zypp/base/LogControl.h"
19 #include "zypp/base/LogTools.h"
20 #include "zypp/base/PtrTypes.h"
21 #include "zypp/base/DefaultIntegral.h"
22 #include "zypp/base/String.h"
23 #include "zypp/Fetcher.h"
24 #include "zypp/ZYppFactory.h"
25 #include "zypp/CheckSum.h"
26 #include "zypp/base/UserRequestException.h"
27 #include "zypp/parser/susetags/ContentFileReader.h"
28 #include "zypp/parser/susetags/RepoIndex.h"
32 #undef ZYPP_BASE_LOGGER_LOGGROUP
33 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp:fetcher"
35 ///////////////////////////////////////////////////////////////////
37 { /////////////////////////////////////////////////////////////////
40 * class that represents indexes which add metadata
41 * to fetcher jobs and therefore need to be retrieved
46 FetcherIndex( const OnMediaLocation &loc )
49 /** Index localtion. */
50 OnMediaLocation location;
51 /** Whether we read this index. */
52 DefaultIntegral<bool,false> read;
55 typedef shared_ptr<FetcherIndex> FetcherIndex_Ptr;
57 /** std::set ordering (less semantic) */
58 struct SameFetcherIndex
60 bool operator()( const FetcherIndex_Ptr & lhs, const FetcherIndex_Ptr & rhs )
63 return false; // incl. NULL == NULL
65 return true; // NULL < nonNULL
67 return false; // nonNULL > NULL
68 // both nonNULL ==> compare medianr and path
69 if ( lhs->location.medianr() == rhs->location.medianr() )
70 return lhs->location.filename() < rhs->location.filename();
72 return lhs->location.medianr() < rhs->location.medianr();
77 * Class to encapsulate the \ref OnMediaLocation object
78 * and the \ref FileChecker together
87 RecursiveDirectory = Directory | Recursive,
88 // check checksums even if there is no such
89 // checksum (warns of no checksum)
90 AlwaysVerifyChecksum = 0x0004,
92 ZYPP_DECLARE_FLAGS(Flags, Flag);
95 FetcherJob( const OnMediaLocation &loc )
99 //MIL << location << endl;
104 //MIL << location << " | * " << checkers.size() << endl;
107 OnMediaLocation location;
108 //CompositeFileChecker checkers;
109 list<FileChecker> checkers;
113 ZYPP_DECLARE_OPERATORS_FOR_FLAGS(FetcherJob::Flags);
114 typedef shared_ptr<FetcherJob> FetcherJob_Ptr;
116 std::ostream & operator<<( std::ostream & str, const FetcherJob_Ptr & obj )
118 return str << obj->location;
121 ///////////////////////////////////////////////////////////////////
123 // CLASS NAME : Fetcher::Impl
125 /** Fetcher implementation. */
128 friend std::ostream & operator<<( std::ostream & str, const Fetcher::Impl & obj );
137 void setOptions( Fetcher::Options options );
138 Fetcher::Options options() const;
140 void addIndex( const OnMediaLocation &resource );
142 void enqueueDir( const OnMediaLocation &resource, bool recursive, const FileChecker &checker = FileChecker() );
143 void enqueueDigestedDir( const OnMediaLocation &resource, bool recursive, const FileChecker &checker = FileChecker() );
145 void enqueue( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
146 void enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
147 void addCachePath( const Pathname &cache_dir );
149 void start( const Pathname &dest_dir,
150 MediaSetAccess &media,
151 const ProgressData::ReceiverFnc & progress_receiver );
153 /** Offer default Impl. */
154 static shared_ptr<Impl> nullimpl()
156 static shared_ptr<Impl> _nullimpl( new Impl );
161 * download the indexes and reads them
163 void downloadAndReadIndexList( MediaSetAccess &media, const Pathname &dest_dir);
166 * download the indexes and reads them
168 void downloadIndex( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir);
171 * reads a downloaded index file and updates internal
174 * The index lists files relative to a directory, which is
175 * normally the same as the index file is located.
177 void readIndex( const Pathname &index, const Pathname &basedir );
179 /** specific version of \ref readIndex for SHA1SUMS file */
180 void readSha1sumsIndex( const Pathname &index, const Pathname &basedir );
182 /** specific version of \ref readIndex for SHA1SUMS file */
183 void readContentFileIndex( const Pathname &index, const Pathname &basedir );
185 /** reads the content of a directory but keeps a cache **/
186 void getDirectoryContent( MediaSetAccess &media, const OnMediaLocation &resource, filesystem::DirContent &content );
189 * tries to provide the file represented by job into dest_dir by
190 * looking at the cache. If success, returns true, and the desired
191 * file should be available on dest_dir
193 bool provideFromCache( const OnMediaLocation &resource, const Pathname &dest_dir );
195 * Validates the job against is checkers, by using the file instance
199 void validate( const OnMediaLocation &resource, const Pathname &dest_dir, const list<FileChecker> &checkers );
202 * scan the directory and adds the individual jobs
204 void addDirJobs( MediaSetAccess &media, const OnMediaLocation &resource,
205 const Pathname &dest_dir, FetcherJob::Flags flags );
208 * auto discovery and reading of indexes
210 void autoaddIndexes( const filesystem::DirContent &content,
211 MediaSetAccess &media,
212 const OnMediaLocation &resource,
213 const Pathname &dest_dir );
215 * Provide the resource to \ref dest_dir
217 void provideToDest( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir );
220 friend Impl * rwcowClone<Impl>( const Impl * rhs );
221 /** clone for RWCOW_pointer */
223 { return new Impl( *this ); }
225 list<FetcherJob_Ptr> _resources;
226 std::set<FetcherIndex_Ptr,SameFetcherIndex> _indexes;
227 std::set<Pathname> _caches;
228 // checksums read from the indexes
229 map<string, CheckSum> _checksums;
230 // cache of dir contents
231 map<string, filesystem::DirContent> _dircontent;
233 Fetcher::Options _options;
235 ///////////////////////////////////////////////////////////////////
237 void Fetcher::Impl::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker )
240 job.reset(new FetcherJob(resource));
241 job->flags |= FetcherJob:: AlwaysVerifyChecksum;
242 _resources.push_back(job);
245 Fetcher::Impl::Impl()
250 void Fetcher::Impl::setOptions( Fetcher::Options options )
251 { _options = options; }
253 Fetcher::Options Fetcher::Impl::options() const
256 void Fetcher::Impl::enqueueDir( const OnMediaLocation &resource,
258 const FileChecker &checker )
261 job.reset(new FetcherJob(resource));
263 job->checkers.push_back(checker);
265 job->flags |= FetcherJob::Recursive;
266 job->flags |= FetcherJob::Directory;
268 _resources.push_back(job);
271 void Fetcher::Impl::enqueueDigestedDir( const OnMediaLocation &resource,
273 const FileChecker &checker )
276 job.reset(new FetcherJob(resource));
278 job->checkers.push_back(checker);
280 job->flags |= FetcherJob::Recursive;
281 job->flags |= FetcherJob::Directory;
282 job->flags |= FetcherJob::AlwaysVerifyChecksum;
284 _resources.push_back(job);
288 void Fetcher::Impl::enqueue( const OnMediaLocation &resource, const FileChecker &checker )
291 job.reset(new FetcherJob(resource));
293 job->checkers.push_back(checker);
294 _resources.push_back(job);
297 void Fetcher::Impl::addIndex( const OnMediaLocation &resource )
299 MIL << "adding index " << resource << endl;
300 _indexes.insert(FetcherIndex_Ptr(new FetcherIndex(resource)));
304 void Fetcher::Impl::reset()
312 void Fetcher::Impl::addCachePath( const Pathname &cache_dir )
314 PathInfo info(cache_dir);
315 if ( info.isExist() )
319 DBG << "Adding fetcher cache: '" << cache_dir << "'." << endl;
320 _caches.insert(cache_dir);
324 // don't add bad cache directory, just log the error
325 ERR << "Not adding cache: '" << cache_dir << "'. Not a directory." << endl;
330 ERR << "Not adding cache '" << cache_dir << "'. Path does not exists." << endl;
335 // tries to provide resource to dest_dir from any of the configured additional
336 // cache paths where the file may already be present. returns true if the
337 // file was provided from the cache.
338 bool Fetcher::Impl::provideFromCache( const OnMediaLocation &resource, const Pathname &dest_dir )
340 Pathname dest_full_path = dest_dir + resource.filename();
342 // first check in the destination directory
343 if ( PathInfo(dest_full_path).isExist() )
345 if ( is_checksum( dest_full_path, resource.checksum() )
346 && (! resource.checksum().empty() ) )
350 MIL << "start fetcher with " << _caches.size() << " cache directories." << endl;
351 for_ ( it_cache, _caches.begin(), _caches.end() )
353 // does the current file exists in the current cache?
354 Pathname cached_file = *it_cache + resource.filename();
355 if ( PathInfo( cached_file ).isExist() )
357 DBG << "File '" << cached_file << "' exist, testing checksum " << resource.checksum() << endl;
358 // check the checksum
359 if ( is_checksum( cached_file, resource.checksum() ) && (! resource.checksum().empty() ) )
362 MIL << "file " << resource.filename() << " found in previous cache. Using cached copy." << endl;
363 // checksum is already checked.
364 // we could later implement double failover and try to download if file copy fails.
365 // replicate the complete path in the target directory
366 if( dest_full_path != cached_file )
368 if ( assert_dir( dest_full_path.dirname() ) != 0 )
369 ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
371 if ( filesystem::hardlink(cached_file, dest_full_path ) != 0 )
373 WAR << "Can't hardlink '" << cached_file << "' to '" << dest_dir << "'. Trying copying." << endl;
374 if ( filesystem::copy(cached_file, dest_full_path ) != 0 )
376 ERR << "Can't copy " << cached_file + " to " + dest_dir << endl;
386 } // iterate over caches
390 void Fetcher::Impl::validate( const OnMediaLocation &resource, const Pathname &dest_dir, const list<FileChecker> &checkers )
392 // no matter where did we got the file, try to validate it:
393 Pathname localfile = dest_dir + resource.filename();
394 // call the checker function
397 MIL << "Checking job [" << localfile << "] (" << checkers.size() << " checkers )" << endl;
399 for ( list<FileChecker>::const_iterator it = checkers.begin();
400 it != checkers.end();
409 ERR << "Invalid checker for '" << localfile << "'" << endl;
414 catch ( const FileCheckException &e )
418 catch ( const Exception &e )
424 ZYPP_THROW(Exception("Unknown error while validating " + resource.filename().asString()));
428 void Fetcher::Impl::autoaddIndexes( const filesystem::DirContent &content,
429 MediaSetAccess &media,
430 const OnMediaLocation &resource,
431 const Pathname &dest_dir )
433 if ( _options & AutoAddSha1sumsIndexes )
435 // only try to add an index if it exists
436 filesystem::DirEntry shafile;
437 shafile.name = "SHA1SUMS"; shafile.type = filesystem::FT_FILE;
438 if ( find( content.begin(), content.end(), shafile ) != content.end() )
440 // add the index of this directory
441 OnMediaLocation indexloc(resource);
442 indexloc.changeFilename(resource.filename() + "SHA1SUMS");
444 // we need to read it now
445 downloadAndReadIndexList(media, dest_dir);
448 if ( _options & AutoAddContentFileIndexes )
450 // only try to add an index if it exists
451 filesystem::DirEntry contentfile;
452 contentfile.name = "content"; contentfile.type = filesystem::FT_FILE;
453 if ( find( content.begin(), content.end(), contentfile ) != content.end() )
455 // add the index of this directory
456 OnMediaLocation indexloc(resource);
457 indexloc.changeFilename(resource.filename() + "content");
459 // we need to read it now
460 downloadAndReadIndexList(media, dest_dir);
465 void Fetcher::Impl::getDirectoryContent( MediaSetAccess &media,
466 const OnMediaLocation &resource,
467 filesystem::DirContent &content )
469 if ( _dircontent.find(resource.filename().asString())
470 != _dircontent.end() )
472 filesystem::DirContent filled(_dircontent[resource.filename().asString()]);
474 std::copy(filled.begin(), filled.end(), std::back_inserter(content));
478 filesystem::DirContent tofill;
479 media.dirInfo( tofill,
483 std::copy(tofill.begin(), tofill.end(), std::back_inserter(content));
484 _dircontent[resource.filename().asString()] = tofill;
488 void Fetcher::Impl::addDirJobs( MediaSetAccess &media,
489 const OnMediaLocation &resource,
490 const Pathname &dest_dir, FetcherJob::Flags flags )
492 // first get the content of the directory so we can add
493 // individual transfer jobs
494 MIL << "Adding directory " << resource.filename() << endl;
495 filesystem::DirContent content;
496 getDirectoryContent(media, resource, content);
498 // this method test for the option flags so indexes are added
499 // only if the options are enabled
500 autoaddIndexes(content, media, resource, dest_dir);
502 for ( filesystem::DirContent::const_iterator it = content.begin();
506 // skip SHA1SUMS* as they were already retrieved
507 if ( str::hasPrefix(it->name, "SHA1SUMS") )
510 Pathname filename = resource.filename() + it->name;
514 case filesystem::FT_NOT_AVAIL: // old directory.yast contains no typeinfo at all
515 case filesystem::FT_FILE:
517 CheckSum chksm(resource.checksum());
518 if ( _checksums.find(filename.asString()) != _checksums.end() )
520 // the checksum can be replaced with the one in the index.
521 chksm = _checksums[filename.asString()];
522 //MIL << "resource " << filename << " has checksum in the index file." << endl;
525 WAR << "Resource " << filename << " has no checksum in the index either." << endl;
527 if ( flags & FetcherJob::AlwaysVerifyChecksum )
528 enqueueDigested(OnMediaLocation(filename, resource.medianr()).setChecksum(chksm));
530 enqueue(OnMediaLocation(filename, resource.medianr()).setChecksum(chksm));
533 case filesystem::FT_DIR: // newer directory.yast contain at least directory info
534 if ( flags & FetcherJob::Recursive )
535 addDirJobs(media, filename, dest_dir, flags);
538 // don't provide devices, sockets, etc.
544 void Fetcher::Impl::provideToDest( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir )
546 bool got_from_cache = false;
548 // start look in cache
549 got_from_cache = provideFromCache(resource, dest_dir);
551 if ( ! got_from_cache )
553 MIL << "Not found in cache, downloading" << endl;
555 // try to get the file from the net
558 Pathname tmp_file = media.provideFile(resource, resource.optional() ? MediaSetAccess::PROVIDE_NON_INTERACTIVE : MediaSetAccess::PROVIDE_DEFAULT );
560 Pathname dest_full_path = dest_dir + resource.filename();
562 if ( assert_dir( dest_full_path.dirname() ) != 0 )
563 ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
564 if ( filesystem::copy(tmp_file, dest_full_path ) != 0 )
566 if ( ! PathInfo(tmp_file).isExist() )
567 ERR << tmp_file << " does not exist" << endl;
568 if ( ! PathInfo(dest_full_path.dirname()).isExist() )
569 ERR << dest_full_path.dirname() << " does not exist" << endl;
571 media.releaseFile(resource); //not needed anymore, only eat space
572 ZYPP_THROW( Exception("Can't copy " + tmp_file.asString() + " to " + dest_dir.asString()));
575 media.releaseFile(resource); //not needed anymore, only eat space
577 catch (Exception & excpt_r)
579 ZYPP_CAUGHT(excpt_r);
580 excpt_r.remember("Can't provide " + resource.filename().asString() + " : " + excpt_r.msg());
582 if ( resource.optional() )
584 WAR << "optional resource " << resource << " could not be transfered" << endl;
589 ZYPP_RETHROW(excpt_r);
595 // We got the file from cache
596 // continue with next file
601 // helper class to consume a content file
602 struct ContentReaderHelper : public parser::susetags::ContentFileReader
604 ContentReaderHelper()
606 setRepoIndexConsumer( bind( &ContentReaderHelper::consumeIndex, this, _1 ) );
609 void consumeIndex( const parser::susetags::RepoIndex_Ptr & data_r )
610 { _repoindex = data_r; }
612 parser::susetags::RepoIndex_Ptr _repoindex;
615 // generic function for reading indexes
616 void Fetcher::Impl::readIndex( const Pathname &index, const Pathname &basedir )
618 if ( index.basename() == "SHA1SUMS" )
619 readSha1sumsIndex(index, basedir);
620 else if ( index.basename() == "content" )
621 readContentFileIndex(index, basedir);
623 WAR << index << ": index file format not known" << endl;
626 // reads a content file index
627 void Fetcher::Impl::readContentFileIndex( const Pathname &index, const Pathname &basedir )
629 ContentReaderHelper reader;
631 MIL << index << " contains " << reader._repoindex->mediaFileChecksums.size() << " checksums." << endl;
632 for_( it, reader._repoindex->mediaFileChecksums.begin(), reader._repoindex->mediaFileChecksums.end() )
634 // content file entries don't start with /
635 _checksums[(basedir + it->first).asString()] = it->second;
639 // reads a SHA1SUMS file index
640 void Fetcher::Impl::readSha1sumsIndex( const Pathname &index, const Pathname &basedir )
642 std::ifstream in( index.c_str() );
646 while ( getline(in, buffer) )
648 vector<string> words;
649 str::split( buffer, back_inserter(words) );
650 if ( words.size() != 2 )
651 ZYPP_THROW(Exception("Wrong format for SHA1SUMS file"));
652 //MIL << "check: '" << words[0] << "' | '" << words[1] << "'" << endl;
653 if ( ! words[1].empty() )
654 _checksums[(basedir + words[1]).asString()] = CheckSum::sha1(words[0]);
658 ZYPP_THROW(Exception("Can't open SHA1SUMS file: " + index.asString()));
661 void Fetcher::Impl::downloadIndex( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir)
663 MIL << "downloading index " << resource << endl;
664 // create a new fetcher with a different state to transfer the
665 // file containing checksums and its signature
667 // signature checker for index. We havent got the signature from
669 SignatureFileChecker sigchecker;
671 // build the name of the index and the signature
672 OnMediaLocation idxloc(resource);
673 OnMediaLocation sigloc(resource);
674 OnMediaLocation keyloc(resource);
676 // we should not fail the download if those don't exists
677 // the checking will warn later
678 sigloc.setOptional(true);
679 keyloc.setOptional(true);
681 // calculate signature and key name
682 sigloc.changeFilename( sigloc.filename().extend(".asc") );
683 keyloc.changeFilename( keyloc.filename().extend(".key") );
685 //assert_dir(dest_dir + idxloc.filename().dirname());
687 // transfer the signature
688 fetcher.enqueue(sigloc);
689 fetcher.start( dest_dir, media );
690 // if we get the signature, update the checker
691 if ( PathInfo(dest_dir + sigloc.filename()).isExist() )
692 sigchecker = SignatureFileChecker(dest_dir + sigloc.filename());
697 fetcher.enqueue(keyloc);
698 fetcher.start( dest_dir, media );
701 // try to import the key
702 if ( PathInfo(dest_dir + keyloc.filename()).isExist() )
703 getZYpp()->keyRing()->importKey(PublicKey(dest_dir + keyloc.filename()), false);
705 WAR << "No public key specified by user for index '" << keyloc.filename() << "'"<< endl;
707 // now the index itself
708 fetcher.enqueue( idxloc, FileChecker(sigchecker) );
709 fetcher.start( dest_dir, media );
713 // this method takes all the user pointed indexes, gets them and also tries to
714 // download their signature, and verify them. After that, its parses each one
715 // to fill the checksum cache.
716 void Fetcher::Impl::downloadAndReadIndexList( MediaSetAccess &media, const Pathname &dest_dir)
718 // if there is no indexes, then just return to avoid
719 // the directory listing
720 if ( _indexes.empty() )
722 MIL << "No indexes to read." << endl;
726 for_( it_idx, _indexes.begin(), _indexes.end() )
728 if ( (*it_idx)->read )
730 DBG << "Already read index " << PathInfo(dest_dir + (*it_idx)->location.filename()) << endl;
734 // base::LogControl::TmpLineWriter shutUp;
735 downloadIndex( media, (*it_idx)->location, dest_dir );
736 // now we have the indexes in dest_dir
737 readIndex( dest_dir + (*it_idx)->location.filename(), (*it_idx)->location.filename().dirname() );
738 // Take care we don't process it again
739 MIL << "Remember read index " << PathInfo(dest_dir + (*it_idx)->location.filename()) << endl;
740 (*it_idx)->read = true;
743 MIL << "done reading indexes" << endl;
746 // start processing all fetcher jobs.
747 // it processes any user pointed index first
748 void Fetcher::Impl::start( const Pathname &dest_dir,
749 MediaSetAccess &media,
750 const ProgressData::ReceiverFnc & progress_receiver )
752 ProgressData progress(_resources.size());
753 progress.sendTo(progress_receiver);
755 downloadAndReadIndexList(media, dest_dir);
757 for ( list<FetcherJob_Ptr>::const_iterator it_res = _resources.begin(); it_res != _resources.end(); ++it_res )
760 if ( (*it_res)->flags & FetcherJob::Directory )
762 const OnMediaLocation location((*it_res)->location);
763 addDirJobs(media, location, dest_dir, (*it_res)->flags);
767 // may be this code can be factored out
768 // together with the autodiscovery of indexes
770 if ( ( _options & AutoAddSha1sumsIndexes ) ||
771 ( _options & AutoAddContentFileIndexes ) )
773 // if auto indexing is enabled, then we need to read the
774 // index for each file. We look only in the directory
775 // where the file is. this is expensive of course.
776 filesystem::DirContent content;
777 getDirectoryContent(media, (*it_res)->location.filename().dirname(), content);
778 // this method test for the option flags so indexes are added
779 // only if the options are enabled
780 MIL << "Autodiscovering signed indexes on '"
781 << (*it_res)->location.filename().dirname() << "' for '"
782 << (*it_res)->location.filename() << "'" << endl;
784 autoaddIndexes(content, media, (*it_res)->location.filename().dirname(), dest_dir);
786 // also look in the root of the media
788 getDirectoryContent(media, Pathname("/"), content);
789 // this method test for the option flags so indexes are added
790 // only if the options are enabled
791 MIL << "Autodiscovering signed indexes on '"
793 << (*it_res)->location.filename() << "'" << endl;
795 autoaddIndexes(content, media, Pathname("/"), dest_dir);
798 provideToDest(media, (*it_res)->location, dest_dir);
800 // if the file was not transfered, and no exception, just
801 // return, as it was an optional file
802 if ( ! PathInfo(dest_dir + (*it_res)->location.filename()).isExist() )
805 // if the checksum is empty, but the checksum is in one of the
806 // indexes checksum, then add a checker
807 if ( (*it_res)->location.checksum().empty() )
809 if ( _checksums.find((*it_res)->location.filename().asString())
810 != _checksums.end() )
812 CheckSum chksm = _checksums[(*it_res)->location.filename().asString()];
813 ChecksumFileChecker digest_check(chksm);
814 (*it_res)->checkers.push_back(digest_check);
818 // if the index checksum is empty too, we only add the checker
819 // if the AlwaysVerifyChecksum option is set on
820 if ( (*it_res)->flags & FetcherJob::AlwaysVerifyChecksum )
822 // add the checker with the empty checksum
823 ChecksumFileChecker digest_check((*it_res)->location.checksum());
824 (*it_res)->checkers.push_back(digest_check);
830 // checksum is not empty, so add a checksum checker
831 ChecksumFileChecker digest_check((*it_res)->location.checksum());
832 (*it_res)->checkers.push_back(digest_check);
835 // validate job, this throws if not valid
836 validate((*it_res)->location, dest_dir, (*it_res)->checkers);
838 if ( ! progress.incr() )
839 ZYPP_THROW(AbortRequestException());
843 /** \relates Fetcher::Impl Stream output */
844 inline std::ostream & operator<<( std::ostream & str, const Fetcher::Impl & obj )
846 for ( list<FetcherJob_Ptr>::const_iterator it_res = obj._resources.begin(); it_res != obj._resources.end(); ++it_res )
854 : _pimpl( new Impl() )
860 void Fetcher::setOptions( Fetcher::Options options )
862 _pimpl->setOptions(options);
865 Fetcher::Options Fetcher::options() const
867 return _pimpl->options();
870 void Fetcher::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker )
872 _pimpl->enqueueDigested(resource, checker);
875 void Fetcher::enqueueDir( const OnMediaLocation &resource,
877 const FileChecker &checker )
879 _pimpl->enqueueDir(resource, recursive, checker);
882 void Fetcher::enqueueDigestedDir( const OnMediaLocation &resource,
884 const FileChecker &checker )
886 _pimpl->enqueueDigestedDir(resource, recursive, checker);
890 void Fetcher::addIndex( const OnMediaLocation &resource )
892 _pimpl->addIndex(resource);
896 void Fetcher::enqueue( const OnMediaLocation &resource, const FileChecker &checker )
898 _pimpl->enqueue(resource, checker);
901 void Fetcher::addCachePath( const Pathname &cache_dir )
903 _pimpl->addCachePath(cache_dir);
906 void Fetcher::reset()
911 void Fetcher::start( const Pathname &dest_dir,
912 MediaSetAccess &media,
913 const ProgressData::ReceiverFnc & progress_receiver )
915 _pimpl->start(dest_dir, media, progress_receiver);
918 std::ostream & operator<<( std::ostream & str, const Fetcher & obj )
920 return str << *obj._pimpl;
923 /////////////////////////////////////////////////////////////////
925 ///////////////////////////////////////////////////////////////////