rmgr.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * rmgr.h
  3. *
  4. * Resource managers definition
  5. *
  6. * src/include/access/rmgr.h
  7. */
  8. #ifndef RMGR_H
  9. #define RMGR_H
  10. typedef uint8 RmgrId;
  11. /*
  12. * Built-in resource managers
  13. *
  14. * The actual numerical values for each rmgr ID are defined by the order
  15. * of entries in rmgrlist.h.
  16. *
  17. * Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG
  18. * file format.
  19. */
  20. #define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \
  21. symname,
  22. typedef enum RmgrIds
  23. {
  24. #include "access/rmgrlist.h"
  25. RM_NEXT_ID
  26. } RmgrIds;
  27. #undef PG_RMGR
  28. #define RM_MAX_ID UINT8_MAX
  29. #define RM_MAX_BUILTIN_ID (RM_NEXT_ID - 1)
  30. #define RM_MIN_CUSTOM_ID 128
  31. #define RM_MAX_CUSTOM_ID UINT8_MAX
  32. #define RM_N_IDS (UINT8_MAX + 1)
  33. #define RM_N_BUILTIN_IDS (RM_MAX_BUILTIN_ID + 1)
  34. #define RM_N_CUSTOM_IDS (RM_MAX_CUSTOM_ID - RM_MIN_CUSTOM_ID + 1)
  35. static inline bool
  36. RmgrIdIsBuiltin(int rmid)
  37. {
  38. return rmid <= RM_MAX_BUILTIN_ID;
  39. }
  40. static inline bool
  41. RmgrIdIsCustom(int rmid)
  42. {
  43. return rmid >= RM_MIN_CUSTOM_ID && rmid <= RM_MAX_CUSTOM_ID;
  44. }
  45. #define RmgrIdIsValid(rmid) (RmgrIdIsBuiltin((rmid)) || RmgrIdIsCustom((rmid)))
  46. /*
  47. * RmgrId to use for extensions that require an RmgrId, but are still in
  48. * development and have not reserved their own unique RmgrId yet. See:
  49. * https://wiki.postgresql.org/wiki/CustomWALResourceManagers
  50. */
  51. #define RM_EXPERIMENTAL_ID 128
  52. #endif /* RMGR_H */