ZYPP_DECLARE_FLAGS(Flags, Flag);
- FetcherJob( const OnMediaLocation &loc )
+ FetcherJob( const OnMediaLocation &loc, const Pathname dfile = Pathname())
: location(loc)
+ , deltafile(dfile)
, flags(None)
{
//MIL << location << endl;
}
OnMediaLocation location;
+ Pathname deltafile;
//CompositeFileChecker checkers;
list<FileChecker> checkers;
Flags flags;
void enqueueDigestedDir( const OnMediaLocation &resource, bool recursive, const FileChecker &checker = FileChecker() );
void enqueue( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
- void enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
+ void enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker = FileChecker(), const Pathname &deltafile = Pathname() );
void addCachePath( const Pathname &cache_dir );
void reset();
void start( const Pathname &dest_dir,
/**
* Provide the resource to \ref dest_dir
*/
- void provideToDest( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir );
+ void provideToDest( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir , const Pathname &deltafile);
private:
friend Impl * rwcowClone<Impl>( const Impl * rhs );
};
///////////////////////////////////////////////////////////////////
- void Fetcher::Impl::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker )
+ void Fetcher::Impl::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker, const Pathname &deltafile )
{
FetcherJob_Ptr job;
- job.reset(new FetcherJob(resource));
+ job.reset(new FetcherJob(resource, deltafile));
job->flags |= FetcherJob:: AlwaysVerifyChecksum;
_resources.push_back(job);
}
}
}
- void Fetcher::Impl::provideToDest( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir )
+ void Fetcher::Impl::provideToDest( MediaSetAccess &media, const OnMediaLocation &resource, const Pathname &dest_dir, const Pathname &deltafile )
{
bool got_from_cache = false;
// try to get the file from the net
try
{
- Pathname tmp_file = media.provideFile(resource, resource.optional() ? MediaSetAccess::PROVIDE_NON_INTERACTIVE : MediaSetAccess::PROVIDE_DEFAULT );
+ Pathname tmp_file = media.provideFile(resource, resource.optional() ? MediaSetAccess::PROVIDE_NON_INTERACTIVE : MediaSetAccess::PROVIDE_DEFAULT, deltafile );
Pathname dest_full_path = dest_dir + resource.filename();
autoaddIndexes(content, media, Pathname("/"), dest_dir);
}
- provideToDest(media, (*it_res)->location, dest_dir);
+ provideToDest(media, (*it_res)->location, dest_dir, (*it_res)->deltafile);
// if the file was not transfered, and no exception, just
// return, as it was an optional file
return _pimpl->options();
}
- void Fetcher::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker )
+ void Fetcher::enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker, const Pathname &deltafile )
{
- _pimpl->enqueueDigested(resource, checker);
+ _pimpl->enqueueDigested(resource, checker, deltafile);
}
void Fetcher::enqueueDir( const OnMediaLocation &resource,
* the user could be asked twice.
*
* \todo FIXME implement checker == operator to avoid this.
+ *
+ * the optional deltafile argument describes a file that can
+ * be used for delta download algorithms. Usable files are
+ * uncompressed files or files compressed with gzip --rsyncable.
+ * Other files like rpms do not work, as the compression
+ * breaks the delta algorithm.
*/
void enqueueDigested( const OnMediaLocation &resource,
- const FileChecker &checker = FileChecker() );
+ const FileChecker &checker = FileChecker(), const Pathname &deltafile = Pathname());
/**
- Pathname MediaSetAccess::provideFile( const OnMediaLocation & resource, ProvideFileOptions options )
+ Pathname MediaSetAccess::provideFile( const OnMediaLocation & resource, ProvideFileOptions options, const Pathname &deltafile )
{
ProvideFileOperation op;
- provide( boost::ref(op), resource, options );
+ provide( boost::ref(op), resource, options, deltafile );
return op.result;
}
OnMediaLocation resource;
ProvideFileOperation op;
resource.setLocation(file, media_nr);
- provide( boost::ref(op), resource, options );
+ provide( boost::ref(op), resource, options, Pathname() );
return op.result;
}
ProvideFileExistenceOperation op;
OnMediaLocation resource;
resource.setLocation(file, media_nr);
- provide( boost::ref(op), resource, PROVIDE_DEFAULT);
+ provide( boost::ref(op), resource, PROVIDE_DEFAULT, Pathname());
return op.result;
}
void MediaSetAccess::provide( ProvideOperation op,
const OnMediaLocation &resource,
- ProvideFileOptions options )
+ ProvideFileOptions options,
+ const Pathname &deltafile )
{
Pathname file(resource.filename());
unsigned media_nr(resource.medianr());
{
// get the mediaId, but don't try to attach it here
media = getMediaAccessId( media_nr);
+ bool deltafileset = false;
try
{
// try to attach the media
if ( ! media_mgr.isAttached(media) )
media_mgr.attach(media);
+ media_mgr.setDeltafile(media, deltafile);
+ deltafileset = true;
op(media, file);
+ media_mgr.setDeltafile(media, Pathname());
break;
}
catch ( media::MediaException & excp )
{
ZYPP_CAUGHT(excp);
+ if (deltafileset)
+ media_mgr.setDeltafile(media, Pathname());
media::MediaChangeReport::Action user = media::MediaChangeReport::ABORT;
unsigned int devindex = 0;
vector<string> devices;
if ( recursive )
{
ProvideDirTreeOperation op;
- provide( boost::ref(op), resource, options);
+ provide( boost::ref(op), resource, options, Pathname());
return op.result;
}
ProvideDirOperation op;
- provide( boost::ref(op), resource, options);
+ provide( boost::ref(op), resource, options, Pathname());
return op.result;
}
* If the resource is marked as optional, no Exception is thrown
* and Pathname() is returned
*
+ * the optional deltafile argument describes a file that can
+ * be used for delta download algorithms.
+ *
* \note interaction with the user does not ocurr if
* \ref ProvideFileOptions::NON_INTERACTIVE is set.
*
*
* \see zypp::media::MediaManager::provideFile()
*/
- Pathname provideFile( const OnMediaLocation & resource, ProvideFileOptions options = PROVIDE_DEFAULT );
+ Pathname provideFile( const OnMediaLocation & resource, ProvideFileOptions options = PROVIDE_DEFAULT, const Pathname &deltafile = Pathname() );
/**
* Provides \a file from media \a media_nr.
typedef function<void( media::MediaAccessId, const Pathname & )> ProvideOperation;
- void provide( ProvideOperation op, const OnMediaLocation &resource, ProvideFileOptions options );
+ void provide( ProvideOperation op, const OnMediaLocation &resource, ProvideFileOptions options, const Pathname &deltafile );
media::MediaAccessId getMediaAccessId (media::MediaNr medianr);
virtual std::ostream & dumpOn( std::ostream & str ) const;