libzypp  17.31.31
preparemulti_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_PREPAREMULTI_P_H_INCLUDED
15 #define ZYPP_CURL_NG_NETWORK_PRIVATE_DOWNLOADERSTATES_PREPAREMULTI_P_H_INCLUDED
16 
17 #include "base_p.h"
18 #include <zypp-core/zyppng/base/statemachine.h>
19 
20 #include <zypp-curl/parser/MediaBlockList>
21 
22 namespace zyppng {
23 
24  struct DlNormalFileState;
25  struct DlMetalinkState;
26  struct FinishedState;
27 
28 #if ENABLE_ZCHUNK_COMPRESSION
29  struct DLZckHeadState;
30 #endif
31 
37  struct PrepareMultiState : public zyppng::SimpleState< DownloadPrivate, Download::PrepareMulti, false > {
38 
40 
41  enum Mode {
44  };
45 
46  PrepareMultiState ( std::shared_ptr<Request> oldReq, Mode m, DownloadPrivate &parent );
47 
48  void enter ();
49  void exit ();
50 
51  const NetworkRequestError &error () const {
52  return _error;
53  }
54 
55  SignalProxy< void () > sigFinished() {
56  return _sigFinished;
57  }
58  SignalProxy< void () > sigFailed() {
59  return _sigFailed;
60  }
61  SignalProxy< void () > sigFallback() {
62  return _sigFallback;
63  }
64 
65  std::shared_ptr<DlNormalFileState> fallbackToNormalTransition ();
66  std::shared_ptr<DlMetalinkState> transitionToMetalinkDl ();
67  std::shared_ptr<FinishedState> transitionToFinished ();
68 #if ENABLE_ZCHUNK_COMPRESSION
69  std::shared_ptr<DLZckHeadState> transitionToZckHeadDl ();
70  bool toZckHeadDownloadGuard () const;
71 #endif
72 
73  bool toMetalinkDownloadGuard () const;
74 
75  std::vector<Url> _mirrors;
77 
78  private:
79  sigc::connection _mirrorControlReadyConn;
80 
81  void onMirrorsReady ();
82 #if ENABLE_ZCHUNK_COMPRESSION
83  bool _haveZckData = false; //< do we have zck data ready
84 #endif
85  Mode _mode; //< wether we should expect a metalink or zsync file
86  std::shared_ptr<Request> _oldRequest; //< exising request of previous states, that the next states might reuse
88  Signal< void () > _sigFinished;
89  Signal< void () > _sigFallback;
90  Signal< void () > _sigFailed;
91  };
92 
93 }
94 
95 #endif
std::shared_ptr< DlMetalinkState > transitionToMetalinkDl()
Signal< void() > _sigFailed
sigc::connection _mirrorControlReadyConn
const NetworkRequestError & error() const
zypp::media::MediaBlockList _blockList
NetworkRequestError _error
std::shared_ptr< Request > _oldRequest
PrepareMultiState(std::shared_ptr< Request > oldReq, Mode m, DownloadPrivate &parent)
The NetworkRequestError class Represents a error that occured in.
Signal< void() > _sigFallback
std::vector< Url > _mirrors
Signal< void() > _sigFinished
SignalProxy< void() > sigFallback()
SignalProxy< void() > sigFailed()
SignalProxy< void() > sigFinished()
std::shared_ptr< DlNormalFileState > fallbackToNormalTransition()
bool toMetalinkDownloadGuard() const
std::shared_ptr< FinishedState > transitionToFinished()