libzypp: zypp/ng/sat/components/namespacecomponent.h Source File

libzypp 17.38.14

namespacecomponent.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_NG_SAT_COMPONENTS_NAMESPACECOMPONENT_H_INCLUDED
15#define ZYPP_NG_SAT_COMPONENTS_NAMESPACECOMPONENT_H_INCLUDED
16
17#include <memory>
18#include <unordered_map>
19#include <zypp/ng/sat/poolconstants.h>
20#include "poolcomponents.h"
21
22namespace zyppng::sat {
23
24 class NamespaceProvider;
25
37 class NamespaceComponent : public IPoolComponent {
38 public:
39
40 ~NamespaceComponent() override = default;
41
47 void registerProvider( detail::IdType namespaceId, std::shared_ptr<NamespaceProvider> provider );
48
55 bool handleNamespace( detail::IdType namespaceId, detail::IdType value ) const;
56
57 // --- IPoolComponent implementation ---
58
59 InitStage stage() const override { return InitStage::Environment; }
60 int priority() const override { return -10; } // Run early in Environment stage
61
62 void attach ( Pool & pool ) override;
63 void checkDirty( Pool & pool ) override;
64 void prepare ( Pool & pool ) override;
65 void onReset ( Pool & pool ) override;
66
67 private:
68
70 static detail::IdType libsolv_callback( detail::CPool *, void * data, detail::IdType lhs, detail::IdType rhs );
71
73 std::unordered_map<detail::IdType, std::shared_ptr<NamespaceProvider>> _providers;
74 };
75
76} // namespace zyppng::sat
77
78#endif
zyppng::sat::IPoolComponent
Interface for components that run BEFORE the whatprovides index is built.
Definition poolcomponents.h:91
zyppng::sat::NamespaceComponent
Mediator managing the collection of NamespaceProviders for a Pool.
Definition namespacecomponent.h:37
zyppng::sat::NamespaceComponent::handleNamespace
bool handleNamespace(detail::IdType namespaceId, detail::IdType value) const
The entry point for the libsolv namespace callback.
Definition namespacecomponent.cc:23
zyppng::sat::NamespaceComponent::libsolv_callback
static detail::IdType libsolv_callback(detail::CPool *, void *data, detail::IdType lhs, detail::IdType rhs)
The static C-style callback for libsolv.
Definition namespacecomponent.cc:58
zyppng::sat::NamespaceComponent::checkDirty
void checkDirty(Pool &pool) override
Probe external state.
Definition namespacecomponent.cc:40
zyppng::sat::NamespaceComponent::stage
InitStage stage() const override
Definition namespacecomponent.h:59
zyppng::sat::NamespaceComponent::priority
int priority() const override
Fine-grained ordering within a stage.
Definition namespacecomponent.h:60
zyppng::sat::NamespaceComponent::~NamespaceComponent
~NamespaceComponent() override=default
zyppng::sat::NamespaceComponent::_providers
std::unordered_map< detail::IdType, std::shared_ptr< NamespaceProvider > > _providers
Internal map of IDs to their respective providers.
Definition namespacecomponent.h:73
zyppng::sat::NamespaceComponent::prepare
void prepare(Pool &pool) override
Definition namespacecomponent.cc:46
zyppng::sat::NamespaceComponent::onReset
void onReset(Pool &pool) override
Definition namespacecomponent.cc:52
zyppng::sat::NamespaceComponent::attach
void attach(Pool &pool) override
Definition namespacecomponent.cc:31
zyppng::sat::NamespaceComponent::registerProvider
void registerProvider(detail::IdType namespaceId, std::shared_ptr< NamespaceProvider > provider)
Register a provider for a specific namespace.
Definition namespacecomponent.cc:18
zyppng::sat::NamespaceProvider
Abstract base class for logic providing data to a libsolv namespace.
Definition namespaceprovider.h:35
zyppng::sat::Pool
Orchestrator for a libsolv pool instance.
Definition pool.h:37
zypp::pool
Definition ByIdent.h:24
zyppng::sat::detail::CPool
zypp::sat::detail::CPool CPool
Definition poolconstants.h:36
zyppng::sat::detail::IdType
zypp::sat::detail::IdType IdType
Definition poolconstants.h:43
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
zyppng::sat::InitStage
InitStage
Execution stages for IPoolComponent (pre-index phase).
Definition poolcomponents.h:35
zyppng::sat::InitStage::Environment
@ Environment
Arches, Locales, Namespace Callbacks (The Foundation).
Definition poolcomponents.h:36
poolcomponents.h
poolconstants.h