25 using namespace zyppng::operators;
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)) );
84 using namespace zyppng::operators;
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()) );
116 | inspect( incProgress( _progressObserver ) )
117 | and_then( [
this] ( DlContextRefType && ) {
120 std::vector<zypp::OnMediaLocation> requiredFiles;
126 ZYPP_THROW(zypp::repo::RepoException( _ctx->repoInfo(),
"Repo can only require metadata files from primary medium."));
128 requiredFiles.push_back( file );
131 return makeReadyResult(expected<DlContextRefType>::error( std::current_exception() ) );
140 | inspect ( incProgress( _progressObserver ) );
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) );
149 } | finishProgress( _progressObserver );
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)
Track changing files or directories.
bool empty() const
Whether the status is empty (empty checksum)