root/include/crm/common/clone_internal.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pcmk__is_clone
  2. pcmk__is_unique_clone
  3. pcmk__is_anonymous_clone

   1 /*
   2  * Copyright 2004-2024 the Pacemaker project contributors
   3  *
   4  * The version control history for this file may have further details.
   5  *
   6  * This source code is licensed under the GNU Lesser General Public License
   7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #ifndef PCMK__CRM_COMMON_CLONE_INTERNAL__H
  11 #define PCMK__CRM_COMMON_CLONE_INTERNAL__H
  12 
  13 #include <stdbool.h>                    // bool
  14 #include <crm/common/scheduler_types.h> // pcmk_resource_t
  15 #include <crm/common/resources.h>       // pcmk_rsc_variant_clone
  16 
  17 #ifdef __cplusplus
  18 extern "C" {
  19 #endif
  20 
  21 // Clone resource flags (used in variant data)
  22 enum pcmk__clone_flags {
  23     // Whether instances should be started sequentially
  24     pcmk__clone_ordered                 = (1 << 0),
  25 
  26     // Whether promotion scores have been added
  27     pcmk__clone_promotion_added         = (1 << 1),
  28 
  29     // Whether promotion constraints have been added
  30     pcmk__clone_promotion_constrained   = (1 << 2),
  31 };
  32 
  33 /*!
  34  * \internal
  35  * \brief Check whether a resource is a clone resource
  36  *
  37  * \param[in] rsc  Resource to check
  38  *
  39  * \return true if \p rsc is a clone, otherwise false
  40  *
  41  * \note This does not return true if \p rsc has a clone ancestor.
  42  */
  43 static inline bool
  44 pcmk__is_clone(const pcmk_resource_t *rsc)
     /* [previous][next][first][last][top][bottom][index][help] */
  45 {
  46     return (rsc != NULL) && (rsc->variant == pcmk_rsc_variant_clone);
  47 }
  48 
  49 /*!
  50  * \internal
  51  * \brief Check whether a resource is a globally unique clone
  52  *
  53  * \param[in] rsc  Resource to check
  54  *
  55  * \return true if \p rsc is a unique clone, otherwise false
  56  */
  57 static inline bool
  58 pcmk__is_unique_clone(const pcmk_resource_t *rsc)
     /* [previous][next][first][last][top][bottom][index][help] */
  59 {
  60     return pcmk__is_clone(rsc) && pcmk_is_set(rsc->flags, pcmk_rsc_unique);
  61 }
  62 
  63 /*!
  64  * \internal
  65  * \brief Check whether a resource is an anonymous clone
  66  *
  67  * \param[in] rsc  Resource to check
  68  *
  69  * \return true if \p rsc is an anonymous clone, otherwise false
  70  */
  71 static inline bool
  72 pcmk__is_anonymous_clone(const pcmk_resource_t *rsc)
     /* [previous][next][first][last][top][bottom][index][help] */
  73 {
  74     return pcmk__is_clone(rsc) && !pcmk_is_set(rsc->flags, pcmk_rsc_unique);
  75 }
  76 
  77 #ifdef __cplusplus
  78 }
  79 #endif
  80 
  81 #endif // PCMK__CRM_COMMON_CLONE_INTERNAL__H

/* [previous][next][first][last][top][bottom][index][help] */