libzypp: zypp/ng/workflows/downloadwf.h Source File

libzypp 17.36.6

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
16namespace zyppng {
17
18 ZYPP_FWD_DECL_TYPE_WITH_REFS (Context);
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:
30 ZYPP_ADD_PRIVATE_CONSTR_HELPER();
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
37 ZYPP_DECL_PRIVATE_CONSTR_ARGS(CacheProviderContext, ZyppContextRefType zyppContext, zypp::Pathname destDir );
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:
47 ContextRefType _zyppContext;
48 zypp::Pathname _destDir;
49 std::vector<zypp::Pathname> _cacheDirs;
50 };
51
52 using AsyncCacheProviderContext = CacheProviderContext<ContextRef>;
53 using SyncCacheProviderContext = CacheProviderContext<SyncContextRef>;
54 ZYPP_FWD_DECL_REFS(AsyncCacheProviderContext);
55 ZYPP_FWD_DECL_REFS(SyncCacheProviderContext);
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
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
zyppng::Base::Base
Base()
Definition base.cc:20
zyppng::CacheProviderContext
Definition downloadwf.h:28
zyppng::CacheProviderContext< ContextRef >::destDir
const zypp::Pathname & destDir() const
zyppng::CacheProviderContext::ProvideType
typename ContextType::ProvideType ProvideType
Definition downloadwf.h:34
zyppng::CacheProviderContext::ZYPP_DECL_PRIVATE_CONSTR_ARGS
ZYPP_DECL_PRIVATE_CONSTR_ARGS(CacheProviderContext, ZyppContextRefType zyppContext, zypp::Pathname destDir)
zyppng::CacheProviderContext< ContextRef >::zyppContext
const ContextRefType & zyppContext() const
zyppng::CacheProviderContext::ZYPP_ADD_PRIVATE_CONSTR_HELPER
ZYPP_ADD_PRIVATE_CONSTR_HELPER()
zyppng::CacheProviderContext::MediaHandle
typename ProvideType::MediaHandle MediaHandle
Definition downloadwf.h:35
zyppng::CacheProviderContext< ContextRef >::_zyppContext
ContextRefType _zyppContext
Definition downloadwf.h:47
zyppng::CacheProviderContext< ContextRef >::_cacheDirs
std::vector< zypp::Pathname > _cacheDirs
Definition downloadwf.h:49
zyppng::CacheProviderContext::ContextType
typename ZyppContextRefType::element_type ContextType
Definition downloadwf.h:33
zyppng::CacheProviderContext< ContextRef >::_destDir
zypp::Pathname _destDir
Definition downloadwf.h:48
zyppng::CacheProviderContext::ContextRefType
ZyppContextRefType ContextRefType
Definition downloadwf.h:32
zyppng::CacheProviderContext::addCacheDir
void addCacheDir(const zypp::Pathname &p)
Definition downloadwf.cc:48
zyppng::CacheProviderContext::cacheDirs
const std::vector< zypp::Pathname > & cacheDirs() const
Definition downloadwf.cc:54
zyppng::Context
Definition context.h:39
zyppng::ProgressObserver
Definition progressobserver.h:28
zyppng::ProvideFileSpec
Definition providespec.h:92
zyppng::ProvideMediaHandle
Definition provide.h:52
zyppng::SyncContext
Definition contextfacade.h:27
zyppng::SyncMediaHandle
Definition mediafacade.h:26
zyppng::expected
Definition expected.h:27
zyppng::DownloadWorkflow
Definition downloadwf.cc:207
zyppng::DownloadWorkflow::provideToCacheDir
AsyncOpRef< expected< zypp::ManagedFile > > provideToCacheDir(AsyncCacheProviderContextRef cacheContext, ProvideMediaHandle medium, zypp::Pathname file, ProvideFileSpec filespec)
Definition downloadwf.cc:209
zyppng
Definition MediaCurl2.h:22
zyppng::AsyncOpRef
std::shared_ptr< AsyncOp< T > > AsyncOpRef
Definition asyncop.h:255
zyppng::SyncCacheProviderContext
CacheProviderContext< SyncContextRef > SyncCacheProviderContext
Definition downloadwf.h:53
zyppng::AsyncCacheProviderContext
CacheProviderContext< ContextRef > AsyncCacheProviderContext
Definition downloadwf.h:52
ManagedFile.h
ZYPP_FWD_DECL_REFS
#define ZYPP_FWD_DECL_REFS(T)
Definition zyppglobal.h:119
ZYPP_FWD_DECL_TYPE_WITH_REFS
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126