12 #include <zypp-media/ng/ProvideSpec> 27 const std::optional<zypp::Pathname> &
rootPath()
const;
28 MediaSyncFacadeRef
parent()
const;
37 void unref_to(
unsigned int)
const override;
51 , _attachedUrl(
std::move( baseUrl ))
52 , _spec(
std::move( mediaSpec ))
53 , _parent(
std::move( parentRef ))
54 , _localPath( locPath )
85 if ( !zypp::indeterminate (
check) )
89 return ( std::find( urls.begin(), urls.end(),
_attachedUrl ) != urls.end() );
97 _parent->releaseMedium (
this );
111 return _data->parent();
116 return _data.get() !=
nullptr;
123 return invalidHandle;
129 static std::optional<zypp::Pathname> invalidPath;
132 return _data->rootPath();
141 : _res(
std::move(file) )
142 , _provideHandle(
std::move (hdl) )
154 std::vector<zypp::Url> useableUrls = urls;
158 return medium->isSameMedium( useableUrls, request );
167 std::exception_ptr lastError;
168 for (
const auto &url : useableUrls ) {
169 std::optional<zypp::media::MediaAccessId> attachId;
172 attachId = mgr.
open( url );
180 auto locPath = mgr.
localPath( *attachId,
"/" );
181 auto attachInfo = AttachedSyncMediaInfo_Ptr(
new AttachedSyncMediaInfo( shared_this<MediaSyncFacade>(), *attachId, url, request, locPath ) );
186 lastError = std::current_exception();
190 lastError = std::current_exception();
195 mgr.
close ( *attachId );
213 WAR <<
"Releasing zyppng::MediaSyncFacade with still valid MediaHandles, this is a bug!" << std::endl;
219 return attachMedia( std::vector<zypp::Url>{url}, request );
229 std::optional<expected<MediaSyncFacade::Res>> lastErr;
230 for (
const zypp::Url& file_url : urls ) {
254 url.setPathName (
"/");
261 return provide( std::vector<zypp::Url>{url}, request );
267 const auto &handleInfo = attachHandle.
info();
271 if ( !mgr.
doesFileExist ( handleInfo.mediaId (), fileName ) ) {
286 if ( handleInfo.url().schemeIsDownloading() )
317 if ( !sourcePi.isExist() ) {
320 if ( !sourcePi.isFile () )
356 ERR <<
"Releasing unknown medium " << ptr->
mediaId () <<
" should not happen";
IMPL_PTR_TYPE(AttachedSyncMediaInfo)
ZYPP_IMPL_PRIVATE_CONSTR(Context)
#define ZYPP_EXCPT_PTR(EXCPT)
Drops a logline and returns Exception as a std::exception_ptr.
zypp::OnMediaLocation asOnMediaLocation(const zypp::Pathname &path, unsigned int mediaNr) const
int hardlinkCopy(const Pathname &oldpath, const Pathname &newpath)
Create newpath as hardlink or copy of oldpath.
bool empty() const
Test for an empty path.
void setPathName(const std::string &path, EEncoding eflag=zypp::url::E_DECODED)
Set the path name.
Convenient building of std::string via std::ostringstream Basically a std::ostringstream autoconverti...
const std::string & asString() const
String representation.
Base class for reference counted objects.
int unlink(const Pathname &path)
Like 'unlink'.
static expected success(ConsParams &&...params)
void setDispose(const Dispose &dispose_r)
Set a new dispose function.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
Base class for Exception.
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
std::string getPathName(EEncoding eflag=zypp::url::E_DECODED) const
Returns the path name from the URL.
Wrapper for const correct access via Smart pointer types.
Wrapper class for ::stat/::lstat.
bool check(const std::string &sequenceinfo_r, bool quick_r)
Check via sequence info.
ResultType and_then(const expected< T, E > &exp, Function &&f)
bool checkExistsOnly() const
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.