libzypp  17.14.0
zypp::media::multifetchworker Class Reference
Inheritance diagram for zypp::media::multifetchworker:

Public Member Functions

 multifetchworker (int no, multifetchrequest &request, const Url &url)
 
 ~multifetchworker ()
 
void nextjob ()
 
void run ()
 
bool checkChecksum ()
 
bool recheckChecksum ()
 
void disableCompetition ()
 
void checkdns ()
 
void adddnsfd (fd_set &rset, int &maxfd)
 
void dnsevent (fd_set &rset)
 

Public Attributes

int _workerno
 
int _state
 
bool _competing
 
size_t _blkno
 
off_t _blkstart
 
size_t _blksize
 
bool _noendrange
 
double _blkstarttime
 
size_t _blkreceived
 
off_t _received
 
double _avgspeed
 
double _maxspeed
 
double _sleepuntil
 

Private Member Functions

void stealjob ()
 
size_t writefunction (void *ptr, size_t size)
 
size_t headerfunction (char *ptr, size_t size)
 
- Private Member Functions inherited from zypp::media::MediaCurl
 ZYPP_DECLARE_FLAGS (RequestOptions, RequestOption)
 
 MediaCurl (const Url &url_r, const Pathname &attach_point_hint_r)
 
virtual ~MediaCurl () override
 
TransferSettingssettings ()
 
Url clearQueryString (const Url &url) const
 
virtual void attachTo (bool next=false) override
 Call concrete handler to attach the media. More...
 
virtual void releaseFrom (const std::string &ejectDev) override
 Call concrete handler to release the media. More...
 
virtual void getFile (const Pathname &filename, const ByteCount &expectedFileSize_r) const override
 Call concrete handler to provide file below attach point. More...
 
virtual void getDir (const Pathname &dirname, bool recurse_r) const override
 Call concrete handler to provide directory content (not recursive!) below attach point. More...
 
virtual void getDirInfo (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const override
 Call concrete handler to provide a content list of directory on media via retlist. More...
 
virtual void getDirInfo (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const override
 Basically the same as getDirInfo above. More...
 
virtual bool getDoesFileExist (const Pathname &filename) const override
 Repeatedly calls doGetDoesFileExist() until it successfully returns, fails unexpectedly, or user cancels the operation. More...
 
virtual bool doGetDoesFileExist (const Pathname &filename) const
 
virtual void disconnectFrom () override
 
virtual void getFileCopy (const Pathname &srcFilename, const Pathname &targetFilename, const ByteCount &expectedFileSize_r) const override
 
virtual void doGetFileCopy (const Pathname &srcFilename, const Pathname &targetFilename, callback::SendReport< DownloadProgressReport > &_report, const ByteCount &expectedFileSize_r, RequestOptions options=OPTION_NONE) const
 
virtual bool checkAttachPoint (const Pathname &apoint) const override
 Verify if the specified directory as attach point (root) as requires by the particular media handler implementation. More...
 
void checkProtocol (const Url &url) const
 check the url is supported by the curl library More...
 
virtual void setupEasy ()
 initializes the curl easy handle with the data from the url More...
 
Url getFileUrl (const Pathname &filename) const
 concatenate the attach url and the filename to a complete download url More...
 
void evaluateCurlCode (const zypp::Pathname &filename, CURLcode code, bool timeout) const
 Evaluates a curl return code and throws the right MediaException filename Filename being downloaded code Code curl returnes timeout Whether we reached timeout, which we need to differentiate in case the codes aborted-by-callback or timeout are returned by curl Otherwise we can't differentiate abort from timeout. More...
 
void doGetFileCopyFile (const Pathname &srcFilename, const Pathname &dest, FILE *file, callback::SendReport< DownloadProgressReport > &_report, const ByteCount &expectedFileSize_r, RequestOptions options=OPTION_NONE) const
 
- Private Member Functions inherited from zypp::media::MediaHandler
 MediaHandler (const Url &url_r, const Pathname &attach_point_r, const Pathname &urlpath_below_attachpoint_r, const bool does_download_r)
 If the concrete media handler provides a nonempty attach_point, it must be an existing directory. More...
 
virtual ~MediaHandler ()
 Contolling MediaAccess takes care, that attached media is released prior to deleting this. More...
 
bool downloads () const
 Hint if files are downloaded or not. More...
 
std::string protocol () const
 Protocol hint for MediaAccess. More...
 
Url url () const
 Url used. More...
 
void attach (bool next)
 Use concrete handler to attach the media. More...
 
virtual bool isAttached () const
 True if media is attached. More...
 
Pathname localRoot () const
 Return the local directory that corresponds to medias url, no matter if media isAttached or not. More...
 
Pathname localPath (const Pathname &pathname) const
 Files provided will be available at 'localPath(filename)'. More...
 
void disconnect ()
 Use concrete handler to isconnect media. More...
 
void release (const std::string &ejectDev="")
 Use concrete handler to release the media. More...
 
void provideFile (Pathname filename, const ByteCount &expectedFileSize_r) const
 Use concrete handler to provide file denoted by path below 'localRoot'. More...
 
void provideFileCopy (Pathname srcFilename, Pathname targetFilename, const ByteCount &expectedFileSize_r) const
 Call concrete handler to provide a copy of a file under a different place in the file system (usually not under attach point) as a copy. More...
 
void provideDir (Pathname dirname) const
 Use concrete handler to provide directory denoted by path below 'localRoot' (not recursive!). More...
 
void provideDirTree (Pathname dirname) const
 Use concrete handler to provide directory tree denoted by path below 'localRoot' (recursive!!). More...
 
void releaseFile (const Pathname &filename) const
 Remove filename below localRoot IFF handler downloads files to the local filesystem. More...
 
void releaseDir (const Pathname &dirname) const
 Remove directory tree below localRoot IFF handler downloads files to the local filesystem. More...
 
void releasePath (Pathname pathname) const
 Remove pathname below localRoot IFF handler downloads files to the local filesystem. More...
 
void setDeltafile (const Pathname &filename=Pathname()) const
 
Pathname deltafile () const
 
void dirInfo (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const
 Return content of directory on media via retlist. More...
 
void dirInfo (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const
 Basically the same as dirInfo above. More...
 
bool doesFileExist (const Pathname &filename) const
 check if a file exists More...
 
virtual bool hasMoreDevices ()
 Check if the media has one more device available for attach(true). More...
 
virtual void getDetectedDevices (std::vector< std::string > &devices, unsigned int &index) const
 Fill in a vector of detected ejectable devices and the index of the currently attached device within the vector. More...
 
bool dependsOnParent (MediaAccessId parentId, bool exactIdMatch)
 Check if the current media handler depends on an another handler specified by media access id. More...
 
bool dependsOnParent ()
 
void resetParentId ()
 Called in case, where the media manager takes over the destruction of the parent id (e.g. More...
 
Pathname attachPoint () const
 Return the currently used attach point. More...
 
void setAttachPoint (const Pathname &path, bool temp)
 Set a new attach point. More...
 
void setAttachPoint (const AttachPointRef &ref)
 Set a (shared) attach point. More...
 
AttachPoint attachPointHint () const
 Get the actual attach point hint. More...
 
void attachPointHint (const Pathname &path, bool temp)
 Set the attach point hint as specified by the user. More...
 
Pathname createAttachPoint () const
 Try to create a default / temporary attach point. More...
 
Pathname createAttachPoint (const Pathname &attach_root) const
 Try to create a temporary attach point in specified root. More...
 
void removeAttachPoint ()
 Remove unused attach point. More...
 
bool isUseableAttachPoint (const Pathname &path, bool mtab=true) const
 Ask media manager, if the specified path is already used as attach point or if there are another attach points bellow of it. More...
 
std::string mediaSourceName () const
 Get the media source name or an empty string. More...
 
void setMediaSource (const MediaSourceRef &ref)
 Set new media source reference. More...
 
AttachedMedia findAttachedMedia (const MediaSourceRef &media) const
 Ask the media manager if specified media source is already attached. More...
 
AttachedMedia attachedMedia () const
 Returns the attached media. More...
 
bool isSharedMedia () const
 Returns a hint if the media is shared or not. More...
 
bool checkAttached (bool matchMountFs) const
 Check actual mediaSource attachment against the current mount table of the system. More...
 
void forceRelaseAllMedia (bool matchMountFs)
 Call to this function will try to release all media matching the currenlty attached media source, that it is able to find in the mount table. More...
 
void forceRelaseAllMedia (const MediaSourceRef &ref, bool matchMountFs)
 
virtual void forceEject (const std::string &device)
 Call concrete handler to physically eject the media (i.e. More...
 
void getDirectoryYast (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const
 Retrieve and if available scan dirname/directory.yast. More...
 
void getDirectoryYast (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const
 Retrieve and if available scan dirname/directory.yast. More...
 

Static Private Member Functions

static size_t _writefunction (void *ptr, size_t size, size_t nmemb, void *stream)
 
static size_t _headerfunction (void *ptr, size_t size, size_t nmemb, void *stream)
 
- Static Private Member Functions inherited from zypp::media::MediaCurl
static void setCookieFile (const Pathname &)
 
static int aliveCallback (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
 Callback sending just an alive trigger to the UI, without stats (e.g. More...
 
static int progressCallback (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
 Callback reporting download progress. More...
 
static CURL * progressCallback_getcurl (void *clientp)
 
static void resetExpectedFileSize (void *clientp, const ByteCount &expectedFileSize)
 MediaMultiCurl needs to reset the expected filesize in case a metalink file is downloaded otherwise this function should not be called. More...
 
- Static Private Member Functions inherited from zypp::media::MediaHandler
static bool setAttachPrefix (const Pathname &attach_prefix)
 
static std::string getRealPath (const std::string &path)
 
static Pathname getRealPath (const Pathname &path)
 
static bool checkAttachPoint (const Pathname &apoint, bool empty_dir, bool writeable)
 Verify if the specified directory as attach point (root) using requested checks. More...
 

Private Attributes

multifetchrequest_request
 
int _pass
 
string _urlbuf
 
off_t _off
 
size_t _size
 
Digest _dig
 
pid_t _pid
 
int _dnspipe
 
- Private Attributes inherited from zypp::media::MediaCurl
CURL * _curl
 
char _curlError [CURL_ERROR_SIZE]
 
curl_slist * _customHeaders
 
TransferSettings _settings
 
- Private Attributes inherited from zypp::media::MediaHandler
const Url _url
 Url to handle. More...
 
MediaAccessId _parentId
 Access Id of media handler we depend on. More...
 

Friends

class multifetchrequest
 

Additional Inherited Members

- Private Types inherited from zypp::media::MediaCurl
enum  RequestOption {
  OPTION_NONE = 0x0, OPTION_RANGE = 0x1, OPTION_HEAD = 0x02, OPTION_NO_IFMODSINCE = 0x04,
  OPTION_NO_REPORT_START = 0x08
}
 
- Private Types inherited from zypp::media::MediaHandler
typedef shared_ptr< MediaHandlerPtr
 
typedef shared_ptr< const MediaHandlerconstPtr
 

Detailed Description

Definition at line 49 of file MediaMultiCurl.cc.

Constructor & Destructor Documentation

◆ multifetchworker()

zypp::media::multifetchworker::multifetchworker ( int  no,
multifetchrequest request,
const Url url 
)

Definition at line 299 of file MediaMultiCurl.cc.

◆ ~multifetchworker()

zypp::media::multifetchworker::~multifetchworker ( )

Definition at line 378 of file MediaMultiCurl.cc.

Member Function Documentation

◆ nextjob()

void zypp::media::multifetchworker::nextjob ( )

Definition at line 696 of file MediaMultiCurl.cc.

◆ run()

void zypp::media::multifetchworker::run ( )

Definition at line 745 of file MediaMultiCurl.cc.

◆ checkChecksum()

bool zypp::media::multifetchworker::checkChecksum ( )

Definition at line 552 of file MediaMultiCurl.cc.

◆ recheckChecksum()

bool zypp::media::multifetchworker::recheckChecksum ( )

Definition at line 561 of file MediaMultiCurl.cc.

◆ disableCompetition()

void zypp::media::multifetchworker::disableCompetition ( )

Definition at line 677 of file MediaMultiCurl.cc.

◆ checkdns()

void zypp::media::multifetchworker::checkdns ( )

Definition at line 426 of file MediaMultiCurl.cc.

◆ adddnsfd()

void zypp::media::multifetchworker::adddnsfd ( fd_set &  rset,
int &  maxfd 
)

Definition at line 504 of file MediaMultiCurl.cc.

◆ dnsevent()

void zypp::media::multifetchworker::dnsevent ( fd_set &  rset)

Definition at line 514 of file MediaMultiCurl.cc.

◆ stealjob()

void zypp::media::multifetchworker::stealjob ( )
private

Definition at line 584 of file MediaMultiCurl.cc.

◆ writefunction()

size_t zypp::media::multifetchworker::writefunction ( void *  ptr,
size_t  size 
)
private

Definition at line 180 of file MediaMultiCurl.cc.

◆ _writefunction()

size_t zypp::media::multifetchworker::_writefunction ( void *  ptr,
size_t  size,
size_t  nmemb,
void *  stream 
)
staticprivate

Definition at line 242 of file MediaMultiCurl.cc.

◆ headerfunction()

size_t zypp::media::multifetchworker::headerfunction ( char *  ptr,
size_t  size 
)
private

Definition at line 249 of file MediaMultiCurl.cc.

◆ _headerfunction()

size_t zypp::media::multifetchworker::_headerfunction ( void *  ptr,
size_t  size,
size_t  nmemb,
void *  stream 
)
staticprivate

Definition at line 293 of file MediaMultiCurl.cc.

Friends And Related Function Documentation

◆ multifetchrequest

friend class multifetchrequest
friend

Definition at line 50 of file MediaMultiCurl.cc.

Member Data Documentation

◆ _workerno

int zypp::media::multifetchworker::_workerno

Definition at line 65 of file MediaMultiCurl.cc.

◆ _state

int zypp::media::multifetchworker::_state

Definition at line 67 of file MediaMultiCurl.cc.

◆ _competing

bool zypp::media::multifetchworker::_competing

Definition at line 68 of file MediaMultiCurl.cc.

◆ _blkno

size_t zypp::media::multifetchworker::_blkno

Definition at line 70 of file MediaMultiCurl.cc.

◆ _blkstart

off_t zypp::media::multifetchworker::_blkstart

Definition at line 71 of file MediaMultiCurl.cc.

◆ _blksize

size_t zypp::media::multifetchworker::_blksize

Definition at line 72 of file MediaMultiCurl.cc.

◆ _noendrange

bool zypp::media::multifetchworker::_noendrange

Definition at line 73 of file MediaMultiCurl.cc.

◆ _blkstarttime

double zypp::media::multifetchworker::_blkstarttime

Definition at line 75 of file MediaMultiCurl.cc.

◆ _blkreceived

size_t zypp::media::multifetchworker::_blkreceived

Definition at line 76 of file MediaMultiCurl.cc.

◆ _received

off_t zypp::media::multifetchworker::_received

Definition at line 77 of file MediaMultiCurl.cc.

◆ _avgspeed

double zypp::media::multifetchworker::_avgspeed

Definition at line 79 of file MediaMultiCurl.cc.

◆ _maxspeed

double zypp::media::multifetchworker::_maxspeed

Definition at line 80 of file MediaMultiCurl.cc.

◆ _sleepuntil

double zypp::media::multifetchworker::_sleepuntil

Definition at line 82 of file MediaMultiCurl.cc.

◆ _request

multifetchrequest* zypp::media::multifetchworker::_request
private

Definition at line 93 of file MediaMultiCurl.cc.

◆ _pass

int zypp::media::multifetchworker::_pass
private

Definition at line 94 of file MediaMultiCurl.cc.

◆ _urlbuf

string zypp::media::multifetchworker::_urlbuf
private

Definition at line 95 of file MediaMultiCurl.cc.

◆ _off

off_t zypp::media::multifetchworker::_off
private

Definition at line 96 of file MediaMultiCurl.cc.

◆ _size

size_t zypp::media::multifetchworker::_size
private

Definition at line 97 of file MediaMultiCurl.cc.

◆ _dig

Digest zypp::media::multifetchworker::_dig
private

Definition at line 98 of file MediaMultiCurl.cc.

◆ _pid

pid_t zypp::media::multifetchworker::_pid
private

Definition at line 100 of file MediaMultiCurl.cc.

◆ _dnspipe

int zypp::media::multifetchworker::_dnspipe
private

Definition at line 101 of file MediaMultiCurl.cc.


The documentation for this class was generated from the following file: