libzypp
17.31.32
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-media/ng/ProvideSpec>
20
#include <string>
21
#include <chrono>
22
23
namespace
zyppng
{
24
25
class
ProvidePrivate;
26
27
struct
AttachedMediaInfo
{
28
29
public
:
30
void
ref
() {
31
if
(
_refCount
== 0 )
32
_idleSince
= std::chrono::steady_clock::time_point::max();
33
34
_refCount
++;
35
}
36
void
unref
() {
37
if
(
_refCount
> 0 ) {
38
_refCount
--;
39
40
if
(
_refCount
== 0 )
41
_idleSince
= std::chrono::steady_clock::now();
42
}
43
}
44
48
bool
isSameMedium
(
const
std::vector<zypp::Url> &urls,
const
ProvideMediaSpec
&spec ) {
49
50
const
auto
check =
_spec
.
isSameMedium
(spec);
51
if
( !zypp::indeterminate (check) )
52
return
(
bool
)check;
53
54
// let the URL rule
55
return
( std::find( urls.begin(), urls.end(),
_attachedUrl
) != urls.end() );
56
}
57
58
std::string
_name
;
59
ProvideQueueWeakRef
_backingQueue
;
//< if initialized contains a weak reference to the queue that owns this medium
60
ProvideQueue::Config::WorkerType
_workerType
;
61
zypp::Url
_attachedUrl
;
// the URL that was used for the attach request
62
ProvideMediaSpec
_spec
;
63
uint
_refCount
= 0;
64
std::chrono::steady_clock::time_point
_idleSince
= std::chrono::steady_clock::time_point::max();
65
};
66
67
}
68
69
#endif
zypp::Url
Url manipulation class.
Definition
Url.h:92
zyppng::ProvideMediaSpec
Definition
providespec.h:29
zyppng::ProvideMediaSpec::isSameMedium
zypp::TriBool isSameMedium(const ProvideMediaSpec &other)
Definition
providespec.cc:140
zyppng
Definition
MediaNetwork.h:23
providefwd_p.h
providequeue_p.h
zyppng::AttachedMediaInfo
Definition
attachedmediainfo_p.h:27
zyppng::AttachedMediaInfo::_attachedUrl
zypp::Url _attachedUrl
Definition
attachedmediainfo_p.h:61
zyppng::AttachedMediaInfo::ref
void ref()
Definition
attachedmediainfo_p.h:30
zyppng::AttachedMediaInfo::_spec
ProvideMediaSpec _spec
Definition
attachedmediainfo_p.h:62
zyppng::AttachedMediaInfo::isSameMedium
bool isSameMedium(const std::vector< zypp::Url > &urls, const ProvideMediaSpec &spec)
Definition
attachedmediainfo_p.h:48
zyppng::AttachedMediaInfo::_name
std::string _name
Definition
attachedmediainfo_p.h:58
zyppng::AttachedMediaInfo::_backingQueue
ProvideQueueWeakRef _backingQueue
Definition
attachedmediainfo_p.h:59
zyppng::AttachedMediaInfo::_idleSince
std::chrono::steady_clock::time_point _idleSince
Definition
attachedmediainfo_p.h:64
zyppng::AttachedMediaInfo::_workerType
ProvideQueue::Config::WorkerType _workerType
Definition
attachedmediainfo_p.h:60
zyppng::AttachedMediaInfo::unref
void unref()
Definition
attachedmediainfo_p.h:36
zyppng::AttachedMediaInfo::_refCount
uint _refCount
Definition
attachedmediainfo_p.h:63
zypp-media
ng
private
attachedmediainfo_p.h
Generated by
1.10.0