9#ifndef ZYPP_MEDIA_PROVIDE_H_INCLUDED
10#define ZYPP_MEDIA_PROVIDE_H_INCLUDED
16#include <zypp-core/zyppng/base/Base>
17#include <zypp-core/zyppng/async/AsyncOp>
20#include <zypp-media/ng/LazyMediaHandle>
21#include <zypp-media/ng/ProvideFwd>
22#include <zypp-media/ng/ProvideRes>
23#include <zypp-media/auth/AuthData>
24#include <boost/any.hpp>
48 using AnyMap = std::unordered_map<std::string, boost::any>;
62 std::shared_ptr<Provide>
parent()
const;
64 std::string
handle()
const;
67 const std::optional<zypp::Pathname> &
localPath()
const;
68 zyppng::AttachedMediaInfo_constPtr
mediaInfo()
const;
106 virtual void pulse ( );
108 const Stats &
stats()
const;
195 return [ providerRef=std::move(provider), targetPath = targetPath ](
ProvideRes &&file ){
197 return providerRef->copyFile( std::move(file), targetPath );
Store and operate with byte count.
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Pathname dirname() const
Return all but the last component od this path.
A ProvideRes object is a reference counted ownership of a resource in the cache provided by a Provide...
virtual void requestFailed(ProvideItem &item, uint32_t reqId, const std::exception_ptr &err, const AnyMap &requestData={})
virtual void provideDone()
virtual void requestDone(ProvideItem &item, uint32_t reqId, const AnyMap &extraData={})
virtual void itemStart(ProvideItem &item)
virtual void provideStart()
const Stats & stats() const
virtual void requestStart(ProvideItem &item, uint32_t reqId, const zypp::Url &url, const AnyMap &extraData={})
ProvideStatus(ProvideRef parent)
virtual void itemFailed(ProvideItem &item)
virtual void requestRedirect(ProvideItem &item, uint32_t reqId, const zypp::Url &toUrl, const AnyMap &extraData={})
virtual void itemDone(ProvideItem &item)
const zypp::media::CredManagerOptions & credManangerOptions() const
SignalProxy< std::optional< zypp::media::AuthData >(const zypp::Url &reqUrl, const std::string &triedUsername, const std::map< std::string, std::string > &extraValues) > sigAuthRequired()
static ProvideRef create(const zypp::Pathname &workDir="")
friend class ProvideMediaHandle
void setWorkerPath(const zypp::Pathname &path)
SignalProxy< void()> sigIdle()
expected< LazyMediaHandle > prepareMedia(const zypp::MirroredOrigin &origin, const ProvideMediaSpec &request)
void setCredManagerOptions(const zypp::media::CredManagerOptions &opt)
Provide(const zypp::Pathname &workDir)
AsyncOpRef< expected< zypp::CheckSum > > checksumForFile(const zypp::Pathname &p, const std::string &algorithm)
void setStatusTracker(ProvideStatusRef tracker)
AsyncOpRef< expected< MediaHandle > > attachMediaIfNeeded(LazyMediaHandle lazyHandle)
zyppng::LazyMediaHandle< Provide > LazyMediaHandle
friend class ProvidePromise
bool ejectDevice(const std::string &queueRef, const std::string &device)
AsyncOpRef< expected< MediaHandle > > attachMedia(const zypp::MirroredOrigin &origin, const ProvideMediaSpec &request)
AsyncOpRef< expected< zypp::ManagedFile > > copyFile(const zypp::Pathname &source, const zypp::Pathname &target)
SignalProxy< MediaChangeAction(const std::string &queueRef, const std::string &label, const int32_t mediaNr, const std::vector< std::string > &devices, const std::optional< std::string > &desc)> sigMediaChangeRequested()
std::optional< Action > MediaChangeAction
static auto copyResultToDest(ProvideRef provider, const zypp::Pathname &targetPath)
const zypp::Pathname & providerWorkdir() const
friend class ProvideStatus
ProvideMediaHandle MediaHandle
AsyncOpRef< expected< ProvideRes > > provide(const zypp::MirroredOrigin &origin, const ProvideFileSpec &request)
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
Easy-to use interface to the ZYPP dependency resolver.
AutoDispose< const Pathname > ManagedFile
A Pathname plus associated cleanup code to be executed when path is no longer needed.
std::shared_ptr< AsyncOp< T > > AsyncOpRef
std::unordered_map< std::string, boost::any > AnyMap
zypp::ByteCount _partialBytes
zypp::ByteCount _perSecondSinceLastPulse
zypp::ByteCount _perSecond
zypp::ByteCount _expectedBytes
std::chrono::steady_clock::time_point _startTime
zypp::ByteCount _finishedBytes
std::chrono::steady_clock::time_point _lastPulseTime
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
#define ZYPP_DECLARE_PRIVATE(Class)