2
0

session.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*-------------------------------------------------------------------------
  2. *
  3. * session.h
  4. * Encapsulation of user session.
  5. *
  6. * Copyright (c) 2017-2022, PostgreSQL Global Development Group
  7. *
  8. * src/include/access/session.h
  9. *
  10. *-------------------------------------------------------------------------
  11. */
  12. #ifndef SESSION_H
  13. #define SESSION_H
  14. #include "lib/dshash.h"
  15. /* Avoid including typcache.h */
  16. struct SharedRecordTypmodRegistry;
  17. /*
  18. * A struct encapsulating some elements of a user's session. For now this
  19. * manages state that applies to parallel query, but in principle it could
  20. * include other things that are currently global variables.
  21. */
  22. typedef struct Session
  23. {
  24. dsm_segment *segment; /* The session-scoped DSM segment. */
  25. dsa_area *area; /* The session-scoped DSA area. */
  26. /* State managed by typcache.c. */
  27. struct SharedRecordTypmodRegistry *shared_typmod_registry;
  28. dshash_table *shared_record_table;
  29. dshash_table *shared_typmod_table;
  30. } Session;
  31. extern void InitializeSession(void);
  32. extern dsm_handle GetSessionDsmHandle(void);
  33. extern void AttachSession(dsm_handle handle);
  34. extern void DetachSession(void);
  35. /* The current session, or NULL for none. */
  36. extern PGDLLIMPORT Session *CurrentSession;
  37. #endif /* SESSION_H */