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