message.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*-------------------------------------------------------------------------
  2. * message.h
  3. * Exports from replication/logical/message.c
  4. *
  5. * Copyright (c) 2013-2016, PostgreSQL Global Development Group
  6. *
  7. * src/include/replication/message.h
  8. *-------------------------------------------------------------------------
  9. */
  10. #ifndef PG_LOGICAL_MESSAGE_H
  11. #define PG_LOGICAL_MESSAGE_H
  12. #include "access/xlog.h"
  13. #include "access/xlogdefs.h"
  14. #include "access/xlogreader.h"
  15. /*
  16. * Generic logical decoding message wal record.
  17. */
  18. typedef struct xl_logical_message
  19. {
  20. Oid dbId; /* database Oid emitted from */
  21. bool transactional; /* is message transactional? */
  22. Size prefix_size; /* length of prefix */
  23. Size message_size; /* size of the message */
  24. char message[FLEXIBLE_ARRAY_MEMBER]; /* message including the null
  25. * terminated prefix of length
  26. * prefix_size */
  27. } xl_logical_message;
  28. #define SizeOfLogicalMessage (offsetof(xl_logical_message, message))
  29. extern XLogRecPtr LogLogicalMessage(const char *prefix, const char *message,
  30. size_t size, bool transactional);
  31. /* RMGR API*/
  32. #define XLOG_LOGICAL_MESSAGE 0x00
  33. void logicalmsg_redo(XLogReaderState *record);
  34. void logicalmsg_desc(StringInfo buf, XLogReaderState *record);
  35. const char *logicalmsg_identify(uint8 info);
  36. #endif /* PG_LOGICAL_MESSAGE_H */