9 #ifndef ZYPP_MEDIA_PROVIDE_H_INCLUDED 10 #define ZYPP_MEDIA_PROVIDE_H_INCLUDED 15 #include <zypp-core/zyppng/base/Base> 16 #include <zypp-core/zyppng/async/AsyncOp> 19 #include <zypp-media/ng/LazyMediaHandle> 20 #include <zypp-media/ng/ProvideFwd> 21 #include <zypp-media/ng/ProvideRes> 22 #include <zypp-media/auth/AuthData> 23 #include <boost/any.hpp> 28 struct CredManagerOptions;
45 using AnyMap = std::unordered_map<std::string, boost::any>;
59 std::shared_ptr<Provide>
parent()
const;
61 std::string
handle()
const;
63 const std::optional<zypp::Pathname> &
localPath()
const;
64 zyppng::AttachedMediaInfo_constPtr
mediaInfo()
const;
102 virtual void pulse ( );
104 const Stats &
stats()
const;
191 return [ providerRef=std::move(provider), targetPath = targetPath ](
ProvideRes &&file ){
193 return providerRef->copyFile( std::move(file), targetPath );
SignalProxy< void()> sigIdle()
const zypp::Pathname & providerWorkdir() const
zypp::ByteCount _finishedBytes
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
AsyncOpRef< expected< ProvideRes > > provide(const std::vector< zypp::Url > &urls, const ProvideFileSpec &request)
const zypp::media::CredManagerOptions & credManangerOptions() const
ProvideStatus(ProvideRef parent)
virtual void requestDone(ProvideItem &item, uint32_t reqId, const AnyMap &extraData={})
Store and operate with byte count.
A ProvideRes object is a reference counted ownership of a resource in the cache provided by a Provide...
virtual void itemStart(ProvideItem &item)
AsyncOpRef< expected< zypp::CheckSum > > checksumForFile(const zypp::Pathname &p, const std::string &algorithm)
ZYPP_DECLARE_PRIVATE(Provide)
virtual void itemFailed(ProvideItem &item)
virtual void requestFailed(ProvideItem &item, uint32_t reqId, const std::exception_ptr &err, const AnyMap &requestData={})
DEFINE_PTR_TYPE(AttachedSyncMediaInfo)
virtual void provideDone()
static ProvideRef create(const zypp::Pathname &workDir="")
zypp::ByteCount _perSecond
std::chrono::steady_clock::time_point _lastPulseTime
void setCredManagerOptions(const zypp::media::CredManagerOptions &opt)
expected< LazyMediaHandle > prepareMedia(const std::vector< zypp::Url > &urls, const ProvideMediaSpec &request)
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()
virtual void requestRedirect(ProvideItem &item, uint32_t reqId, const zypp::Url &toUrl, const AnyMap &extraData={})
zypp::ByteCount _expectedBytes
virtual void itemDone(ProvideItem &item)
Pathname dirname() const
Return all but the last component od this path.
bool ejectDevice(const std::string &queueRef, const std::string &device)
void setWorkerPath(const zypp::Pathname &path)
std::optional< Action > MediaChangeAction
friend class ProvideMediaHandle
virtual void provideStart()
zypp::ByteCount _partialBytes
Provide(const zypp::Pathname &workDir)
std::shared_ptr< AsyncOp< T > > AsyncOpRef
AsyncOpRef< expected< MediaHandle > > attachMedia(const std::vector< zypp::Url > &urls, const ProvideMediaSpec &request)
zypp::ByteCount _perSecondSinceLastPulse
void setStatusTracker(ProvideStatusRef tracker)
std::chrono::steady_clock::time_point _startTime
const Stats & stats() const
AsyncOpRef< expected< zypp::ManagedFile > > copyFile(const zypp::Pathname &source, const zypp::Pathname &target)
constexpr std::string_view device("device")
std::unordered_map< std::string, boost::any > AnyMap
Easy-to use interface to the ZYPP dependency resolver.
static auto copyResultToDest(ProvideRef provider, const zypp::Pathname &targetPath)
AsyncOpRef< expected< MediaHandle > > attachMediaIfNeeded(LazyMediaHandle lazyHandle)
virtual void requestStart(ProvideItem &item, uint32_t reqId, const zypp::Url &url, const AnyMap &extraData={})
SignalProxy< std::optional< zypp::media::AuthData > const zypp::Url &reqUrl, const std::string &triedUsername, const std::map< std::string, std::string > &extraValues) > sigAuthRequired()