libzypp  17.35.14
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>
19 #include <zypp/RepoManagerFlags.h>
20 #include <zypp/ng/repomanager.h>
23 
24 namespace zyppng {
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 
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 
75  zypp::Pathname targetDir() const;
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 
115  { setPluginRepoverification( std::nullopt ); }
116 
121  void setProbedType( zypp::repo::RepoType rType );
122  const std::optional<zypp::repo::RepoType> &probedType() const;
124 
125  private:
126  ZyppContextRefType _zyppContext;
127  RepoManagerRef<ContextRefType> _repoManager;
132  std::optional<PluginRepoverification> _pluginRepoverification;
133 
134  std::optional<zypp::repo::RepoType> _probedType;
136 
137  };
138 
143 
144 }
145 
146 
147 
148 #endif
RepoManagerRef< ContextRefType > _repoManager
Definition: refresh.h:127
Repository metadata verification beyond GPG.
zypp::Pathname targetDir() const
Definition: refresh.cc:75
ZYPP_FWD_DECL_TEMPL_TYPE_WITH_REFS_ARG1(RefreshContext, ZyppContextRefType)
void setPluginRepoverification(std::optional< PluginRepoverification > pluginRepoverification_r)
Definition: refresh.h:108
SignalProxy< void(zypp::repo::RepoType)> sigProbedTypeChanged()
Definition: refresh.cc:145
const ZyppContextRefType & zyppContext() const
Definition: refresh.cc:81
ZyppContextRefType ContextRefType
Definition: refresh.h:47
What is known about a repository.
Definition: RepoInfo.h:71
typename ProvideType::MediaHandle MediaHandle
Definition: refresh.h:50
std::optional< zypp::repo::RepoType > _probedType
Definition: refresh.h:134
const zypp::RepoInfo & repoInfo() const
Definition: refresh.cc:87
ZYPP_DECL_PRIVATE_CONSTR_ARGS(RefreshContext, ZyppContextRefType &&zyppContext, zypp::RepoInfo &&info, zypp::Pathname &&rawCachePath, zypp::filesystem::TmpDir &&tempDir, RepoManagerRef< ContextRefType > &&repoManager)
typename ZyppContextRefType::element_type ContextType
Definition: refresh.h:48
const zypp::RepoManagerOptions & repoManagerOptions() const
Definition: refresh.cc:105
zypp::RepoInfo _repoInfo
Definition: refresh.h:128
static expected< repo::RefreshContextRef< ZyppContextRefType > > create(ZyppContextRefType zyppContext, zypp::RepoInfo info, RepoManagerRef< ContextRefType > repoManager)
Definition: refresh.cc:28
Repo manager settings.
const zypp::Pathname & rawCachePath() const
Definition: refresh.cc:69
zypp::filesystem::TmpDir _tmpDir
Definition: refresh.h:130
std::optional< PluginRepoverification > _pluginRepoverification
Definition: refresh.h:132
ZYPP_FWD_DECL_TYPE_WITH_REFS(Context)
zypp::Pathname _rawCachePath
Definition: refresh.h:129
Provide a new empty temporary directory and recursively delete it when no longer needed.
Definition: TmpPath.h:181
RawMetadataRefreshPolicy policy() const
Definition: refresh.cc:111
ZYPP_FWD_DECL_REFS(SyncDownloadContext)
typename ContextType::ProvideType ProvideType
Definition: refresh.h:49
Signal< void(zypp::repo::RepoType)> _sigProbedTypeChanged
Definition: refresh.h:135
const std::optional< zypp::repo::RepoType > & probedType() const
Definition: refresh.cc:139
void setProbedType(zypp::repo::RepoType rType)
Definition: refresh.cc:129
repo::RawMetadataRefreshPolicy _policy
Definition: refresh.h:131
RefreshCheckStatus
Possibly return state of RepoManager::checkIfToRefreshMetadata function.
ZyppContextRefType _zyppContext
Definition: refresh.h:126
ZYPP_ENABLE_MAYBE_ASYNC_MIXIN((std::is_same_v< ZyppContextRefType, ContextRef >))
const RepoManagerRef< ZyppContextRefType > & repoManager() const
Definition: refresh.cc:99
void setPolicy(RawMetadataRefreshPolicy newPolicy)
Definition: refresh.cc:117
Repository type enumeration.
Definition: RepoType.h:28
const std::optional< PluginRepoverification > & pluginRepoverification() const
Definition: refresh.cc:123