11 #include <zypp-media/ng/MediaVerifier> 14 #undef ZYPP_BASE_LOGGER_LOGGROUP 15 #define ZYPP_BASE_LOGGER_LOGGROUP "MountingWorker" 32 return _driver->initialize(conf);
43 auto req = queue.front();
46 MIL_PRV <<
"Received provide: " << req->_spec.code() << std::endl;
49 switch ( req->_spec.code () ) {
56 for (
const auto &i : req->_spec.headers() ) {
61 vals.
set( i.first, i.second );
64 const auto &res =
_driver->mountDevice( req->_spec.requestId(), attachUrl, attachId, label, vals );
66 const auto &err = res.error();
76 MIL <<
"Attach of " << attachUrl <<
" was successfull" << std::endl;
78 attachSuccess( req->_spec.requestId(), res.get().asString() );
86 if (
_driver->detachMedia( attachId ) ) {
91 ,
"Attach ID not known." 106 const auto &availMedia =
_driver->attachedMedia();
108 auto i = availMedia.find( attachId );
109 if ( i == availMedia.end() ) {
110 ERR <<
"Unknown Attach ID " << attachId << std::endl;
113 ,
"Attach ID not known." 119 const auto &locPath = i->second._dev->_mountPoint / i->second._attachRoot / path;
121 MIL <<
"Trying to find file: " << locPath << std::endl;
132 ,
zypp::str::Str() <<
"Path " << path <<
" exists, but its not a file" 149 ,
"Request type not implemented" 163 }
catch (
const std::exception &e ) {
175 ,
"Unknown exception" 184 ERR <<
"Bug, cancel should never be called for running items" << std::endl;
constexpr std::string_view AttachId("attach_id")
void immediateShutdown() override
zyppng::expected< zyppng::worker::WorkerCaps > initialize(const zyppng::worker::Configuration &conf) override
std::string asString() const
Returns a default string representation of the Url object.
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
bool isExist() const
Return whether valid stat info exists.
std::string asString() const
Error message provided by dumpOn as string.
constexpr std::string_view Label("label")
std::string getAuthority() const
Returns the encoded authority component of the URL.
std::deque< ProvideWorkerItemRef > & requestQueue()
void attachSuccess(const uint32_t id, const std::optional< std::string > &localMountPoint={})
Base class for Exception.
constexpr std::string_view Url("url")
constexpr std::string_view Url("url")
void cancel(const std::deque< zyppng::worker::ProvideWorkerItemRef >::iterator &i) override
MountingWorker(std::string_view workerName, DeviceDriverRef driver)
Wrapper class for ::stat/::lstat.
void detachSuccess(const uint32_t id)
void provideFailed(const uint32_t id, const ProvideMessage::Code code, const std::string &reason, const bool transient, const HeaderValueMap extra={})
void provideSuccess(const uint32_t id, bool cacheHit, const zypp::Pathname &localFile, const HeaderValueMap extra={})