libzypp 17.37.17
MediaCurl2.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_MEDIA_MEDIACURL2_H
13#define ZYPP_MEDIA_MEDIACURL2_H
14
16#include <zypp/base/Flags.h>
17#include <zypp/ZYppCallbacks.h>
19
20#include <curl/curl.h>
21
22namespace zyppng {
24 ZYPP_FWD_DECL_TYPE_WITH_REFS (NetworkRequestDispatcher);
26}
27
28namespace zypp {
29
30 namespace internal {
32 }
33
34 namespace media {
35
37//
38// CLASS NAME : MediaCurl2
44{
45 public:
54
55 protected:
56
57 void releaseFrom( const std::string & ejectDev ) override;
58
64 bool getDoesFileExist( const Pathname & filename ) const override;
65
71 void disconnectFrom() override;
77 void getFileCopy( const OnMediaLocation& srcFile, const Pathname & targetFilename ) const override;
78 public:
79
80 MediaCurl2(const MirroredOrigin origin_r,
81 const Pathname & attach_point_hint_r );
82
83 ~MediaCurl2() override { try { release(); } catch(...) {} }
84
85 protected:
90 void checkProtocol(const Url &url) const override;
91
92 private:
93 struct RequestData {
94 int _mirrorIdx = -1;
95 zyppng::NetworkRequestRef _req;
96 };
98
99 bool tryZchunk( RequestData &reqData, const OnMediaLocation &srcFile , const Pathname & target, callback::SendReport<DownloadProgressReport> & report );
100
101 private:
102 internal::MediaNetworkRequestExecutorRef _executor;
103};
104ZYPP_DECLARE_OPERATORS_FOR_FLAGS(MediaCurl2::RequestOptions);
105
107
108 } // namespace media
109} // namespace zypp
110
111#endif // ZYPP_MEDIA_MEDIACURL2_H
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Describes a resource file located on a medium.
Url manipulation class.
Definition Url.h:93
void releaseFrom(const std::string &ejectDev) override
Call concrete handler to release the media.
void disconnectFrom() override
void getFileCopy(const OnMediaLocation &srcFile, const Pathname &targetFilename) const override
MediaCurl2(const MirroredOrigin origin_r, const Pathname &attach_point_hint_r)
Definition MediaCurl2.cc:68
bool getDoesFileExist(const Pathname &filename) const override
Repeatedly calls doGetDoesFileExist() until it successfully returns, fails unexpectedly,...
@ OPTION_NO_REPORT_START
do not send a start ProgressReport
Definition MediaCurl2.h:51
void executeRequest(RequestData &reqData, callback::SendReport< DownloadProgressReport > *report=nullptr)
internal::MediaNetworkRequestExecutorRef _executor
Definition MediaCurl2.h:102
bool tryZchunk(RequestData &reqData, const OnMediaLocation &srcFile, const Pathname &target, callback::SendReport< DownloadProgressReport > &report)
void checkProtocol(const Url &url) const override
check the url is supported by the curl library
ZYPP_DECLARE_FLAGS(RequestOptions, RequestOption)
void release(const std::string &ejectDev="")
Use concrete handler to release the media.
MediaNetworkCommonHandler(const MirroredOrigin &origin_r, const Pathname &attach_point_r, const Pathname &urlpath_below_attachpoint_r, const bool does_download_r)
Url details namespace.
Definition UrlBase.cc:58
Easy-to use interface to the ZYPP dependency resolver.
zyppng::NetworkRequestRef _req
Definition MediaCurl2.h:95
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)
Definition Flags.h:177
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126