10 #include <zypp-core/zyppng/ui/ProgressObserver> 11 #include <zypp-media/ng/ProvideSpec> 12 #include <zypp/ng/Context> 27 template<
class Executor,
class OpType>
28 struct StatusLogic :
public LogicBase<Executor, OpType>{
34 using ZyppContextType =
typename DlContextRefType::element_type::ContextType;
35 using ProvideType =
typename ZyppContextType::ProvideType;
36 using MediaHandle =
typename ProvideType::MediaHandle;
39 StatusLogic( DlContextRefType ctx, MediaHandle &&media )
40 :
_ctx(std::move(ctx))
44 MaybeAsyncRef<expected<zypp::RepoStatus>> execute() {
46 | [
this]( expected<ProvideRes> repomdFile ) {
53 if ( !status.empty() &&
_ctx->repoInfo ().requireStatusWithMediaFile()) {
55 | [status = std::move(status)]( expected<ProvideRes> mediaFile )
mutable {
57 return make_expected_success( status &&
zypp::RepoStatus( mediaFile->file()) );
59 return make_expected_success( std::move(status) );
62 return makeReadyResult( make_expected_success(std::move(status)) );
86 template<
class Executor,
class OpType>
93 using ZyppContextType =
typename DlContextRefType::element_type::ContextType;
94 using ProvideType =
typename ZyppContextType::ProvideType;
95 using MediaHandle =
typename ProvideType::MediaHandle;
98 DlLogic( DlContextRefType ctx, MediaHandle &&mediaHandle, ProgressObserverRef &&progressObserver )
99 :
zypp::repo::yum::RepomdFileCollector( ctx->destDir() )
108 | [
this]( expected<zypp::ManagedFile> &&mediaInfo ) {
111 if ( mediaInfo )
_ctx->files().push_back ( std::move(mediaInfo.get()) );
117 | and_then( [
this] ( DlContextRefType && ) {
120 std::vector<zypp::OnMediaLocation> requiredFiles;
128 requiredFiles.push_back( file );
131 return makeReadyResult(expected<DlContextRefType>::error( std::current_exception() ) );
142 }) | and_then ( [
this]( std::vector<zypp::ManagedFile> &&dlFiles ) {
143 auto &downloadedFiles =
_ctx->files();
144 downloadedFiles.insert( downloadedFiles.end(), std::make_move_iterator(dlFiles.begin()), std::make_move_iterator(dlFiles.end()) );
145 return expected<DlContextRefType>::success( std::move(
_ctx) );
155 return _ctx->repoInfo();
159 return _ctx->deltaDir();
162 DlContextRefType
_ctx;
168 AsyncOpRef<expected<repo::AsyncDownloadContextRef> >
download(repo::AsyncDownloadContextRef dl,
ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
173 expected<repo::SyncDownloadContextRef>
download(repo::SyncDownloadContextRef dl,
SyncMediaHandle mediaHandle, ProgressObserverRef progressObserver)
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
A ProvideRes object is a reference counted ownership of a resource in the cache provided by a Provide...
Helper filtering the files offered by a RepomdFileReader.
What is known about a repository.
AsyncOpRef< expected< zypp::ManagedFile > > provideToCacheDir(AsyncCacheProviderContextRef cacheContext, ProvideMediaHandle medium, zypp::Pathname file, ProvideFileSpec filespec)
#define ZYPP_ENABLE_LOGIC_BASE(Executor, OpType)
AsyncOpRef< expected< repo::AsyncDownloadContextRef > > downloadMasterIndex(repo::AsyncDownloadContextRef dl, ProvideMediaHandle mediaHandle, zypp::filesystem::Pathname masterIndex_r)
typename conditional< B, T, F >::type conditional_t
Downloader workspace for YUM (rpm-nmd) repositories Encapsulates all the knowledge of which files hav...
Reads through a repomd.xml file and collects type, location, checksum and other data about metadata f...
Exception for repository handling.
AsyncOpRef< expected< zypp::RepoStatus > > repoStatus(repo::AsyncDownloadContextRef dl, ProvideMediaHandle mediaHandle)
ProgressObserverRef _progressObserver
Interface of repomd.xml file reader.
AsyncOpRef< expected< repo::AsyncDownloadContextRef > > download(repo::AsyncDownloadContextRef dl, ProvideMediaHandle mediaHandle, ProgressObserverRef progressObserver)
Track changing files or directories.
Easy-to use interface to the ZYPP dependency resolver.
auto downloadMediaInfo(MediaHandle &&mediaHandle, const zypp::filesystem::Pathname &destdir)