10 #include <zypp-core/zyppng/ui/ProgressObserver> 11 #include <zypp-media/ng/ProvideSpec> 12 #include <zypp/ng/Context> 21 #undef ZYPP_BASE_LOGGER_LOGGROUP 22 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::repomanager" 30 template<
class Executor,
class OpType>
31 struct StatusLogic :
public LogicBase<Executor, OpType>{
37 using ZyppContextType =
typename DlContextRefType::element_type::ContextType;
38 using ProvideType =
typename ZyppContextType::ProvideType;
39 using MediaHandle =
typename ProvideType::MediaHandle;
42 StatusLogic( DlContextRefType ctx, MediaHandle &&media )
43 :
_ctx(std::move(ctx))
47 MaybeAsyncRef<expected<zypp::RepoStatus>> execute() {
56 if ( !status.empty() &&
_ctx->repoInfo ().requireStatusWithMediaFile()) {
89 template<
class Executor,
class OpType>
96 using ZyppContextType =
typename DlContextRefType::element_type::ContextType;
97 using ProvideType =
typename ZyppContextType::ProvideType;
98 using MediaHandle =
typename ProvideType::MediaHandle;
101 DlLogic( DlContextRefType ctx, MediaHandle &&mediaHandle, ProgressObserverRef &&progressObserver )
102 :
zypp::repo::yum::RepomdFileCollector( ctx->destDir() )
111 | [
this]( expected<zypp::ManagedFile> &&mediaInfo ) {
114 if ( mediaInfo )
_ctx->files().push_back ( std::move(mediaInfo.get()) );
120 |
and_then( [
this] ( DlContextRefType && ) {
123 std::vector<zypp::OnMediaLocation> requiredFiles;
131 requiredFiles.push_back( file );
145 }) |
and_then ( [
this]( std::vector<zypp::ManagedFile> &&dlFiles ) {
146 auto &downloadedFiles =
_ctx->files();
147 downloadedFiles.insert( downloadedFiles.end(), std::make_move_iterator(dlFiles.begin()), std::make_move_iterator(dlFiles.end()) );
158 return _ctx->repoInfo();
162 return _ctx->deltaDir();
165 DlContextRefType
_ctx;
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
std::enable_if_t<!std::is_same_v< void, T >, expected< Container< T >, E > > collect(Container< expected< T, E >, CArgs... > &&in)
expected< T, E > inspect(expected< T, E > exp, Function &&f)
auto finishProgress(ProgressObserverRef progressObserver, ProgressObserver::FinishResult result=ProgressObserver::Success)
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.
static expected< std::decay_t< Type >, Err > make_expected_success(Type &&t)
auto transform_collect(Container< Msg, CArgs... > &&in, Transformation &&f)
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
std::conditional_t< isAsync, AsyncOpRef< T >, T > makeReadyResult(T &&result)
Downloader workspace for YUM (rpm-nmd) repositories Encapsulates all the knowledge of which files hav...
static expected success(ConsParams &&...params)
std::shared_ptr< AsyncOp< T > > AsyncOpRef
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)
ResultType and_then(const expected< T, E > &exp, Function &&f)
Track changing files or directories.
#define ZYPP_FWD_CURRENT_EXCPT()
Drops a logline and returns the current Exception as a std::exception_ptr.
Easy-to use interface to the ZYPP dependency resolver.
auto downloadMediaInfo(MediaHandle &&mediaHandle, const zypp::filesystem::Pathname &destdir)
auto incProgress(ProgressObserverRef progressObserver, double progrIncrease=1.0, std::optional< std::string > newStr={})