libzypp 17.37.10

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>
15#include <zypp-core/fs/TmpPath.h>
16
17#include <zypp/RepoInfo.h>
18#include <zypp/RepoManagerOptions.h>
19#include <zypp/RepoManagerFlags.h>
20#include <zypp/ng/repomanager.h>
21#include <zypp/repo/PluginRepoverification.h>
22#include <zypp/ng/workflows/logichelpers.h>
23
24 namespace zyppng {
25 ZYPP_FWD_DECL_TYPE_WITH_REFS( Context );
26 ZYPP_FWD_DECL_TYPE_WITH_REFS( SyncContext );
27}
28
29 namespace zyppng::repo {
30
31 ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1 (RefreshContext, ZyppContextRefType);
32
33 using RawMetadataRefreshPolicy = zypp::RepoManagerFlags::RawMetadataRefreshPolicy;
34 using RefreshCheckStatus = zypp::RepoManagerFlags::RefreshCheckStatus;
35
42 template<typename ZyppContextRefType>
43 class RefreshContext : public Base, public MaybeAsyncMixin< std::is_same_v<ZyppContextRefType, ContextRef> > {
44 ZYPP_ADD_PRIVATE_CONSTR_HELPER();
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;
51 using PluginRepoverification = zypp_private::repo::PluginRepoverification;
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
75 zypp::Pathname targetDir() const;
76
81 const ZyppContextRefType &zyppContext () const;
82
88 const zypp::RepoInfo &repoInfo () const;
89 zypp::RepoInfo &repoInfo ();
90
94 const RepoManagerRef<ZyppContextRefType> &repoManager() const;
95 const zypp::RepoManagerOptions &repoManagerOptions() const;
96
100 RawMetadataRefreshPolicy policy() const;
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
114 void setNoPluginRepoverification()
115 { setPluginRepoverification( std::nullopt ); }
116
121 void setProbedType( zypp::repo::RepoType rType );
122 const std::optional<zypp::repo::RepoType> &probedType() const;
123 SignalProxy<void(zypp::repo::RepoType)> sigProbedTypeChanged();
124
125 private:
126 ZyppContextRefType _zyppContext;
127 RepoManagerRef<ContextRefType> _repoManager;
128 zypp::RepoInfo _repoInfo;
129 zypp::Pathname _rawCachePath;
130 zypp::filesystem::TmpDir _tmpDir;
131 repo::RawMetadataRefreshPolicy _policy = RawMetadataRefreshPolicy::RefreshIfNeeded;
132 std::optional<PluginRepoverification> _pluginRepoverification;
133
134 std::optional<zypp::repo::RepoType> _probedType;
135 Signal<void(zypp::repo::RepoType)> _sigProbedTypeChanged;
136
137 };
138
139 using SyncRefreshContext = RefreshContext<SyncContextRef>;
140 using AsyncRefreshContext = RefreshContext<ContextRef>;
141 ZYPP_FWD_DECL_REFS(SyncRefreshContext);
142 ZYPP_FWD_DECL_REFS(AsyncRefreshContext);
143
144}
145
146
147
148#endif
PluginRepoverification.h
RepoInfo.h
RepoManagerFlags.h
RepoManagerOptions.h
zypp::RepoInfo
What is known about a repository.
Definition RepoInfo.h:72
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
zypp::filesystem::TmpDir
Provide a new empty temporary directory and recursively delete it when no longer needed.
Definition TmpPath.h:188
zypp_private::repo::PluginRepoverification
Repository metadata verification beyond GPG.
Definition PluginRepoverification.h:53
zyppng::Base::Base
Base()
Definition base.cc:20
zyppng::Context
Definition context.h:39
zyppng::SignalProxy
Definition signals.h:325
zyppng::Signal
Definition signals.h:151
zyppng::SyncContext
Definition contextfacade.h:27
zyppng::expected
Definition expected.h:27
zyppng::repo::RefreshContext
Definition refresh.h:43
zyppng::repo::RefreshContext::ZYPP_DECL_PRIVATE_CONSTR_ARGS
ZYPP_DECL_PRIVATE_CONSTR_ARGS(RefreshContext, ZyppContextRefType &&zyppContext, zypp::RepoInfo &&info, zypp::Pathname &&rawCachePath, zypp::filesystem::TmpDir &&tempDir, RepoManagerRef< ContextRefType > &&repoManager)
zyppng::repo::RefreshContext< SyncContextRef >::_repoInfo
zypp::RepoInfo _repoInfo
Definition refresh.h:128
zyppng::repo::RefreshContext::ContextType
typename ZyppContextRefType::element_type ContextType
Definition refresh.h:48
zyppng::repo::RefreshContext::repoManagerOptions
const zypp::RepoManagerOptions & repoManagerOptions() const
Definition refresh.cc:118
zyppng::repo::RefreshContext::~RefreshContext
~RefreshContext() override
Definition refresh.cc:61
zyppng::repo::RefreshContext< SyncContextRef >::repoManager
const RepoManagerRef< SyncContextRef > & repoManager() const
zyppng::repo::RefreshContext::setProbedType
void setProbedType(zypp::repo::RepoType rType)
Definition refresh.cc:142
zyppng::repo::RefreshContext::probedType
const std::optional< zypp::repo::RepoType > & probedType() const
Definition refresh.cc:152
zyppng::repo::RefreshContext::targetDir
zypp::Pathname targetDir() const
Definition refresh.cc:88
zyppng::repo::RefreshContext< SyncContextRef >::_pluginRepoverification
std::optional< PluginRepoverification > _pluginRepoverification
Definition refresh.h:132
zyppng::repo::RefreshContext< SyncContextRef >::_probedType
std::optional< zypp::repo::RepoType > _probedType
Definition refresh.h:134
zyppng::repo::RefreshContext< SyncContextRef >::_tmpDir
zypp::filesystem::TmpDir _tmpDir
Definition refresh.h:130
zyppng::repo::RefreshContext::policy
RawMetadataRefreshPolicy policy() const
Definition refresh.cc:124
zyppng::repo::RefreshContext::ZYPP_ENABLE_MAYBE_ASYNC_MIXIN
ZYPP_ENABLE_MAYBE_ASYNC_MIXIN((std::is_same_v< ZyppContextRefType, ContextRef >))
zyppng::repo::RefreshContext::ProvideType
typename ContextType::ProvideType ProvideType
Definition refresh.h:49
zyppng::repo::RefreshContext::pluginRepoverification
const std::optional< PluginRepoverification > & pluginRepoverification() const
Definition refresh.cc:136
zyppng::repo::RefreshContext::create
static expected< repo::RefreshContextRef< ZyppContextRefType > > create(ZyppContextRefType zyppContext, zypp::RepoInfo info, RepoManagerRef< ContextRefType > repoManager)
Definition refresh.cc:32
zyppng::repo::RefreshContext::saveToRawCache
void saveToRawCache()
Definition refresh.cc:67
zyppng::repo::RefreshContext::ZYPP_ADD_PRIVATE_CONSTR_HELPER
ZYPP_ADD_PRIVATE_CONSTR_HELPER()
zyppng::repo::RefreshContext::setPluginRepoverification
void setPluginRepoverification(std::optional< PluginRepoverification > pluginRepoverification_r)
Definition refresh.h:108
zyppng::repo::RefreshContext::setPolicy
void setPolicy(RawMetadataRefreshPolicy newPolicy)
Definition refresh.cc:130
zyppng::repo::RefreshContext< SyncContextRef >::zyppContext
const SyncContextRef & zyppContext() const
zyppng::repo::RefreshContext< SyncContextRef >::_policy
repo::RawMetadataRefreshPolicy _policy
Definition refresh.h:131
zyppng::repo::RefreshContext< SyncContextRef >::_zyppContext
SyncContextRef _zyppContext
Definition refresh.h:126
zyppng::repo::RefreshContext::repoInfo
const zypp::RepoInfo & repoInfo() const
Definition refresh.cc:100
zyppng::repo::RefreshContext< SyncContextRef >::_repoManager
RepoManagerRef< ContextRefType > _repoManager
Definition refresh.h:127
zyppng::repo::RefreshContext< SyncContextRef >::rawCachePath
const zypp::Pathname & rawCachePath() const
zyppng::repo::RefreshContext::PluginRepoverification
zypp_private::repo::PluginRepoverification PluginRepoverification
Definition refresh.h:51
zyppng::repo::RefreshContext< SyncContextRef >::_sigProbedTypeChanged
Signal< void(zypp::repo::RepoType)> _sigProbedTypeChanged
Definition refresh.h:135
zyppng::repo::RefreshContext::setNoPluginRepoverification
void setNoPluginRepoverification()
Definition refresh.h:114
zyppng::repo::RefreshContext::repoInfo
zypp::RepoInfo & repoInfo()
Definition refresh.cc:106
zyppng::repo::RefreshContext< SyncContextRef >::_rawCachePath
zypp::Pathname _rawCachePath
Definition refresh.h:129
zyppng::repo::RefreshContext::sigProbedTypeChanged
SignalProxy< void(zypp::repo::RepoType)> sigProbedTypeChanged()
Definition refresh.cc:158
zyppng::repo::RefreshContext::MediaHandle
typename ProvideType::MediaHandle MediaHandle
Definition refresh.h:50
zyppng::repo::RefreshContext::ContextRefType
ZyppContextRefType ContextRefType
Definition refresh.h:47
logichelpers.h
zypp::RepoManagerFlags::RefreshCheckStatus
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
Definition RepoManagerFlags.h:47
zypp::RepoManagerFlags::RawMetadataRefreshPolicy
RawMetadataRefreshPolicy
Definition RepoManagerFlags.h:21
zyppng::repo
Definition downloader.cc:25
zyppng::repo::AsyncRefreshContext
RefreshContext< ContextRef > AsyncRefreshContext
Definition refresh.h:140
zyppng::repo::SyncRefreshContext
RefreshContext< SyncContextRef > SyncRefreshContext
Definition refresh.h:139
zyppng::repo::RefreshCheckStatus
zypp::RepoManagerFlags::RefreshCheckStatus RefreshCheckStatus
Definition refresh.h:34
zyppng::repo::RawMetadataRefreshPolicy
zypp::RepoManagerFlags::RawMetadataRefreshPolicy RawMetadataRefreshPolicy
Definition refresh.h:33
zyppng
Definition MediaNetworkRequestExecutor.h:16
repomanager.h
zypp::RepoManagerOptions
Repo manager settings.
Definition RepoManagerOptions.h:26
zypp::repo::RepoType
Repository type enumeration.
Definition RepoType.h:29
zyppng::MaybeAsyncMixin
Definition logichelpers.h:36
TmpPath.h
ZYPP_FWD_DECL_REFS
#define ZYPP_FWD_DECL_REFS(T)
Definition zyppglobal.h:119
ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1
#define ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1(T, TArg1)
Definition zyppglobal.h:130
ZYPP_FWD_DECL_TYPE_WITH_REFS
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)
Definition zyppglobal.h:126