libzypp 17.37.17
ServiceInfo.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_SERVICE_H
13#define ZYPP_SERVICE_H
14
15#include <set>
16#include <string>
17
18#include <zypp/Url.h>
19
20#include <zypp/base/Iterable.h>
22#include <zypp/RepoInfo.h>
23#include <zypp/Date.h>
24
26namespace zypp
27{
28
37 {
38 public:
41
47 ServiceInfo( const std::string & alias );
48
55 ServiceInfo( const std::string & alias, const Url& url );
56
57 ~ServiceInfo() override;
58
59 public:
61 static const ServiceInfo noService ZYPP_API;
62
63 public:
64
66 Url url() const;
67
69 Url rawUrl() const;
70
72 void setUrl( const Url& url );
73
74
76 repo::ServiceType type() const;
77
79 void setType( const repo::ServiceType & type );
80
82 void setProbedType( const repo::ServiceType & t ) const;
83
88
92 Date::Duration ttl() const;
93
95 void setTtl( Date::Duration ttl_r );
96
98 void setProbedTtl( Date::Duration ttl_r ) const;
99
101 Date lrf() const;
102
104 void setLrf( Date lrf_r );
106 //
114
115 using ReposToEnable = std::set<std::string>;
116 bool reposToEnableEmpty() const;
117 ReposToEnable::size_type reposToEnableSize() const;
118 ReposToEnable::const_iterator reposToEnableBegin() const;
119 ReposToEnable::const_iterator reposToEnableEnd() const;
122
124 bool repoToEnableFind( const std::string & alias_r ) const;
125
127 void addRepoToEnable( const std::string & alias_r );
129 void delRepoToEnable( const std::string & alias_r );
131 void clearReposToEnable();
133
140
141 using ReposToDisable = std::set<std::string>;
142 bool reposToDisableEmpty() const;
143 ReposToDisable::size_type reposToDisableSize() const;
144 ReposToDisable::const_iterator reposToDisableBegin() const;
145 ReposToDisable::const_iterator reposToDisableEnd() const;
148
150 bool repoToDisableFind( const std::string & alias_r ) const;
151
153 void addRepoToDisable( const std::string & alias_r );
155 void delRepoToDisable( const std::string & alias_r );
157 void clearReposToDisable();
159
168 {
171 unsigned priority;
172
174 : enabled( false ), autorefresh( true ), priority( RepoInfo::defaultPriority() )
175 {}
176 RepoState( const RepoInfo & repo_r )
177 : enabled( repo_r.enabled() ), autorefresh( repo_r.autorefresh() ), priority( repo_r.priority() )
178 {}
179 bool operator==( const RepoState & rhs ) const
180 { return( enabled==rhs.enabled && autorefresh==rhs.autorefresh && priority==rhs.priority ); }
181 bool operator!=( const RepoState & rhs ) const
182 { return ! operator==( rhs ); }
183 friend std::ostream & operator<<( std::ostream & str, const RepoState & obj );
184 };
185 using RepoStates = std::map<std::string, RepoState>;
186
188 const RepoStates & repoStates() const;
189
191 void setRepoStates( RepoStates newStates_r );
193
194 public:
200 std::ostream & dumpAsIniOn( std::ostream & str ) const override;
201
209 std::ostream & dumpAsXmlOn( std::ostream & str, const std::string & content = "" ) const override;
210
211 struct Impl;
212
213 private:
215 };
216
217
223 using ServiceInfoList = std::list<ServiceInfo>;
224
226 std::ostream & operator<<( std::ostream & str, const ServiceInfo & obj ) ZYPP_API;
227
228
230} // namespace zypp
232#endif // ZYPP_SAT_REPOSITORY_H
std::ostream & operator<<(std::ostream &str, const zypp::sat::detail::CDataiterator *obj)
Store and operate on date (time_t).
Definition Date.h:33
time_t Duration
Definition Date.h:39
Iterable< TIterator > makeIterable(TIterator &&begin_r, TIterator &&end_r)
convenient construction.
Definition Iterable.h:88
What is known about a repository.
Definition RepoInfo.h:72
void setProbedTtl(Date::Duration ttl_r) const
Lazy init sugested TTL.
ReposToEnable::size_type reposToEnableSize() const
repo::ServiceType type() const
Service type.
ReposToEnable::const_iterator reposToEnableBegin() const
Date::Duration ttl() const
Sugested TTL between two metadata auto-refreshs.
void setLrf(Date lrf_r)
Set date of last refresh.
void setType(const repo::ServiceType &type)
Set service type.
Iterable< ReposToEnable::const_iterator > reposToEnable() const
Date lrf() const
Date of last refresh (if known).
const RepoStates & repoStates() const
Access the remembered repository states.
ReposToDisable::const_iterator reposToDisableEnd() const
ServiceInfo()
Default ctor creates noService.
std::list< ServiceInfo > ServiceInfoList
ReposToEnable::const_iterator reposToEnableEnd() const
std::set< std::string > ReposToDisable
Container of repos.
Iterable< ReposToDisable::const_iterator > reposToDisable() const
std::map< std::string, RepoState > RepoStates
bool reposToEnableEmpty() const
Url url() const
The service url.
RWCOW_pointer< Impl > _pimpl
std::ostream & dumpAsIniOn(std::ostream &str) const override
Writes ServiceInfo to stream in ".service" format.
void setProbedType(const repo::ServiceType &t) const
Lazy init service type.
void setTtl(Date::Duration ttl_r)
Set sugested TTL.
Url rawUrl() const
The service raw url (no variables replaced)
shared_ptr< ServiceInfo > ServiceInfo_Ptr
std::set< std::string > ReposToEnable
Container of repos.
static const ServiceInfo noService ZYPP_API
Represents an empty service.
Definition ServiceInfo.h:61
shared_ptr< const ServiceInfo > ServiceInfo_constPtr
void setUrl(const Url &url)
Set the service url (raw value)
ReposToDisable::const_iterator reposToDisableBegin() const
ReposToDisable::size_type reposToDisableSize() const
void setRepoStates(RepoStates newStates_r)
Remember a new set of repository states.
bool reposToDisableEmpty() const
Url manipulation class.
Definition Url.h:93
Base class implementing common features of RepoInfo and ServiceInfo.
std::string alias() const
unique identifier for this source.
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
std::ostream & dumpAsXmlOn(std::ostream &str, const Repository &obj)
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
bool operator==(const RepoState &rhs) const
RepoState(const RepoInfo &repo_r)
bool operator!=(const RepoState &rhs) const
Service type enumeration.
Definition ServiceType.h:27