libzypp 17.37.10

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
25 namespace 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::MirroredOrigin &originConfig, ProvideMediaSpec &spec );
39 AttachedMediaInfo( const std::string &id, ProvideQueueWeakRef backingQueue, ProvideQueue::Config::WorkerType workerType, const zypp::MirroredOrigin &originConfig, const ProvideMediaSpec &mediaSpec, const std::optional<zypp::Pathname> &mnt = {} );
40
41 void setName( std::string &&name );
42 const std::string &name() const;
43
44 zypp::Url attachedUrl() const;
45
49 bool isSameMedium (const zypp::MirroredOrigin &origin, const ProvideMediaSpec &spec );
50
51 static bool isSameMedium ( const zypp::MirroredOrigin &originA, const ProvideMediaSpec &specA, const zypp::MirroredOrigin &originB, const ProvideMediaSpec &specB );
52
53 std::string _name;
54 ProvideQueueWeakRef _backingQueue; //< if initialized contains a weak reference to the queue that owns this medium
55 ProvideQueue::Config::WorkerType _workerType;
56 zypp::MirroredOrigin _originConfig; //< baseUrl and mirrors with config
57 ProvideMediaSpec _spec;
58 std::optional<zypp::Pathname> _localMountPoint; // if initialized tells where the workers mounted to medium
59 mutable std::optional<std::chrono::steady_clock::time_point> _idleSince;
60 };
61
62}
63
64#endif
zypp::MirroredOrigin
Manages a data source characterized by an authoritative URL and a list of mirror URLs.
Definition MirroredOrigin.h:170
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:51
zyppng::AttachedMediaInfo::attachedUrl
zypp::Url attachedUrl() const
Definition attachedmediainfo.cc:43
zyppng::AttachedMediaInfo::_spec
ProvideMediaSpec _spec
Definition attachedmediainfo_p.h:57
zyppng::AttachedMediaInfo::_originConfig
zypp::MirroredOrigin _originConfig
Definition attachedmediainfo_p.h:56
zyppng::AttachedMediaInfo::isSameMedium
bool isSameMedium(const zypp::MirroredOrigin &origin, const ProvideMediaSpec &spec)
Definition attachedmediainfo.cc:61
zyppng::AttachedMediaInfo::name
const std::string & name() const
Definition attachedmediainfo.cc:38
zyppng::AttachedMediaInfo::_localMountPoint
std::optional< zypp::Pathname > _localMountPoint
Definition attachedmediainfo_p.h:58
zyppng::AttachedMediaInfo::_idleSince
std::optional< std::chrono::steady_clock::time_point > _idleSince
Set if the medium is idle.
Definition attachedmediainfo_p.h:59
zyppng::AttachedMediaInfo::_name
std::string _name
Definition attachedmediainfo_p.h:53
zyppng::AttachedMediaInfo::ref_to
void ref_to(unsigned refCnt) const override
Trigger derived classes after refCount was increased.
Definition attachedmediainfo.cc:57
zyppng::AttachedMediaInfo::_backingQueue
ProvideQueueWeakRef _backingQueue
Definition attachedmediainfo_p.h:54
zyppng::AttachedMediaInfo::setName
void setName(std::string &&name)
Definition attachedmediainfo.cc:33
zyppng::AttachedMediaInfo::AttachedMediaInfo
AttachedMediaInfo(const std::string &id, ProvideQueue::Config::WorkerType workerType, const zypp::MirroredOrigin &originConfig, ProvideMediaSpec &spec)
Definition attachedmediainfo.cc:17
zyppng::AttachedMediaInfo::_workerType
ProvideQueue::Config::WorkerType _workerType
Definition attachedmediainfo_p.h:55
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 MediaNetworkRequestExecutor.h:16
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