libzypp: zypp-media/ng/private/attachedmediainfo_p.h Source File

libzypp 17.36.6

attachedmediainfo_p.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\----------------------------------------------------------------------/
9*
10* This file contains private API, this might break at any time between releases.
11* You have been warned!
12*
13*/
14#ifndef ZYPP_MEDIA_PRIVATE_ATTACHEDMEDIAINFO_P_H_INCLUDED
15#define ZYPP_MEDIA_PRIVATE_ATTACHEDMEDIAINFO_P_H_INCLUDED
16
17#include "providefwd_p.h"
18#include "providequeue_p.h"
19#include "zypp-core/base/ReferenceCounted.h"
20#include <zypp-media/ng/ProvideSpec>
21#include <string>
22#include <chrono>
23#include <optional>
24
25namespace zyppng {
26
27 class ProvidePrivate;
28
29 DEFINE_PTR_TYPE(AttachedMediaInfo);
30
31 class AttachedMediaInfo : public zypp::base::ReferenceCounted, private zypp::base::NonCopyable {
32
33 protected:
34 void unref_to( unsigned int refCnt ) const override;
35 void ref_to( unsigned refCnt ) const override;
36
37 public:
38 AttachedMediaInfo( const std::string &id, ProvideQueue::Config::WorkerType workerType, const zypp::Url &baseUrl, ProvideMediaSpec &spec );
39 AttachedMediaInfo( const std::string &id, ProvideQueueWeakRef backingQueue, ProvideQueue::Config::WorkerType workerType, const zypp::Url &baseUrl, const ProvideMediaSpec &mediaSpec, const std::optional<zypp::Pathname> &mnt = {} );
40
41 void setName( std::string &&name );
42 const std::string &name() const;
43
47 bool isSameMedium ( const std::vector<zypp::Url> &urls, const ProvideMediaSpec &spec );
48
49 std::string _name;
50 ProvideQueueWeakRef _backingQueue; //< if initialized contains a weak reference to the queue that owns this medium
51 ProvideQueue::Config::WorkerType _workerType;
52 zypp::Url _attachedUrl; // the URL that was used for the attach request
53 ProvideMediaSpec _spec;
54 std::optional<zypp::Pathname> _localMountPoint; // if initialized tells where the workers mounted to medium
55 mutable std::optional<std::chrono::steady_clock::time_point> _idleSince;
56 };
57
58}
59
60#endif
zypp::Url
Url manipulation class.
Definition Url.h:93
zypp::base::ReferenceCounted
Base class for reference counted objects.
Definition ReferenceCounted.h:35
zyppng::AttachedMediaInfo
Definition attachedmediainfo_p.h:31
zyppng::AttachedMediaInfo::unref_to
void unref_to(unsigned int refCnt) const override
Definition attachedmediainfo.cc:43
zyppng::AttachedMediaInfo::_attachedUrl
zypp::Url _attachedUrl
Definition attachedmediainfo_p.h:52
zyppng::AttachedMediaInfo::_spec
ProvideMediaSpec _spec
Definition attachedmediainfo_p.h:53
zyppng::AttachedMediaInfo::isSameMedium
bool isSameMedium(const std::vector< zypp::Url > &urls, const ProvideMediaSpec &spec)
Definition attachedmediainfo.cc:52
zyppng::AttachedMediaInfo::name
const std::string & name() const
Definition attachedmediainfo.cc:38
zyppng::AttachedMediaInfo::_localMountPoint
std::optional< zypp::Pathname > _localMountPoint
Definition attachedmediainfo_p.h:54
zyppng::AttachedMediaInfo::AttachedMediaInfo
AttachedMediaInfo(const std::string &id, ProvideQueue::Config::WorkerType workerType, const zypp::Url &baseUrl, ProvideMediaSpec &spec)
Definition attachedmediainfo.cc:17
zyppng::AttachedMediaInfo::_idleSince
std::optional< std::chrono::steady_clock::time_point > _idleSince
Set if the medium is idle.
Definition attachedmediainfo_p.h:55
zyppng::AttachedMediaInfo::_name
std::string _name
Definition attachedmediainfo_p.h:49
zyppng::AttachedMediaInfo::ref_to
void ref_to(unsigned refCnt) const override
Trigger derived classes after refCount was increased.
Definition attachedmediainfo.cc:49
zyppng::AttachedMediaInfo::_backingQueue
ProvideQueueWeakRef _backingQueue
Definition attachedmediainfo_p.h:50
zyppng::AttachedMediaInfo::setName
void setName(std::string &&name)
Definition attachedmediainfo.cc:33
zyppng::AttachedMediaInfo::_workerType
ProvideQueue::Config::WorkerType _workerType
Definition attachedmediainfo_p.h:51
zyppng::ProvideMediaSpec
Definition providespec.h:29
zyppng::ProvidePrivate
Definition provide_p.h:42
zyppng::WorkerCaps::WorkerType
WorkerType
Definition providemessage_p.h:379
zypp::base::NonCopyable
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition NonCopyable.h:26
zyppng
Definition MediaCurl2.h:22
providefwd_p.h
providequeue_p.h
DEFINE_PTR_TYPE
#define DEFINE_PTR_TYPE(NAME)
Forward declaration of Ptr types.
Definition PtrTypes.h:639
ReferenceCounted.h