pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
tickets_internal.h
Go to the documentation of this file.
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_TICKETS_INTERNAL__H
11 #define PCMK__CRM_COMMON_TICKETS_INTERNAL__H
12 
13 #include <stdint.h> // uint32_t, UINT32_C()
14 #include <sys/types.h> // time_t
15 #include <glib.h> // GHashTable
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
34 #define pcmk__set_ticket_flags(ticket, flags_to_set) do { \
35  (ticket)->flags = pcmk__set_flags_as(__func__, __LINE__, \
36  LOG_TRACE, "Ticket", (ticket)->id, (ticket)->flags, \
37  (flags_to_set), #flags_to_set); \
38  } while (0)
39 
47 #define pcmk__clear_ticket_flags(ticket, flags_to_clear) do { \
48  (ticket)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
49  LOG_TRACE, "Ticket", (ticket)->id, (ticket)->flags, \
50  (flags_to_clear), #flags_to_clear); \
51  } while (0)
52 
54  pcmk__ticket_none = UINT32_C(0),
55  pcmk__ticket_granted = (UINT32_C(1) << 0),
56  pcmk__ticket_standby = (UINT32_C(1) << 1),
57 };
58 
59 // Ticket constraint object
60 typedef struct {
61  char *id; // XML ID of ticket constraint or state
62  GHashTable *state; // XML attributes from ticket state
63  time_t last_granted; // When cluster was last granted the ticket
64  uint32_t flags; // Group of enum pcmk__ticket_flags
66 
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif // PCMK__CRM_COMMON_TICKETS_INTERNAL__H
pcmk__ticket_flags
GHashTable * state