codekingpro/portable-devtools
114k
1/*-------------------------------------------------------------------------2 *3 * archive_module.h4 * Exports for archive modules.5 *6 * Copyright (c) 2022-2023, PostgreSQL Global Development Group7 *8 * src/include/archive/archive_module.h9 *10 *-------------------------------------------------------------------------11 */12#ifndef _ARCHIVE_MODULE_H13#define _ARCHIVE_MODULE_H14 15/*16 * The value of the archive_library GUC.17 */18extern PGDLLIMPORT char *XLogArchiveLibrary;19 20typedef struct ArchiveModuleState21{22 /*23 * Private data pointer for use by an archive module. This can be used to24 * store state for the module that will be passed to each of its25 * callbacks.26 */27 void *private_data;28} ArchiveModuleState;29 30/*31 * Archive module callbacks32 *33 * These callback functions should be defined by archive libraries and returned34 * via _PG_archive_module_init(). ArchiveFileCB is the only required callback.35 * For more information about the purpose of each callback, refer to the36 * archive modules documentation.37 */38typedef void (*ArchiveStartupCB) (ArchiveModuleState *state);39typedef bool (*ArchiveCheckConfiguredCB) (ArchiveModuleState *state);40typedef bool (*ArchiveFileCB) (ArchiveModuleState *state, const char *file, const char *path);41typedef void (*ArchiveShutdownCB) (ArchiveModuleState *state);42 43typedef struct ArchiveModuleCallbacks44{45 ArchiveStartupCB startup_cb;46 ArchiveCheckConfiguredCB check_configured_cb;47 ArchiveFileCB archive_file_cb;48 ArchiveShutdownCB shutdown_cb;49} ArchiveModuleCallbacks;50 51/*52 * Type of the shared library symbol _PG_archive_module_init that is looked53 * up when loading an archive library.54 */55typedef const ArchiveModuleCallbacks *(*ArchiveModuleInit) (void);56 57extern PGDLLEXPORT const ArchiveModuleCallbacks *_PG_archive_module_init(void);58 59#endif /* _ARCHIVE_MODULE_H */60 