Unmark gen_random_uuid() function leakproof.
[pgsql.git] / src / include / storage / sync.h
blob9dee8fa6e5bb341bfd41f6c0a90219142be28366
1 /*-------------------------------------------------------------------------
3 * sync.h
4 * File synchronization management code.
6 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/storage/sync.h
11 *-------------------------------------------------------------------------
13 #ifndef SYNC_H
14 #define SYNC_H
16 #include "storage/relfilelocator.h"
19 * Type of sync request. These are used to manage the set of pending
20 * requests to call a sync handler's sync or unlink functions at the next
21 * checkpoint.
23 typedef enum SyncRequestType
25 SYNC_REQUEST, /* schedule a call of sync function */
26 SYNC_UNLINK_REQUEST, /* schedule a call of unlink function */
27 SYNC_FORGET_REQUEST, /* forget all calls for a tag */
28 SYNC_FILTER_REQUEST, /* forget all calls satisfying match fn */
29 } SyncRequestType;
32 * Which set of functions to use to handle a given request. The values of
33 * the enumerators must match the indexes of the function table in sync.c.
35 typedef enum SyncRequestHandler
37 SYNC_HANDLER_MD = 0,
38 SYNC_HANDLER_CLOG,
39 SYNC_HANDLER_COMMIT_TS,
40 SYNC_HANDLER_MULTIXACT_OFFSET,
41 SYNC_HANDLER_MULTIXACT_MEMBER,
42 SYNC_HANDLER_NONE,
43 } SyncRequestHandler;
46 * A tag identifying a file. Currently it has the members required for md.c's
47 * usage, but sync.c has no knowledge of the internal structure, and it is
48 * liable to change as required by future handlers.
50 typedef struct FileTag
52 int16 handler; /* SyncRequestHandler value, saving space */
53 int16 forknum; /* ForkNumber, saving space */
54 RelFileLocator rlocator;
55 uint64 segno;
56 } FileTag;
58 extern void InitSync(void);
59 extern void SyncPreCheckpoint(void);
60 extern void SyncPostCheckpoint(void);
61 extern void ProcessSyncRequests(void);
62 extern void RememberSyncRequest(const FileTag *ftag, SyncRequestType type);
63 extern bool RegisterSyncRequest(const FileTag *ftag, SyncRequestType type,
64 bool retryOnError);
66 #endif /* SYNC_H */