libzypp 17.35.19
refresh.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#ifndef ZYPP_NG_REPO_REFRESH_INCLUDED
10#define ZYPP_NG_REPO_REFRESH_INCLUDED
11
12#include <zypp-core/zyppng/pipelines/AsyncResult>
13#include <zypp-core/zyppng/pipelines/Expected>
14#include <zypp-core/zyppng/base/Signals>
16
17#include <zypp/RepoInfo.h>
20#include <zypp/ng/repomanager.h>
23
24namespace zyppng {
26 ZYPP_FWD_DECL_TYPE_WITH_REFS( SyncContext );
27}
28
29namespace zyppng::repo {
30
32
35
42 template<typename ZyppContextRefType>
43 class RefreshContext : public Base, public MaybeAsyncMixin< std::is_same_v<ZyppContextRefType, ContextRef> > {
45 ZYPP_ENABLE_MAYBE_ASYNC_MIXIN( (std::is_same_v<ZyppContextRefType, ContextRef>) );
46 public:
47 using ContextRefType = ZyppContextRefType;
48 using ContextType = typename ZyppContextRefType::element_type;
49 using ProvideType = typename ContextType::ProvideType;
50 using MediaHandle = typename ProvideType::MediaHandle;
52
53 static expected<repo::RefreshContextRef<ZyppContextRefType>> create( ZyppContextRefType zyppContext, zypp::RepoInfo info, RepoManagerRef<ContextRefType> repoManager );
54 ZYPP_DECL_PRIVATE_CONSTR_ARGS(RefreshContext, ZyppContextRefType &&zyppContext, zypp::RepoInfo &&info, zypp::Pathname &&rawCachePath, zypp::filesystem::TmpDir &&tempDir, RepoManagerRef<ContextRefType> &&repoManager );
55
56 ~RefreshContext() override;
57
63 void saveToRawCache();
64
68 const zypp::Pathname &rawCachePath() const;
69
76
81 const ZyppContextRefType &zyppContext () const;
82
88 const zypp::RepoInfo &repoInfo () const;
90
94 const RepoManagerRef<ZyppContextRefType> &repoManager() const;
96
101 void setPolicy(RawMetadataRefreshPolicy newPolicy);
102
106 const std::optional<PluginRepoverification> &pluginRepoverification() const;
107
108 void setPluginRepoverification( std::optional<PluginRepoverification> pluginRepoverification_r )
109 { _pluginRepoverification = std::move(pluginRepoverification_r); }
110
116
122 const std::optional<zypp::repo::RepoType> &probedType() const;
124
125 private:
126 ZyppContextRefType _zyppContext;
127 RepoManagerRef<ContextRefType> _repoManager;
131 repo::RawMetadataRefreshPolicy _policy = RawMetadataRefreshPolicy::RefreshIfNeeded;
132 std::optional<PluginRepoverification> _pluginRepoverification;
133
134 std::optional<zypp::repo::RepoType> _probedType;
136
137 };
138
143
144}
145
146
147
148#endif
What is known about a repository.
Definition RepoInfo.h:72
Provide a new empty temporary directory and recursively delete it when no longer needed.
Definition TmpPath.h:182
Repository metadata verification beyond GPG.
ZYPP_DECL_PRIVATE_CONSTR_ARGS(RefreshContext, ZyppContextRefType &&zyppContext, zypp::RepoInfo &&info, zypp::Pathname &&rawCachePath, zypp::filesystem::TmpDir &&tempDir, RepoManagerRef< ContextRefType > &&repoManager)
zypp::RepoInfo _repoInfo
Definition refresh.h:128
typename ZyppContextRefType::element_type ContextType
Definition refresh.h:48
const zypp::RepoManagerOptions & repoManagerOptions() const
Definition refresh.cc:105
const RepoManagerRef< ZyppContextRefType > & repoManager() const
Definition refresh.cc:99
void setProbedType(zypp::repo::RepoType rType)
Definition refresh.cc:129
const std::optional< zypp::repo::RepoType > & probedType() const
Definition refresh.cc:139
zypp::Pathname targetDir() const
Definition refresh.cc:75
std::optional< PluginRepoverification > _pluginRepoverification
Definition refresh.h:132
std::optional< zypp::repo::RepoType > _probedType
Definition refresh.h:134
zypp::filesystem::TmpDir _tmpDir
Definition refresh.h:130
RawMetadataRefreshPolicy policy() const
Definition refresh.cc:111
ZYPP_ENABLE_MAYBE_ASYNC_MIXIN((std::is_same_v< ZyppContextRefType, ContextRef >))
typename ContextType::ProvideType ProvideType
Definition refresh.h:49
const std::optional< PluginRepoverification > & pluginRepoverification() const
Definition refresh.cc:123
static expected< repo::RefreshContextRef< ZyppContextRefType > > create(ZyppContextRefType zyppContext, zypp::RepoInfo info, RepoManagerRef< ContextRefType > repoManager)
Definition refresh.cc:28
void setPluginRepoverification(std::optional< PluginRepoverification > pluginRepoverification_r)
Definition refresh.h:108
void setPolicy(RawMetadataRefreshPolicy newPolicy)
Definition refresh.cc:117
const ZyppContextRefType & zyppContext() const
Definition refresh.cc:81
repo::RawMetadataRefreshPolicy _policy
Definition refresh.h:131
ZyppContextRefType _zyppContext
Definition refresh.h:126
const zypp::RepoInfo & repoInfo() const
Definition refresh.cc:87
RepoManagerRef< ContextRefType > _repoManager
Definition refresh.h:127
const zypp::Pathname & rawCachePath() const
Definition refresh.cc:69
Signal< void(zypp::repo::RepoType)> _sigProbedTypeChanged
Definition refresh.h:135
zypp::Pathname _rawCachePath
Definition refresh.h:129
SignalProxy< void(zypp::repo::RepoType)> sigProbedTypeChanged()
Definition refresh.cc:145
typename ProvideType::MediaHandle MediaHandle
Definition refresh.h:50
ZyppContextRefType ContextRefType
Definition refresh.h:47
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
Repo manager settings.
Repository type enumeration.
Definition RepoType.h:29
#define ZYPP_FWD_DECL_REFS(T)
Definition zyppglobal.h:119
#define ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1(T, TArg1)
Definition zyppglobal.h:130
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126