codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * session.h4 * Encapsulation of user session.5 *6 * Copyright (c) 2017-2023, PostgreSQL Global Development Group7 *8 * src/include/access/session.h9 *10 *-------------------------------------------------------------------------11 */12#ifndef SESSION_H13#define SESSION_H14 15#include "lib/dshash.h"16 17/* Avoid including typcache.h */18struct SharedRecordTypmodRegistry;19 20/*21 * A struct encapsulating some elements of a user's session. For now this22 * manages state that applies to parallel query, but in principle it could23 * include other things that are currently global variables.24 */25typedef struct Session26{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 36extern void InitializeSession(void);37extern dsm_handle GetSessionDsmHandle(void);38extern void AttachSession(dsm_handle handle);39extern void DetachSession(void);40 41/* The current session, or NULL for none. */42extern PGDLLIMPORT Session *CurrentSession;43 44#endif /* SESSION_H */45 