tablespace.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*-------------------------------------------------------------------------
  2. *
  3. * tablespace.h
  4. * Tablespace management commands (create/drop tablespace).
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/commands/tablespace.h
  11. *
  12. *-------------------------------------------------------------------------
  13. */
  14. #ifndef TABLESPACE_H
  15. #define TABLESPACE_H
  16. #include "access/xlogreader.h"
  17. #include "catalog/objectaddress.h"
  18. #include "lib/stringinfo.h"
  19. #include "nodes/parsenodes.h"
  20. /* XLOG stuff */
  21. #define XLOG_TBLSPC_CREATE 0x00
  22. #define XLOG_TBLSPC_DROP 0x10
  23. typedef struct xl_tblspc_create_rec
  24. {
  25. Oid ts_id;
  26. char ts_path[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string */
  27. } xl_tblspc_create_rec;
  28. typedef struct xl_tblspc_drop_rec
  29. {
  30. Oid ts_id;
  31. } xl_tblspc_drop_rec;
  32. typedef struct TableSpaceOpts
  33. {
  34. int32 vl_len_; /* varlena header (do not touch directly!) */
  35. float8 random_page_cost;
  36. float8 seq_page_cost;
  37. int effective_io_concurrency;
  38. } TableSpaceOpts;
  39. extern Oid CreateTableSpace(CreateTableSpaceStmt *stmt);
  40. extern void DropTableSpace(DropTableSpaceStmt *stmt);
  41. extern ObjectAddress RenameTableSpace(const char *oldname, const char *newname);
  42. extern Oid AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt);
  43. extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo);
  44. extern Oid GetDefaultTablespace(char relpersistence);
  45. extern void PrepareTempTablespaces(void);
  46. extern Oid get_tablespace_oid(const char *tablespacename, bool missing_ok);
  47. extern char *get_tablespace_name(Oid spc_oid);
  48. extern bool directory_is_empty(const char *path);
  49. extern void remove_tablespace_symlink(const char *linkloc);
  50. extern void tblspc_redo(XLogReaderState *rptr);
  51. extern void tblspc_desc(StringInfo buf, XLogReaderState *rptr);
  52. extern const char *tblspc_identify(uint8 info);
  53. #endif /* TABLESPACE_H */