libzypp  17.38.7
packagepolicycomponent.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
13 #ifndef ZYPP_NG_SAT_COMPONENTS_PACKAGEPOLICYCOMPONENT_H_INCLUDED
14 #define ZYPP_NG_SAT_COMPONENTS_PACKAGEPOLICYCOMPONENT_H_INCLUDED
15 
16 #include "poolcomponents.h"
18 #include <zypp/ng/sat/solvable.h>
19 #include <optional>
20 
21 namespace zyppng::sat {
22 
48  {
49  public:
51  ~PackagePolicyComponent() override = default;
52 
53  PreparedStage stage() const override { return PreparedStage::Policy; }
54 
56  void attach(Pool &p) override;
57 
59  void prepare( PreparedPool & pp ) override;
60 
62  void onInvalidate( Pool & pool, PoolInvalidation invalidation ) override;
63 
65  void onReset( Pool & pool ) override;
66 
69  bool isRetracted( const Solvable & solv_r ) const;
71 
74  bool isPtfMaster ( const Solvable & solv_r ) const;
75  bool isPtfPackage( const Solvable & solv_r ) const;
77 
86  void setNeedrebootSpec( SolvableSpec spec );
87 
88  bool isNeedreboot( const Solvable & solv_r ) const;
90 
91  private:
92  Pool *_pool = nullptr;
93  // --- spec (definition) layer ---
98 
99  // --- evaluated (cache) layer ---
100  // Populated by prepare(); reset to nullopt by onInvalidate().
101  std::optional<EvaluatedSolvableSpec> _retractedEval;
102  std::optional<EvaluatedSolvableSpec> _ptfMasterEval;
103  std::optional<EvaluatedSolvableSpec> _ptfPackageEval;
104  std::optional<EvaluatedSolvableSpec> _needrebootEval;
105  };
106 
107 
108 } // namespace zyppng::sat
109 
110 #endif // ZYPP_NG_SAT_COMPONENTS_PACKAGEPOLICYCOMPONENT_H_INCLUDED
A Solvable object within the sat Pool.
Definition: solvable.h:64
~PackagePolicyComponent() override=default
Component managing package-level policies: retracted packages, PTF tracking, and the "reboot needed" ...
std::optional< EvaluatedSolvableSpec > _ptfMasterEval
PreparedStage
Execution stages for IPreparedPoolComponent (post-index phase).
void onReset(Pool &pool) override
Called on full pool reset — resets all evaluated forms.
SolvableSpec _ptfMasterSpec
hardwired: provides ptf()
SolvableSpec _needrebootSpec
user-supplied
bool isPtfMaster(const Solvable &solv_r) const
Orchestrator for a libsolv pool instance.
Definition: pool.h:36
SolvableSpec _retractedSpec
hardwired: provides retracted-patch-package()
Interface for components that run AFTER the whatprovides index is built.
std::optional< EvaluatedSolvableSpec > _ptfPackageEval
bool isNeedreboot(const Solvable &solv_r) const
void prepare(PreparedPool &pp) override
Called by Pool::prepare() — evaluates all specs against the prepared pool.
void onInvalidate(Pool &pool, PoolInvalidation invalidation) override
Called when pool content changes — resets all evaluated forms.
A move-only, non-owning view of a Pool that guarantees the whatprovides index is valid.
Definition: preparedpool.h:50
std::optional< EvaluatedSolvableSpec > _retractedEval
PreparedStage stage() const override
bool isRetracted(const Solvable &solv_r) const
This file contains private API, this might break at any time between releases.
Definition: capabilities.h:22
SolvableSpec _ptfPackageSpec
hardwired: provides ptf-package()
Blacklists, Reboot Specs, Storage Policy.
void attach(Pool &p) override
called when the component is attached to a pool
A pure data container describing a set of solvables by ident and/or provides.
Definition: solvablespec.h:54
This file contains private API, this might break at any time between releases.
std::optional< EvaluatedSolvableSpec > _needrebootEval
bool isPtfPackage(const Solvable &solv_r) const
PoolInvalidation
Defines the scope of an invalidation request for the Pool.
Definition: poolconstants.h:66
void setNeedrebootSpec(SolvableSpec spec)
Replace the reboot-needed spec.