libzypp  17.34.1
downloadwf.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
9 #ifndef ZYPP_NG_WORKFLOWS_DOWNLOAD_INCLUDED
10 #define ZYPP_NG_WORKFLOWS_DOWNLOAD_INCLUDED
11 
12 #include <zypp-core/zyppng/pipelines/AsyncResult>
13 #include <zypp-core/zyppng/pipelines/Expected>
14 #include <zypp-core/ManagedFile.h>
15 
16 namespace zyppng {
17 
19  ZYPP_FWD_DECL_TYPE_WITH_REFS (SyncContext);
20  ZYPP_FWD_DECL_TYPE_WITH_REFS (ProgressObserver);
21 
22  class ProvideMediaHandle;
23  class SyncMediaHandle;
24  class ProvideFileSpec;
25 
26  template<typename ZyppContextRefType>
27  class CacheProviderContext : public Base
28  {
29  protected:
31  public:
32  using ContextRefType = ZyppContextRefType;
33  using ContextType = typename ZyppContextRefType::element_type;
34  using ProvideType = typename ContextType::ProvideType;
35  using MediaHandle = typename ProvideType::MediaHandle;
36 
38 
39  const ContextRefType &zyppContext() const;
40  const zypp::Pathname &destDir() const;
41 
42  void addCacheDir( const zypp::Pathname &p );
43  const std::vector<zypp::Pathname> &cacheDirs() const;
44 
45 
46  protected:
49  std::vector<zypp::Pathname> _cacheDirs;
50  };
51 
56 
57  namespace DownloadWorkflow {
58  AsyncOpRef<expected<zypp::ManagedFile>> provideToCacheDir( AsyncCacheProviderContextRef cacheContext, ProvideMediaHandle medium, zypp::Pathname file, ProvideFileSpec filespec );
59  expected<zypp::ManagedFile> provideToCacheDir( SyncCacheProviderContextRef cacheContext, SyncMediaHandle medium, zypp::Pathname file, ProvideFileSpec filespec );
60  }
61 
62 }
63 
64 
65 #endif // ZYPP_NG_WORKFLOWS_DOWNLOAD_INCLUDED
void addCacheDir(const zypp::Pathname &p)
Definition: downloadwf.cc:48
const std::vector< zypp::Pathname > & cacheDirs() const
Definition: downloadwf.cc:54
const zypp::Pathname & destDir() const
Definition: downloadwf.cc:42
typename ContextRefType ::element_type ContextType
Definition: downloadwf.h:33
typename ProvideType::MediaHandle MediaHandle
Definition: downloadwf.h:35
ZYPP_FWD_DECL_TYPE_WITH_REFS(Context)
const ContextRefType & zyppContext() const
Definition: downloadwf.cc:35
AsyncOpRef< expected< zypp::ManagedFile > > provideToCacheDir(AsyncCacheProviderContextRef cacheContext, ProvideMediaHandle medium, zypp::Pathname file, ProvideFileSpec filespec)
Definition: downloadwf.cc:209
std::shared_ptr< AsyncOp< T > > AsyncOpRef
Definition: asyncop.h:255
ZYPP_FWD_DECL_REFS(AsyncCacheProviderContext)
typename ContextType::ProvideType ProvideType
Definition: downloadwf.h:34
std::vector< zypp::Pathname > _cacheDirs
Definition: downloadwf.h:49
ZyppContextRefType ContextRefType
Definition: downloadwf.h:32
ContextRefType _zyppContext
Definition: downloadwf.h:47
ZYPP_DECL_PRIVATE_CONSTR_ARGS(CacheProviderContext, ZyppContextRefType zyppContext, zypp::Pathname destDir)