gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.9KB

  1. /*-------------------------------------------------------------------------
  2. *
  3. * sync.h
  4. * File synchronization management code.
  5. *
  6. * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994, Regents of the University of California
  8. *
  9. * src/include/storage/sync.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef SYNC_H
  14. #define SYNC_H
  15. #include "storage/relfilenode.h"
  16. /*
  17. * Type of sync request. These are used to manage the set of pending
  18. * requests to call a sync handler's sync or unlink functions at the next
  19. * checkpoint.
  20. */
  21. typedef enum SyncRequestType
  22. {
  23. SYNC_REQUEST, /* schedule a call of sync function */
  24. SYNC_UNLINK_REQUEST, /* schedule a call of unlink function */
  25. SYNC_FORGET_REQUEST, /* forget all calls for a tag */
  26. SYNC_FILTER_REQUEST /* forget all calls satisfying match fn */
  27. } SyncRequestType;
  28. /*
  29. * Which set of functions to use to handle a given request. The values of
  30. * the enumerators must match the indexes of the function table in sync.c.
  31. */
  32. typedef enum SyncRequestHandler
  33. {
  34. SYNC_HANDLER_MD = 0 /* md smgr */
  35. } SyncRequestHandler;
  36. /*
  37. * A tag identifying a file. Currently it has the members required for md.c's
  38. * usage, but sync.c has no knowledge of the internal structure, and it is
  39. * liable to change as required by future handlers.
  40. */
  41. typedef struct FileTag
  42. {
  43. int16 handler; /* SyncRequestHandler value, saving space */
  44. int16 forknum; /* ForkNumber, saving space */
  45. RelFileNode rnode;
  46. uint32 segno;
  47. } FileTag;
  48. extern void InitSync(void);
  49. extern void SyncPreCheckpoint(void);
  50. extern void SyncPostCheckpoint(void);
  51. extern void ProcessSyncRequests(void);
  52. extern void RememberSyncRequest(const FileTag *ftag, SyncRequestType type);
  53. extern void EnableSyncRequestForwarding(void);
  54. extern bool RegisterSyncRequest(const FileTag *ftag, SyncRequestType type,
  55. bool retryOnError);
  56. #endif /* SYNC_H */
上海开阖软件有限公司 沪ICP备12045867号-1