libzypp 17.37.10

context.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9#include "private/context_p.h"
10#include <zypp/ZYppFactory.h>
11#include <zypp-core/zyppng/base/private/threaddata_p.h>
12#include <zypp-core/zyppng/base/EventLoop>
13#include <zypp-media/ng/Provide>
14
15 namespace zyppng {
16
17 ZYPP_IMPL_PRIVATE( Context )
18
19 ZYPP_IMPL_PRIVATE_CONSTR( Context )
20 : UserInterface( *new ContextPrivate( *this ) )
21 {
22 Z_D();
23 d->_zyppPtr = zypp::getZYpp();
24 d->_eventDispatcher = ThreadData::current().ensureDispatcher();
25
26 d->_provider = Provide::create( d->_providerDir );
27
28 // @TODO should start be implicit as soon as something is enqueued?
29 d->_provider->start();
30 }
31
32 ProvideRef Context::provider() const
33 {
34 Z_D();
35 return d->_provider;
36 }
37
38 KeyRingRef Context::keyRing() const
39 {
40 return d_func()->_zyppPtr->keyRing();
41 }
42
43 zypp::ZConfig &Context::config()
44 {
45 return zypp::ZConfig::instance();
46 }
47
48 zypp::ResPool Context::pool()
49 {
50 return zypp::ResPool::instance();
51 }
52
53 zypp::ResPoolProxy Context::poolProxy()
54 {
55 return zypp::ResPool::instance().proxy();
56 }
57
58 zypp::sat::Pool Context::satPool()
59 {
60 return zypp::sat::Pool::instance();
61 }
62
63 void Context::executeImpl(const AsyncOpBaseRef& op)
64 {
65 auto loop = EventLoop::create();
66 op->sigReady().connect([&](){
67 loop->quit();
68 });
69 loop->run();
70 return;
71 }
72}
ZYppFactory.h
zypp::ResPoolProxy
ResPool::instance().proxy();.
Definition ResPoolProxy.h:36
zypp::ResPool
Global ResObject pool.
Definition ResPool.h:62
zypp::ResPool::instance
static ResPool instance()
Singleton ctor.
Definition ResPool.cc:38
zypp::ResPool::proxy
ResPoolProxy proxy() const
preliminary
Definition ResPool.cc:59
zypp::ZConfig
Interim helper class to collect global options and settings.
Definition ZConfig.h:69
zypp::ZConfig::instance
static ZConfig & instance()
Singleton ctor.
Definition ZConfig.cc:940
zypp::ZYppFactory::getZYpp
ZYpp::Ptr getZYpp()
Convenience to get the Pointer to the ZYpp instance.
Definition ZYppFactory.h:77
zypp::sat::Pool
Global sat-pool.
Definition Pool.h:47
zypp::sat::Pool::instance
static Pool instance()
Singleton ctor.
Definition Pool.h:55
zyppng::ContextPrivate
Definition context_p.h:23
zyppng::Context
Definition context.h:39
zyppng::Context::config
zypp::ZConfig & config()
Definition context.cc:43
zyppng::Context::executeImpl
void executeImpl(const AsyncOpBaseRef &op)
Definition context.cc:63
zyppng::Context::provider
ProvideRef provider() const
Definition context.cc:32
zyppng::Context::pool
zypp::ResPool pool()
Access to the resolvable pool.
Definition context.cc:48
zyppng::Context::satPool
zypp::sat::Pool satPool()
Access to the sat pool.
Definition context.cc:58
zyppng::Context::poolProxy
zypp::ResPoolProxy poolProxy()
Pool of ui::Selectable.
Definition context.cc:53
zyppng::Context::keyRing
KeyRingRef keyRing() const
Definition context.cc:38
zyppng::EventLoop::create
static Ptr create()
Definition eventloop_glib.cc:24
zyppng::Provide::create
static ProvideRef create(const zypp::Pathname &workDir="")
Definition provide.cc:1005
zyppng::UserInterface
Definition userinterface.h:33
context_p.h
zyppng
Definition MediaNetworkRequestExecutor.h:16
zyppng::ZYPP_IMPL_PRIVATE_CONSTR
ZYPP_IMPL_PRIVATE_CONSTR(Context)
Definition context.cc:19
zyppng::KeyRingRef
zypp::KeyRing_Ptr KeyRingRef
Definition context.h:29
zyppng::ThreadData::current
static ZYPP_API ThreadData & current()
Definition threaddata.cc:16
zyppng::ThreadData::ensureDispatcher
std::shared_ptr< EventDispatcher > ensureDispatcher()
Definition threaddata.cc:32
threaddata_p.h
ZYPP_IMPL_PRIVATE
#define ZYPP_IMPL_PRIVATE(Class)
Definition zyppglobal.h:92
Z_D
#define Z_D()
Definition zyppglobal.h:105