libzypp  17.31.31
basicdownloader_p.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 ----------------------------------------------------------------------/
9 *
10 * This file contains private API, this might break at any time between releases.
11 * You have been warned!
12 *
13 */
14 #ifndef ZYPP_CURL_NG_NETWORK_PRIVATE_DOWNLOADERSTATES_BASICDOWNLOADER_P_H_INCLUDED
15 #define ZYPP_CURL_NG_NETWORK_PRIVATE_DOWNLOADERSTATES_BASICDOWNLOADER_P_H_INCLUDED
16 
17 #include "base_p.h"
18 #include "mirrorhandling_p.h"
19 #include <zypp-core/zyppng/base/statemachine.h>
20 
21 namespace zyppng {
22 
28 
30 
32  BasicDownloaderStateBase ( std::shared_ptr<Request> &&req, DownloadPrivate &parent );
33 
34  void enter ();
35  void exit ();
36 
37  virtual bool initializeRequest ( std::shared_ptr<Request> &r );
38  virtual void gotFinished ();
39  virtual void failed(NetworkRequestError &&err);
40  void failed (std::string &&str );
41 
43  void onRequestProgress ( NetworkRequest &, off_t dltotal, off_t dlnow, off_t, off_t );
44  void onRequestFinished ( NetworkRequest &req , const NetworkRequestError &err );
45 
46  const NetworkRequestError &error () const {
47  return _error;
48  }
49 
50  std::shared_ptr<Request> _request;
51  std::optional<std::string> _chksumtype; //< The file checksum type if available
52  std::optional<UByteArray> _chksumVec; //< The file checksum if available
53 
54  // MirrorHandlingStateBase interface
55  void mirrorReceived(MirrorControl::MirrorPick mirror) override;
56  void failedToPrepare() override;
57 
58  protected:
59  void startWithMirror ( MirrorControl::MirrorHandle mirror, const zypp::Url &url, const TransferSettings &set );
60  void startWithoutMirror ( );
61  void startRequest ();
62  virtual void handleRequestProgress (NetworkRequest &req, off_t dltotal, off_t dlnow );
64  Signal< void () > _sigFinished;
65  Signal< void () > _sigFailed;
66 
67  };
68 
69 }
70 
71 #endif
BasicDownloaderStateBase(DownloadPrivate &parent)
void onRequestFinished(NetworkRequest &req, const NetworkRequestError &err)
virtual void failed(NetworkRequestError &&err)
Holds transfer setting.
void onRequestProgress(NetworkRequest &, off_t dltotal, off_t dlnow, off_t, off_t)
void onRequestStarted(NetworkRequest &)
std::optional< UByteArray > _chksumVec
String related utilities and Regular expression matching.
The NetworkRequestError class Represents a error that occured in.
std::shared_ptr< Request > _request
void mirrorReceived(MirrorControl::MirrorPick mirror) override
virtual void handleRequestProgress(NetworkRequest &req, off_t dltotal, off_t dlnow)
std::pair< std::vector< Url >::const_iterator, MirrorHandle > MirrorPick
const NetworkRequestError & error() const
std::optional< std::string > _chksumtype
virtual bool initializeRequest(std::shared_ptr< Request > &r)
std::shared_ptr< Mirror > MirrorHandle
void startWithMirror(MirrorControl::MirrorHandle mirror, const zypp::Url &url, const TransferSettings &set)
Url manipulation class.
Definition: Url.h:91