libzypp  17.32.5
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"
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 
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
52  zypp::Url _attachedUrl; // the URL that was used for the attach request
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
const std::string & name() const
void unref_to(unsigned int refCnt) const override
DEFINE_PTR_TYPE(AttachedSyncMediaInfo)
std::optional< zypp::Pathname > _localMountPoint
ProvideQueue::Config::WorkerType _workerType
bool isSameMedium(const std::vector< zypp::Url > &urls, const ProvideMediaSpec &spec)
void setName(std::string &&name)
Base class for reference counted objects.
std::optional< std::chrono::steady_clock::time_point > _idleSince
Set if the medium is idle.
void ref_to(unsigned refCnt) const override
Trigger derived classes after refCount was increased.
ProvideQueueWeakRef _backingQueue
AttachedMediaInfo(const std::string &id, ProvideQueue::Config::WorkerType workerType, const zypp::Url &baseUrl, ProvideMediaSpec &spec)
Url manipulation class.
Definition: Url.h:91
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26