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>
30 #undef ZYPP_BASE_LOGGER_LOGGROUP
31 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp:fetcher"
33 ///////////////////////////////////////////////////////////////////
35 { /////////////////////////////////////////////////////////////////
38 * class that represents indexes which add metadata
39 * to fetcher jobs and therefore need to be retrieved
44 FetcherIndex( const OnMediaLocation &loc )
47 /** Index localtion. */
48 OnMediaLocation location;
49 /** Whether we read this index. */
50 DefaultIntegral<bool,false> read;
53 typedef shared_ptr<FetcherIndex> FetcherIndex_Ptr;
55 /** std::set ordering (less semantic) */
56 struct SameFetcherIndex
58 bool operator()( const FetcherIndex_Ptr & lhs, const FetcherIndex_Ptr & rhs ) const
61 return false; // incl. NULL == NULL
63 return true; // NULL < nonNULL
65 return false; // nonNULL > NULL
66 // both nonNULL ==> compare medianr and path
67 if ( lhs->location.medianr() == rhs->location.medianr() )
68 return lhs->location.filename() < rhs->location.filename();
70 return lhs->location.medianr() < rhs->location.medianr();
75 * Class to encapsulate the \ref OnMediaLocation object
76 * and the \ref FileChecker together
85 RecursiveDirectory = Directory | Recursive,
86 // check checksums even if there is no such
87 // checksum (warns of no checksum)
88 AlwaysVerifyChecksum = 0x0004,
90 ZYPP_DECLARE_FLAGS(Flags, Flag);
93 FetcherJob( const OnMediaLocation &loc, const Pathname dfile = Pathname())
98 //MIL << location << endl;
103 //MIL << location << " | * " << checkers.size() << endl;
106 OnMediaLocation location;
108 //CompositeFileChecker checkers;
109 std::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 );
135 void setOptions( Fetcher::Options options );
136 Fetcher::Options options() const;
138 void addIndex( const OnMediaLocation &resource );
140 void enqueueDir( const OnMediaLocation &resource, bool recursive, const FileChecker &checker = FileChecker() );
141 void enqueueDigestedDir( const OnMediaLocation &resource, bool recursive, const FileChecker &checker = FileChecker() );
143 void enqueue( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
144 void enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker = FileChecker(), const Pathname &deltafile = Pathname() );
145 void addCachePath( const Pathname &cache_dir );
147 void start( const Pathname &dest_dir,
148 MediaSetAccess &media,
149 const ProgressData::ReceiverFnc & progress_receiver );
151 /** Offer default Impl. */
152 static shared_ptr<Impl> nullimpl()
154 static shared_ptr<Impl> _nullimpl( new Impl );
159 * download the indexes and reads them
161 void downloadAndReadIndexList( MediaSetAccess &media, const Pathname &dest_dir);
164 * download the indexes and reads them
166 void downloadIndex( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir);
169 * reads a downloaded index file and updates internal
172 * The index lists files relative to a directory, which is
173 * normally the same as the index file is located.
175 void readIndex( const Pathname &index, const Pathname &basedir );
177 /** specific version of \ref readIndex for CHECKSUMS file */
178 void readChecksumsIndex( const Pathname &index, const Pathname &basedir );
180 /** specific version of \ref readIndex for content file */
181 void readContentFileIndex( const Pathname &index, const Pathname &basedir );
183 /** reads the content of a directory but keeps a cache **/
184 void getDirectoryContent( MediaSetAccess &media, const OnMediaLocation &resource, filesystem::DirContent &content );
187 * Tries to locate the file represented by job by looking at
188 * the cache (matching checksum is mandatory). Returns the
189 * location of the cached file or an empty \ref Pathname.
191 Pathname locateInCache( const OnMediaLocation & resource_r, const Pathname & destDir_r );
193 * Validates the provided file against its checkers.
196 void validate( const Pathname & localfile_r, const std::list<FileChecker> & checkers_r );
199 * scan the directory and adds the individual jobs
201 void addDirJobs( MediaSetAccess &media, const OnMediaLocation &resource,
202 const Pathname &dest_dir, FetcherJob::Flags flags );
205 * auto discovery and reading of indexes
207 void autoaddIndexes( const filesystem::DirContent &content,
208 MediaSetAccess &media,
209 const OnMediaLocation &resource,
210 const Pathname &dest_dir );
212 * Provide the resource to \ref dest_dir
214 void provideToDest( MediaSetAccess & media_r, const Pathname & destDir_r , const FetcherJob_Ptr & jobp_r );
217 friend Impl * rwcowClone<Impl>( const Impl * rhs );
218 /** clone for RWCOW_pointer */
220 { return new Impl( *this ); }
222 std::list<FetcherJob_Ptr> _resources;
223 std::set<FetcherIndex_Ptr,SameFetcherIndex> _indexes;
224 std::set<Pathname> _caches;
225 // checksums read from the indexes
226 std::map<std::string, CheckSum> _checksums;
227 // cache of dir contents
228 std::map<std::string, filesystem::DirContent> _dircontent;
230 Fetcher::Options _options;
232 ///////////////////////////////////////////////////////////////////
234 void Fetcher::Impl::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker, const Pathname &deltafile )
237 job.reset(new FetcherJob(resource, deltafile));
238 job->flags |= FetcherJob:: AlwaysVerifyChecksum;
239 _resources.push_back(job);
242 Fetcher::Impl::Impl()
247 void Fetcher::Impl::setOptions( Fetcher::Options options )
248 { _options = options; }
250 Fetcher::Options Fetcher::Impl::options() const
253 void Fetcher::Impl::enqueueDir( const OnMediaLocation &resource,
255 const FileChecker &checker )
258 job.reset(new FetcherJob(resource));
260 job->checkers.push_back(checker);
262 job->flags |= FetcherJob::Recursive;
263 job->flags |= FetcherJob::Directory;
265 _resources.push_back(job);
268 void Fetcher::Impl::enqueueDigestedDir( const OnMediaLocation &resource,
270 const FileChecker &checker )
273 job.reset(new FetcherJob(resource));
275 job->checkers.push_back(checker);
277 job->flags |= FetcherJob::Recursive;
278 job->flags |= FetcherJob::Directory;
279 job->flags |= FetcherJob::AlwaysVerifyChecksum;
281 _resources.push_back(job);
285 void Fetcher::Impl::enqueue( const OnMediaLocation &resource, const FileChecker &checker )
288 job.reset(new FetcherJob(resource));
290 job->checkers.push_back(checker);
291 _resources.push_back(job);
294 void Fetcher::Impl::addIndex( const OnMediaLocation &resource )
296 MIL << "adding index " << resource << endl;
297 _indexes.insert(FetcherIndex_Ptr(new FetcherIndex(resource)));
301 void Fetcher::Impl::reset()
309 void Fetcher::Impl::addCachePath( const Pathname &cache_dir )
311 PathInfo info(cache_dir);
312 if ( info.isExist() )
316 DBG << "Adding fetcher cache: '" << cache_dir << "'." << endl;
317 _caches.insert(cache_dir);
321 // don't add bad cache directory, just log the error
322 ERR << "Not adding cache: '" << cache_dir << "'. Not a directory." << endl;
327 ERR << "Not adding cache '" << cache_dir << "'. Path does not exists." << endl;
332 Pathname Fetcher::Impl::locateInCache( const OnMediaLocation & resource_r, const Pathname & destDir_r )
335 // No checksum - no match
336 if ( resource_r.checksum().empty() )
339 // first check in the destination directory
340 Pathname cacheLocation = destDir_r / resource_r.filename();
341 if ( PathInfo(cacheLocation).isExist() && is_checksum( cacheLocation, resource_r.checksum() ) )
343 swap( ret, cacheLocation );
347 MIL << "start fetcher with " << _caches.size() << " cache directories." << endl;
348 for( const Pathname & cacheDir : _caches )
350 cacheLocation = cacheDir / resource_r.filename();
351 if ( PathInfo(cacheLocation).isExist() && is_checksum( cacheLocation, resource_r.checksum() ) )
353 MIL << "file " << resource_r.filename() << " found in cache " << cacheDir << endl;
354 swap( ret, cacheLocation );
362 void Fetcher::Impl::validate( const Pathname & localfile_r, const std::list<FileChecker> & checkers_r )
366 MIL << "Checking job [" << localfile_r << "] (" << checkers_r.size() << " checkers )" << endl;
368 for ( const FileChecker & chkfnc : checkers_r )
371 chkfnc( localfile_r );
373 ERR << "Invalid checker for '" << localfile_r << "'" << endl;
377 catch ( const FileCheckException &e )
381 catch ( const Exception &e )
387 ZYPP_THROW(Exception("Unknown error while validating " + localfile_r.asString()));
391 void Fetcher::Impl::autoaddIndexes( const filesystem::DirContent &content,
392 MediaSetAccess &media,
393 const OnMediaLocation &resource,
394 const Pathname &dest_dir )
396 auto fnc_addIfInContent( [&]( const std::string & index_r ) -> bool
398 if ( find( content.begin(), content.end(), filesystem::DirEntry(index_r,filesystem::FT_FILE) ) == content.end() )
400 // add the index of this directory
401 OnMediaLocation indexloc( resource );
402 indexloc.changeFilename( resource.filename() + index_r );
403 addIndex( indexloc );
404 // we need to read it now
405 downloadAndReadIndexList( media, dest_dir );
409 if ( _options & AutoAddChecksumsIndexes )
411 fnc_addIfInContent( "CHECKSUMS" ) || fnc_addIfInContent( "SHA1SUMS" );
413 if ( _options & AutoAddContentFileIndexes )
415 fnc_addIfInContent( "content" );
419 void Fetcher::Impl::getDirectoryContent( MediaSetAccess &media,
420 const OnMediaLocation &resource,
421 filesystem::DirContent &content )
423 if ( _dircontent.find(resource.filename().asString())
424 != _dircontent.end() )
426 filesystem::DirContent filled(_dircontent[resource.filename().asString()]);
428 std::copy(filled.begin(), filled.end(), std::back_inserter(content));
432 filesystem::DirContent tofill;
433 media.dirInfo( tofill,
437 std::copy(tofill.begin(), tofill.end(), std::back_inserter(content));
438 _dircontent[resource.filename().asString()] = tofill;
442 void Fetcher::Impl::addDirJobs( MediaSetAccess &media,
443 const OnMediaLocation &resource,
444 const Pathname &dest_dir, FetcherJob::Flags flags )
446 // first get the content of the directory so we can add
447 // individual transfer jobs
448 MIL << "Adding directory " << resource.filename() << endl;
449 filesystem::DirContent content;
451 getDirectoryContent(media, resource, content);
453 catch ( media::MediaFileNotFoundException & exception )
455 ZYPP_CAUGHT( exception );
456 WAR << "Skiping subtree hidden at " << resource.filename() << endl;
460 // this method test for the option flags so indexes are added
461 // only if the options are enabled
462 autoaddIndexes(content, media, resource, dest_dir);
464 for ( filesystem::DirContent::const_iterator it = content.begin();
468 // skip CHECKSUMS* as they were already retrieved
469 if ( str::hasPrefix(it->name, "CHECKSUMS") || str::hasPrefix(it->name, "SHA1SUMS") )
472 Pathname filename = resource.filename() + it->name;
476 case filesystem::FT_NOT_AVAIL: // old directory.yast contains no typeinfo at all
477 case filesystem::FT_FILE:
479 CheckSum chksm(resource.checksum());
480 if ( _checksums.find(filename.asString()) != _checksums.end() )
482 // the checksum can be replaced with the one in the index.
483 chksm = _checksums[filename.asString()];
484 //MIL << "resource " << filename << " has checksum in the index file." << endl;
487 WAR << "Resource " << filename << " has no checksum in the index either." << endl;
489 if ( flags & FetcherJob::AlwaysVerifyChecksum )
490 enqueueDigested(OnMediaLocation(filename, resource.medianr()).setChecksum(chksm));
492 enqueue(OnMediaLocation(filename, resource.medianr()).setChecksum(chksm));
495 case filesystem::FT_DIR: // newer directory.yast contain at least directory info
496 if ( flags & FetcherJob::Recursive )
497 addDirJobs(media, filename, dest_dir, flags);
500 // don't provide devices, sockets, etc.
506 void Fetcher::Impl::provideToDest( MediaSetAccess & media_r, const Pathname & destDir_r , const FetcherJob_Ptr & jobp_r )
508 const OnMediaLocation & resource( jobp_r->location );
512 scoped_ptr<MediaSetAccess::ReleaseFileGuard> releaseFileGuard; // will take care provided files get released
514 // get cached file (by checksum) or provide from media
515 Pathname tmpFile = locateInCache( resource, destDir_r );
516 if ( tmpFile.empty() )
518 MIL << "Not found in cache, retrieving..." << endl;
519 tmpFile = media_r.provideFile( resource, resource.optional() ? MediaSetAccess::PROVIDE_NON_INTERACTIVE : MediaSetAccess::PROVIDE_DEFAULT, jobp_r->deltafile );
520 releaseFileGuard.reset( new MediaSetAccess::ReleaseFileGuard( media_r, resource ) ); // release it when we leave the block
523 // The final destination: locateInCache also checks destFullPath!
524 // If we find a cache match (by checksum) at destFullPath, take
525 // care it gets deleted, in case the validation fails.
526 ManagedFile destFullPath( destDir_r / resource.filename() );
527 if ( tmpFile == destFullPath )
528 destFullPath.setDispose( filesystem::unlink );
530 // validate the file (throws if not valid)
531 validate( tmpFile, jobp_r->checkers );
533 // move it to the final destination
534 if ( tmpFile == destFullPath )
535 destFullPath.resetDispose(); // keep it!
538 if ( assert_dir( destFullPath->dirname() ) != 0 )
539 ZYPP_THROW( Exception( "Can't create " + destFullPath->dirname().asString() ) );
541 if ( filesystem::hardlinkCopy( tmpFile, destFullPath ) != 0 )
542 ZYPP_THROW( Exception( "Can't hardlink/copy " + tmpFile.asString() + " to " + destDir_r.asString() ) );
545 catch ( Exception & excpt )
547 if ( resource.optional() )
549 ZYPP_CAUGHT( excpt );
550 WAR << "optional resource " << resource << " could not be transferred." << endl;
555 excpt.remember( "Can't provide " + resource.filename().asString() );
556 ZYPP_RETHROW( excpt );
561 // helper class to consume a content file
562 struct ContentReaderHelper : public parser::susetags::ContentFileReader
564 ContentReaderHelper()
566 setRepoIndexConsumer( bind( &ContentReaderHelper::consumeIndex, this, _1 ) );
569 void consumeIndex( const parser::susetags::RepoIndex_Ptr & data_r )
570 { _repoindex = data_r; }
572 parser::susetags::RepoIndex_Ptr _repoindex;
575 // generic function for reading indexes
576 void Fetcher::Impl::readIndex( const Pathname &index, const Pathname &basedir )
578 if ( index.basename() == "CHECKSUMS" || index.basename() == "SHA1SUMS" )
579 readChecksumsIndex(index, basedir);
580 else if ( index.basename() == "content" )
581 readContentFileIndex(index, basedir);
583 WAR << index << ": index file format not known" << endl;
586 // reads a content file index
587 void Fetcher::Impl::readContentFileIndex( const Pathname &index, const Pathname &basedir )
589 ContentReaderHelper reader;
591 MIL << index << " contains " << reader._repoindex->mediaFileChecksums.size() << " checksums." << endl;
592 for_( it, reader._repoindex->mediaFileChecksums.begin(), reader._repoindex->mediaFileChecksums.end() )
594 // content file entries don't start with /
595 _checksums[(basedir + it->first).asString()] = it->second;
599 // reads a CHECKSUMS (old SHA1SUMS) file index
600 void Fetcher::Impl::readChecksumsIndex( const Pathname &index, const Pathname &basedir )
602 std::ifstream in( index.c_str() );
606 while ( getline( in, buffer ) )
609 if ( buffer[0] == '#' )
610 continue; // simple comment
612 CheckSum checksum( str::stripFirstWord( buffer, /*ltrim before strip*/true ) );
613 if ( checksum.empty() )
614 continue; // empty line | unknown cheksum format
616 if ( buffer.empty() )
618 WAR << "Missing filename in CHECKSUMS file: " << index.asString() << " (" << checksum << ")" << endl;
622 _checksums[(basedir/buffer).asString()] = checksum;
626 ZYPP_THROW(Exception("Can't open CHECKSUMS file: " + index.asString()));
629 void Fetcher::Impl::downloadIndex( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir)
631 MIL << "downloading index " << resource << endl;
632 // create a new fetcher with a different state to transfer the
633 // file containing checksums and its signature
635 // signature checker for index. We havent got the signature from
637 SignatureFileChecker sigchecker;
639 // build the name of the index and the signature
640 OnMediaLocation idxloc(resource);
641 OnMediaLocation sigloc(resource);
642 OnMediaLocation keyloc(resource);
644 // we should not fail the download if those don't exists
645 // the checking will warn later
646 sigloc.setOptional(true);
647 keyloc.setOptional(true);
649 // calculate signature and key name
650 sigloc.changeFilename( sigloc.filename().extend(".asc") );
651 keyloc.changeFilename( keyloc.filename().extend(".key") );
653 //assert_dir(dest_dir + idxloc.filename().dirname());
655 // transfer the signature
656 fetcher.enqueue(sigloc);
657 fetcher.start( dest_dir, media );
658 // if we get the signature, update the checker
659 if ( PathInfo(dest_dir + sigloc.filename()).isExist() )
660 sigchecker = SignatureFileChecker(dest_dir + sigloc.filename());
665 fetcher.enqueue(keyloc);
666 fetcher.start( dest_dir, media );
669 // try to import the key
670 if ( PathInfo(dest_dir + keyloc.filename()).isExist() )
671 getZYpp()->keyRing()->importKey(PublicKey(dest_dir + keyloc.filename()), false);
673 WAR << "No public key specified by user for index '" << keyloc.filename() << "'"<< endl;
675 // now the index itself
676 fetcher.enqueue( idxloc, FileChecker(sigchecker) );
677 fetcher.start( dest_dir, media );
681 // this method takes all the user pointed indexes, gets them and also tries to
682 // download their signature, and verify them. After that, its parses each one
683 // to fill the checksum cache.
684 void Fetcher::Impl::downloadAndReadIndexList( MediaSetAccess &media, const Pathname &dest_dir)
686 // if there is no indexes, then just return to avoid
687 // the directory listing
688 if ( _indexes.empty() )
690 MIL << "No indexes to read." << endl;
694 for_( it_idx, _indexes.begin(), _indexes.end() )
696 if ( (*it_idx)->read )
698 DBG << "Already read index " << PathInfo(dest_dir + (*it_idx)->location.filename()) << endl;
702 // base::LogControl::TmpLineWriter shutUp;
703 downloadIndex( media, (*it_idx)->location, dest_dir );
704 // now we have the indexes in dest_dir
705 readIndex( dest_dir + (*it_idx)->location.filename(), (*it_idx)->location.filename().dirname() );
706 // Take care we don't process it again
707 MIL << "Remember read index " << PathInfo(dest_dir + (*it_idx)->location.filename()) << endl;
708 (*it_idx)->read = true;
711 MIL << "done reading indexes" << endl;
714 // start processing all fetcher jobs.
715 // it processes any user pointed index first
716 void Fetcher::Impl::start( const Pathname &dest_dir,
717 MediaSetAccess &media,
718 const ProgressData::ReceiverFnc & progress_receiver )
720 ProgressData progress(_resources.size());
721 progress.sendTo(progress_receiver);
723 downloadAndReadIndexList(media, dest_dir);
725 for ( const FetcherJob_Ptr & jobp : _resources )
727 if ( jobp->flags & FetcherJob::Directory )
729 const OnMediaLocation location(jobp->location);
730 addDirJobs(media, location, dest_dir, jobp->flags);
734 // may be this code can be factored out
735 // together with the autodiscovery of indexes
737 if ( ( _options & AutoAddChecksumsIndexes ) ||
738 ( _options & AutoAddContentFileIndexes ) )
740 // if auto indexing is enabled, then we need to read the
741 // index for each file. We look only in the directory
742 // where the file is. this is expensive of course.
743 filesystem::DirContent content;
744 getDirectoryContent(media, jobp->location.filename().dirname(), content);
745 // this method test for the option flags so indexes are added
746 // only if the options are enabled
747 MIL << "Autodiscovering signed indexes on '"
748 << jobp->location.filename().dirname() << "' for '"
749 << jobp->location.filename() << "'" << endl;
751 autoaddIndexes(content, media, jobp->location.filename().dirname(), dest_dir);
753 // also look in the root of the media
755 getDirectoryContent(media, Pathname("/"), content);
756 // this method test for the option flags so indexes are added
757 // only if the options are enabled
758 MIL << "Autodiscovering signed indexes on '"
760 << jobp->location.filename() << "'" << endl;
762 autoaddIndexes(content, media, Pathname("/"), dest_dir);
765 // if the checksum is empty, but the checksum is in one of the
766 // indexes checksum, then add a checker
767 if ( jobp->location.checksum().empty() )
769 if ( _checksums.find(jobp->location.filename().asString())
770 != _checksums.end() )
772 CheckSum chksm = _checksums[jobp->location.filename().asString()];
773 ChecksumFileChecker digest_check(chksm);
774 jobp->checkers.push_back(digest_check);
778 // if the index checksum is empty too, we only add the checker
779 // if the AlwaysVerifyChecksum option is set on
780 if ( jobp->flags & FetcherJob::AlwaysVerifyChecksum )
782 // add the checker with the empty checksum
783 ChecksumFileChecker digest_check(jobp->location.checksum());
784 jobp->checkers.push_back(digest_check);
790 // checksum is not empty, so add a checksum checker
791 ChecksumFileChecker digest_check(jobp->location.checksum());
792 jobp->checkers.push_back(digest_check);
795 // Provide and validate the file. If the file was not transferred
796 // and no exception was thrown, it was an optional file.
797 provideToDest( media, dest_dir, jobp );
799 if ( ! progress.incr() )
800 ZYPP_THROW(AbortRequestException());
804 /** \relates Fetcher::Impl Stream output */
805 inline std::ostream & operator<<( std::ostream & str, const Fetcher::Impl & obj )
807 for ( std::list<FetcherJob_Ptr>::const_iterator it_res = obj._resources.begin(); it_res != obj._resources.end(); ++it_res )
815 : _pimpl( new Impl() )
821 void Fetcher::setOptions( Fetcher::Options options )
823 _pimpl->setOptions(options);
826 Fetcher::Options Fetcher::options() const
828 return _pimpl->options();
831 void Fetcher::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker, const Pathname &deltafile )
833 _pimpl->enqueueDigested(resource, checker, deltafile);
836 void Fetcher::enqueueDir( const OnMediaLocation &resource,
838 const FileChecker &checker )
840 _pimpl->enqueueDir(resource, recursive, checker);
843 void Fetcher::enqueueDigestedDir( const OnMediaLocation &resource,
845 const FileChecker &checker )
847 _pimpl->enqueueDigestedDir(resource, recursive, checker);
851 void Fetcher::addIndex( const OnMediaLocation &resource )
853 _pimpl->addIndex(resource);
857 void Fetcher::enqueue( const OnMediaLocation &resource, const FileChecker &checker )
859 _pimpl->enqueue(resource, checker);
862 void Fetcher::addCachePath( const Pathname &cache_dir )
864 _pimpl->addCachePath(cache_dir);
867 void Fetcher::reset()
872 void Fetcher::start( const Pathname &dest_dir,
873 MediaSetAccess &media,
874 const ProgressData::ReceiverFnc & progress_receiver )
876 _pimpl->start(dest_dir, media, progress_receiver);
879 std::ostream & operator<<( std::ostream & str, const Fetcher & obj )
881 return str << *obj._pimpl;
884 /////////////////////////////////////////////////////////////////
886 ///////////////////////////////////////////////////////////////////