root/include/crm/cib/cib_types.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2004-2022 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_CIB_CIB_TYPES__H
  11 #  define PCMK__CRM_CIB_CIB_TYPES__H
  12 
  13 #  include <glib.h>             // gboolean, GList
  14 #  include <libxml/tree.h>      // xmlNode
  15 #  include <crm/common/ipc.h>
  16 #  include <crm/common/xml.h>
  17 
  18 #ifdef __cplusplus
  19 extern "C" {
  20 #endif
  21 
  22 /**
  23  * \file
  24  * \brief Data types for Cluster Information Base access
  25  * \ingroup cib
  26  */
  27 
  28 enum cib_variant {
  29     cib_undefined,
  30     cib_native,
  31     cib_file,
  32     cib_remote,
  33     cib_database,
  34 };
  35 
  36 enum cib_state {
  37     cib_connected_command,
  38     cib_connected_query,
  39     cib_disconnected
  40 };
  41 
  42 enum cib_conn_type {
  43     cib_command,
  44     cib_query,
  45     cib_no_connection,
  46     cib_command_nonblocking,
  47 };
  48 
  49 enum cib_call_options {
  50     cib_none            = 0x00000000,
  51     cib_verbose         = 0x00000001,  //!< Prefer stderr to logs
  52     cib_xpath           = 0x00000002,
  53     cib_multiple        = 0x00000004,
  54     cib_can_create      = 0x00000008,
  55     cib_discard_reply   = 0x00000010,
  56     cib_no_children     = 0x00000020,
  57     cib_xpath_address   = 0x00000040,
  58     cib_mixed_update    = 0x00000080,
  59     cib_scope_local     = 0x00000100,
  60     cib_dryrun          = 0x00000200,
  61     cib_sync_call       = 0x00001000,
  62     cib_no_mtime        = 0x00002000,
  63     cib_zero_copy       = 0x00004000,
  64     cib_inhibit_notify  = 0x00010000,
  65     cib_quorum_override = 0x00100000,
  66     cib_inhibit_bcast   = 0x01000000, //!< \deprecated Will be removed in future
  67     cib_force_diff      = 0x10000000
  68 };
  69 
  70 typedef struct cib_s cib_t;
  71 
  72 typedef struct cib_api_operations_s {
  73     int (*signon) (cib_t *cib, const char *name, enum cib_conn_type type);
  74     int (*signon_raw) (cib_t *cib, const char *name, enum cib_conn_type type,
  75                        int *event_fd);
  76     int (*signoff) (cib_t *cib);
  77     int (*free) (cib_t *cib);
  78     int (*set_op_callback) (cib_t *cib, void (*callback) (const xmlNode *msg,
  79                                                           int callid, int rc,
  80                                                           xmlNode *output));
  81     int (*add_notify_callback) (cib_t *cib, const char *event,
  82                                 void (*callback) (const char *event,
  83                                                   xmlNode *msg));
  84     int (*del_notify_callback) (cib_t *cib, const char *event,
  85                                 void (*callback) (const char *event,
  86                                                   xmlNode *msg));
  87     int (*set_connection_dnotify) (cib_t *cib,
  88                                    void (*dnotify) (gpointer user_data));
  89     int (*inputfd) (cib_t *cib);
  90     int (*noop) (cib_t *cib, int call_options);
  91     int (*ping) (cib_t *cib, xmlNode **output_data, int call_options);
  92     int (*query) (cib_t *cib, const char *section, xmlNode **output_data,
  93                   int call_options);
  94     int (*query_from) (cib_t *cib, const char *host, const char *section,
  95                        xmlNode **output_data, int call_options);
  96 
  97     //! \deprecated This method will be removed and should not be used
  98     int (*is_master) (cib_t *cib);
  99 
 100     //! \deprecated Use the set_primary() method instead
 101     int (*set_master) (cib_t *cib, int call_options);
 102 
 103     //! \deprecated Use the set_secondary() method instead
 104     int (*set_slave) (cib_t *cib, int call_options);
 105 
 106     //! \deprecated This method will be removed and should not be used
 107     int (*set_slave_all) (cib_t *cib, int call_options);
 108 
 109     int (*sync) (cib_t *cib, const char *section, int call_options);
 110     int (*sync_from) (cib_t *cib, const char *host, const char *section,
 111                       int call_options);
 112     int (*upgrade) (cib_t *cib, int call_options);
 113     int (*bump_epoch) (cib_t *cib, int call_options);
 114     int (*create) (cib_t *cib, const char *section, xmlNode *data,
 115                    int call_options);
 116     int (*modify) (cib_t *cib, const char *section, xmlNode *data,
 117                    int call_options);
 118     int (*update) (cib_t *cib, const char *section, xmlNode *data,
 119                    int call_options);
 120     int (*replace) (cib_t *cib, const char *section, xmlNode *data,
 121                     int call_options);
 122     int (*remove) (cib_t *cib, const char *section, xmlNode *data,
 123                    int call_options);
 124     int (*erase) (cib_t *cib, xmlNode **output_data, int call_options);
 125 
 126     //! \deprecated This method does nothing and should not be called
 127     int (*delete_absolute) (cib_t *cib, const char *section, xmlNode *data,
 128                             int call_options);
 129 
 130     int (*quit) (cib_t *cib, int call_options);
 131     int (*register_notification) (cib_t *cib, const char *callback,
 132                                   int enabled);
 133     gboolean (*register_callback) (cib_t *cib, int call_id, int timeout,
 134                                    gboolean only_success, void *user_data,
 135                                    const char *callback_name,
 136                                    void (*callback) (xmlNode*, int, int,
 137                                                      xmlNode*, void *));
 138     gboolean (*register_callback_full)(cib_t *cib, int call_id, int timeout,
 139                                        gboolean only_success, void *user_data,
 140                                        const char *callback_name,
 141                                        void (*callback)(xmlNode *, int, int,
 142                                                         xmlNode *, void *),
 143                                        void (*free_func)(void *));
 144 
 145     /*!
 146      * \brief Set the local CIB manager as the cluster's primary instance
 147      *
 148      * \param[in,out] cib           CIB connection
 149      * \param[in]     call_options  Group of enum cib_call_options flags
 150      *
 151      * \return Legacy Pacemaker return code (in particular, pcmk_ok on success)
 152      */
 153     int (*set_primary)(cib_t *cib, int call_options);
 154 
 155     /*!
 156      * \brief Set the local CIB manager as a secondary instance
 157      *
 158      * \param[in,out] cib           CIB connection
 159      * \param[in]     call_options  Group of enum cib_call_options flags
 160      *
 161      * \return Legacy Pacemaker return code (in particular, pcmk_ok on success)
 162      */
 163     int (*set_secondary)(cib_t *cib, int call_options);
 164 } cib_api_operations_t;
 165 
 166 struct cib_s {
 167     enum cib_state state;
 168     enum cib_conn_type type;
 169     enum cib_variant variant;
 170 
 171     int call_id;
 172     int call_timeout;
 173     void *variant_opaque;
 174     void *delegate_fn;
 175 
 176     GList *notify_list;
 177     void (*op_callback) (const xmlNode *msg, int call_id, int rc,
 178                          xmlNode *output);
 179     cib_api_operations_t *cmds;
 180 };
 181 
 182 #ifdef __cplusplus
 183 }
 184 #endif
 185 
 186 #endif // PCMK__CRM_CIB_CIB_TYPES__H

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