pgarch.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*-------------------------------------------------------------------------
  2. *
  3. * pgarch.h
  4. * Exports from postmaster/pgarch.c.
  5. *
  6. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994, Regents of the University of California
  8. *
  9. * src/include/postmaster/pgarch.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef _PGARCH_H
  14. #define _PGARCH_H
  15. /* ----------
  16. * Archiver control info.
  17. *
  18. * We expect that archivable files within pg_wal will have names between
  19. * MIN_XFN_CHARS and MAX_XFN_CHARS in length, consisting only of characters
  20. * appearing in VALID_XFN_CHARS. The status files in archive_status have
  21. * corresponding names with ".ready" or ".done" appended.
  22. * ----------
  23. */
  24. #define MIN_XFN_CHARS 16
  25. #define MAX_XFN_CHARS 40
  26. #define VALID_XFN_CHARS "0123456789ABCDEF.history.backup.partial"
  27. extern Size PgArchShmemSize(void);
  28. extern void PgArchShmemInit(void);
  29. extern bool PgArchCanRestart(void);
  30. extern void PgArchiverMain(void) pg_attribute_noreturn();
  31. extern void PgArchWakeup(void);
  32. extern void PgArchForceDirScan(void);
  33. /*
  34. * The value of the archive_library GUC.
  35. */
  36. extern PGDLLIMPORT char *XLogArchiveLibrary;
  37. /*
  38. * Archive module callbacks
  39. *
  40. * These callback functions should be defined by archive libraries and returned
  41. * via _PG_archive_module_init(). ArchiveFileCB is the only required callback.
  42. * For more information about the purpose of each callback, refer to the
  43. * archive modules documentation.
  44. */
  45. typedef bool (*ArchiveCheckConfiguredCB) (void);
  46. typedef bool (*ArchiveFileCB) (const char *file, const char *path);
  47. typedef void (*ArchiveShutdownCB) (void);
  48. typedef struct ArchiveModuleCallbacks
  49. {
  50. ArchiveCheckConfiguredCB check_configured_cb;
  51. ArchiveFileCB archive_file_cb;
  52. ArchiveShutdownCB shutdown_cb;
  53. } ArchiveModuleCallbacks;
  54. /*
  55. * Type of the shared library symbol _PG_archive_module_init that is looked
  56. * up when loading an archive library.
  57. */
  58. typedef void (*ArchiveModuleInit) (ArchiveModuleCallbacks *cb);
  59. /*
  60. * Since the logic for archiving via a shell command is in the core server
  61. * and does not need to be loaded via a shared library, it has a special
  62. * initialization function.
  63. */
  64. extern void shell_archive_init(ArchiveModuleCallbacks *cb);
  65. #endif /* _PGARCH_H */