root/daemons/controld/controld_metadata.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. ra_param_flag2text

   1 /*
   2  * Copyright 2017-2020 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 General Public License version 2
   7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
   8  */
   9 
  10 #ifndef CRMD_METADATA_H
  11 #define CRMD_METADATA_H
  12 
  13 enum ra_flags_e {
  14     ra_supports_reload  = 0x01,
  15     ra_uses_private     = 0x02,
  16 };
  17 
  18 enum ra_param_flags_e {
  19     ra_param_unique     = 0x01,
  20     ra_param_private    = 0x02,
  21 };
  22 
  23 struct ra_param_s {
  24     char *rap_name;
  25     uint32_t rap_flags; // bitmask of ra_param_flags_s
  26 };
  27 
  28 struct ra_metadata_s {
  29     char *ra_version;
  30     GList *ra_params;   // ra_param_s
  31     uint32_t ra_flags;  // bitmask of ra_flags_e
  32 };
  33 
  34 #define controld_set_ra_flags(ra_md, ra_key, flags_to_set) do {             \
  35         (ra_md)->ra_flags = pcmk__set_flags_as(__func__, __LINE__,          \
  36             LOG_TRACE, "Resource agent", ra_key,                            \
  37             (ra_md)->ra_flags, (flags_to_set), #flags_to_set);              \
  38     } while (0)
  39 
  40 #define controld_set_ra_param_flags(ra_param, flags_to_set) do {            \
  41         (ra_param)->rap_flags = pcmk__set_flags_as(__func__, __LINE__,      \
  42             LOG_TRACE, "Resource agent parameter", (ra_param)->rap_name,    \
  43             (ra_param)->rap_flags, (flags_to_set), #flags_to_set);          \
  44     } while (0)
  45 
  46 GHashTable *metadata_cache_new(void);
  47 void metadata_cache_free(GHashTable *mdc);
  48 void metadata_cache_reset(GHashTable *mdc);
  49 void metadata_cache_fini(void);
  50 
  51 struct ra_metadata_s *metadata_cache_update(GHashTable *mdc,
  52                                             lrmd_rsc_info_t *rsc,
  53                                             const char *metadata_str);
  54 struct ra_metadata_s *metadata_cache_get(GHashTable *mdc, lrmd_rsc_info_t *rsc);
  55 
  56 static inline const char *
  57 ra_param_flag2text(enum ra_param_flags_e flag)
     /* [previous][next][first][last][top][bottom][index][help] */
  58 {
  59     switch (flag) {
  60         case ra_param_unique:
  61             return "unique";
  62         case ra_param_private:
  63             return "private";
  64         default:
  65             return "unknown";
  66     }
  67 }
  68 
  69 #endif

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