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() {
53 if ( !status.empty() &&
_ctx->repoInfo ().requireStatusWithMediaFile()) {
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 );
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()) );
155 return _ctx->repoInfo();
159 return _ctx->deltaDir();
162 DlContextRefType
_ctx;
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
expected< T, E > inspect(expected< T, E > exp, Function &&f)
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...
expected< Container< T >, E > collect(Container< expected< T, E >, CArgs... > &&in)
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
auto finishProgress(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.
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={})