libzypp: zypp/Fetcher.h Source File

libzypp 17.38.9

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-core/base/Flags.h>
19#include <zypp-core/base/PtrTypes.h>
20#include <zypp-core/Pathname.h>
21#include <zypp-core/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
29namespace zypp
30{
31
111 * where a remote resource will be located.
112 */
113 class ZYPP_API Fetcher
114 {
115 friend std::ostream & operator<<( std::ostream & str,
116 const Fetcher & obj );
117 public:
119 class Impl;
120 public:
121
123 * Various option flags to change behavior
124 */
125 enum Option
126 {
131 AutoAddContentFileIndexes = 0x0001,
136 AutoAddChecksumsIndexes = 0x0002,
141 AutoAddIndexes = AutoAddContentFileIndexes | AutoAddChecksumsIndexes,
142 };
143 ZYPP_DECLARE_FLAGS(Options, Option);
144
146 Fetcher();
148 virtual ~Fetcher();
149
150 public:
151
156 void setOptions( Options options );
157
162 Options options() const;
163
188 void addIndex( const OnMediaLocation &resource );
189
195 void enqueue( const OnMediaLocation &resource,
196 const FileChecker &checker = FileChecker() );
197
209 void enqueueDigested( const OnMediaLocation &resource, const FileChecker &checker = FileChecker() );
210
211
217 ZYPP_DEPRECATED void enqueueDigested( const OnMediaLocation &resource,
218 const FileChecker &checker, const Pathname &deltafile );
219
220
260 void enqueueDir( const OnMediaLocation &resource,
261 bool recursive = false,
262 const FileChecker &checker = FileChecker() );
263
304 void enqueueDigestedDir( const OnMediaLocation &resource,
305 bool recursive = false,
306 const FileChecker &checker = FileChecker() );
307
312 void addCachePath( const Pathname &cache_dir );
313
314
315 enum CacheOptions {
316 Default = 0,
317 CleanFiles = 1
318 };
323 void addCachePath( const Pathname &cache_dir, CacheOptions options );
324
329 void reset();
330
336 void setMediaSetAccess ( MediaSetAccess &media );
337
347 void start( const Pathname &dest_dir,
348 const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
349
359 void start( const Pathname &dest_dir,
360 MediaSetAccess &media,
361 const ProgressData::ReceiverFnc & progress = ProgressData::ReceiverFnc() );
362
363 public:
372 */
373 static Pathname mapToCachePath( Pathname remotePath_r );
374 static Pathname mapToCachePath( const OnMediaLocation & resource_r )
375 { return mapToCachePath( resource_r.filename() ); }
376
377 private:
379 RWCOW_pointer<Impl> _pimpl;
380 };
382 ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Fetcher::Options);
383
385 std::ostream & operator<<( std::ostream & str, const Fetcher & obj );
386
388} // namespace zypp
390#endif // ZYPP_FETCHER_H
FileChecker.h
Flags.h
ZYPP_DECLARE_OPERATORS_FOR_FLAGS
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)
relates: Flags
Definition Flags.h:177
ZYPP_DECLARE_FLAGS
#define ZYPP_DECLARE_FLAGS(Name, Enum)
relates: Flags
Definition Flags.h:174
ZYPP_DEPRECATED
#define ZYPP_DEPRECATED
The ZYPP_DEPRECATED macro can be used to trigger compile-time warnings with gcc >= 3....
Definition Globals.h:112
MediaSetAccess.h
Pathname.h
PtrTypes.h
Url.h
zypp::Fetcher::Impl
Fetcher implementation.
Definition Fetcher.cc:176
zypp::Fetcher
This class allows to retrieve a group of files in a confortable way, providing some smartness that do...
Definition Fetcher.h:112
zypp::Fetcher::CacheOptions
CacheOptions
Definition Fetcher.h:313
zypp::Fetcher::Default
@ Default
Definition Fetcher.h:314
zypp::Fetcher::CleanFiles
@ CleanFiles
Definition Fetcher.h:315
zypp::Fetcher::mapToCachePath
static Pathname mapToCachePath(Pathname remotePath_r)
Map a resource filename to a local path below a destDir.
Definition Fetcher.cc:990
zypp::Fetcher::_pimpl
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
Definition Fetcher.h:377
zypp::Fetcher::Option
Option
Various option flags to change behavior.
Definition Fetcher.h:124
zypp::Fetcher::AutoAddIndexes
@ AutoAddIndexes
If a content or CHECKSUMS file is found, it is downloaded and read.
Definition Fetcher.h:139
zypp::Fetcher::AutoAddChecksumsIndexes
@ AutoAddChecksumsIndexes
If a CHECKSUMS file is found, it is downloaded and read.
Definition Fetcher.h:134
zypp::Fetcher::AutoAddContentFileIndexes
@ AutoAddContentFileIndexes
If a content file is found, it is downloaded and read.
Definition Fetcher.h:129
zypp::Fetcher::Fetcher
Fetcher()
Default ctor.
Definition Fetcher.cc:904
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::OnMediaLocation::filename
const Pathname & filename() const
The path to the resource on the medium.
Definition onmedialocation.cc:90
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:48
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 CodePitfalls.doc:2
zypp::ZYPP_API
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
Definition Arch.h:173
zypp::FileChecker
function< void(const Pathname &file)> FileChecker
Functor signature used to check files.
Definition FileChecker.h:38
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65
zypp::Option
Mutable option.
Definition ZConfig.cc:162
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
Digest.h