libzypp 17.37.10

Fetcher.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_FETCHER_H
13#define ZYPP_FETCHER_H
14
15#include <iosfwd>
16#include <list>
17
18#include <zypp/base/Flags.h>
19#include <zypp/base/PtrTypes.h>
20#include <zypp/Pathname.h>
21#include <zypp/Url.h>
22#include <zypp-core/OnMediaLocation>
23#include <zypp/Digest.h>
24#include <zypp/MediaSetAccess.h>
25#include <zypp/FileChecker.h>
26#include <zypp-core/ui/ProgressData>
27
29 namespace zypp
30{
31
103 * length. No need to somehow encode it in the filename.
104 */
105 class ZYPP_API Fetcher
106 {
107 friend std::ostream & operator<<( std::ostream & str,
108 const Fetcher & obj );
109 public:
111 class Impl;
112 public:
113
115 * Various option flags to change behavior
116 */
117 enum Option
118 {
123 AutoAddContentFileIndexes = 0x0001,
128 AutoAddChecksumsIndexes = 0x0002,
133 AutoAddIndexes = AutoAddContentFileIndexes | AutoAddChecksumsIndexes,
134 };
135 ZYPP_DECLARE_FLAGS(Options, Option);
136
138 Fetcher();
140 virtual ~Fetcher();
141
142 public:
143
148 void setOptions( Options options );
149
154 Options options() const;
155
180 void addIndex( const OnMediaLocation &resource );
181
187 void enqueue( const OnMediaLocation &resource,
188 const FileChecker &checker = FileChecker() );
189
201 void enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
202
203
209 ZYPP_DEPRECATED void enqueueDigested( const OnMediaLocation &resource,
210 const FileChecker &checker, const Pathname &deltafile );
211
212
252 void enqueueDir( const OnMediaLocation &resource,
253 bool recursive = false,
254 const FileChecker &checker = FileChecker() );
255
296 void enqueueDigestedDir( const OnMediaLocation &resource,
297 bool recursive = false,
298 const FileChecker &checker = FileChecker() );
299
304 void addCachePath( const Pathname &cache_dir );
305
306
307 enum CacheOptions {
308 Default = 0,
309 CleanFiles = 1
310 };
315 void addCachePath( const Pathname &cache_dir, CacheOptions options );
316
321 void reset();
322
328 void setMediaSetAccess ( MediaSetAccess &media );
329
339 void start( const Pathname &dest_dir,
340 const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
341
351 void start( const Pathname &dest_dir,
352 MediaSetAccess &media,
353 const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
354
355 private:
357 RWCOW_pointer<Impl> _pimpl;
358 };
360 ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Fetcher::Options);
361
363 std::ostream & operator<<( std::ostream & str, const Fetcher & obj );
364
366} // namespace zypp
368#endif // ZYPP_FETCHER_H
FileChecker.h
MediaSetAccess.h
zypp::Fetcher::Impl
Fetcher implementation.
Definition Fetcher.cc:127
zypp::Fetcher
This class allows to retrieve a group of files in a confortable way, providing some smartness that do...
Definition Fetcher.h:104
zypp::Fetcher::CacheOptions
CacheOptions
Definition Fetcher.h:305
zypp::Fetcher::Default
@ Default
Definition Fetcher.h:306
zypp::Fetcher::CleanFiles
@ CleanFiles
Definition Fetcher.h:307
zypp::Fetcher::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition Fetcher.h:355
zypp::Fetcher::Option
Option
Various option flags to change behavior.
Definition Fetcher.h:116
zypp::Fetcher::AutoAddIndexes
@ AutoAddIndexes
If a content or CHECKSUMS file is found, it is downloaded and read.
Definition Fetcher.h:131
zypp::Fetcher::AutoAddChecksumsIndexes
@ AutoAddChecksumsIndexes
If a CHECKSUMS file is found, it is downloaded and read.
Definition Fetcher.h:126
zypp::Fetcher::AutoAddContentFileIndexes
@ AutoAddContentFileIndexes
If a content file is found, it is downloaded and read.
Definition Fetcher.h:121
zypp::Fetcher::Fetcher
Fetcher()
Default ctor.
Definition Fetcher.cc:853
zypp::MediaSetAccess
Media access layer responsible for handling files distributed on a set of media with media change and...
Definition MediaSetAccess.h:82
zypp::OnMediaLocation
Describes a resource file located on a medium.
Definition onmedialocation.h:37
zypp::ProgressData::ReceiverFnc
function< bool(const ProgressData &)> ReceiverFnc
Most simple version of progress reporting The percentage in most cases.
Definition progressdata.h:140
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
str
String related utilities and Regular expression matching.
zypp::media
Definition MediaNetworkRequestExecutor.h:22
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition SerialNumber.cc:52
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::FileChecker
function< void(const Pathname &file)> FileChecker
Functor signature used to check files.
Definition FileChecker.h:38
zypp::Option
Mutable option.
Definition ZConfig.cc:328
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
ZYPP_DEPRECATED
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3....
Definition Globals.h:112
ZYPP_DECLARE_OPERATORS_FOR_FLAGS
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)
Definition Flags.h:177
ZYPP_DECLARE_FLAGS
#define ZYPP_DECLARE_FLAGS(Name, Enum)
Definition Flags.h:174
Digest.h
Pathname.h
Url.h
Flags.h
PtrTypes.h