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> 29 struct CredManagerOptions;
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 );
SignalProxy< void()> sigIdle()
const zypp::Pathname & providerWorkdir() const
zypp::ByteCount _finishedBytes
int assert_dir(const Pathname &path, unsigned mode)
Like 'mkdir -p'.
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)
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)
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={})
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
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
virtual void provideStart()
zypp::ByteCount _partialBytes
Provide(const zypp::Pathname &workDir)
std::shared_ptr< AsyncOp< T > > AsyncOpRef
#define ZYPP_DECLARE_PRIVATE(Class)
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)
expected< LazyMediaHandle > prepareMedia(const zypp::MirroredOrigin &origin, const ProvideMediaSpec &request)
constexpr std::string_view device("device")
std::unordered_map< std::string, boost::any > AnyMap
AsyncOpRef< expected< MediaHandle > > attachMedia(const zypp::MirroredOrigin &origin, const ProvideMediaSpec &request)
Easy-to use interface to the ZYPP dependency resolver.
AsyncOpRef< expected< ProvideRes > > provide(const zypp::MirroredOrigin &origin, const ProvideFileSpec &request)
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()