Extension SDK reference¶
This reference is generated from postgamma_extension.h and the exact SDK
documentation inventory.
SDK ABI v1 applies only to extensions selected and compiled into the PostGamma kernel.
Constants¶
| Name | Definition |
|---|---|
PGMEX_ABI_VERSION |
UINT32_C(1) |
PGMEX_CAP_ALL |
UINT64_C(0x03ff) |
PGMEX_CAP_BACKGROUND_WORKER |
(UINT64_C(1) << 5) |
PGMEX_CAP_FILESYSTEM_READ |
(UINT64_C(1) << 6) |
PGMEX_CAP_FILESYSTEM_WRITE |
(UINT64_C(1) << 7) |
PGMEX_CAP_HOST_LIBRARY_DEPENDENCY |
(UINT64_C(1) << 8) |
PGMEX_CAP_INSTANCE_SHMEM |
(UINT64_C(1) << 4) |
PGMEX_CAP_MULTI_INSTANCE_SAFE |
(UINT64_C(1) << 1) |
PGMEX_CAP_PARALLEL_WORKER_SAFE |
(UINT64_C(1) << 3) |
PGMEX_CAP_PROCESS_GLOBAL_STATE |
(UINT64_C(1) << 9) |
PGMEX_CAP_SESSION_MOBILITY_SAFE |
(UINT64_C(1) << 2) |
PGMEX_CAP_THREAD_SAFE |
(UINT64_C(1) << 0) |
PGMEX_PHASE_INSTANCE_REQUEST |
INT32_C(1) |
PGMEX_PHASE_INSTANCE_SHUTDOWN |
INT32_C(3) |
PGMEX_PHASE_INSTANCE_STARTUP |
INT32_C(2) |
PGMEX_PHASE_LIBRARY_INITIALIZE |
INT32_C(0) |
PGMEX_PHASE_SESSION_DESTROY |
INT32_C(6) |
PGMEX_PHASE_SESSION_INITIALIZE |
INT32_C(4) |
PGMEX_PHASE_SESSION_RESET |
INT32_C(5) |
Public typedefs¶
pgmex_context¶
pgmex_descriptor¶
pgmex_library_initialize_callback¶
pgmex_lifecycle_callback¶
pgmex_lifecycle_destroy_callback¶
pgmex_phase¶
Public structures¶
Use the listed initializer whenever the SDK provides one. Immutable extension descriptors are initialized field by field.
pgmex_context¶
Initializer: PGMEX_CONTEXT_INIT
| Field | Type |
|---|---|
struct_size |
uint32_t |
phase |
pgmex_phase |
instance_generation |
uint64_t |
connection_id |
uint64_t |
instance_shared_memory |
void * |
instance_shared_memory_size |
size_t |
session_state |
void * |
session_state_size |
size_t |
pgmex_descriptor¶
| Field | Type |
|---|---|
struct_size |
uint32_t |
abi_version |
uint32_t |
postgresql_major |
uint32_t |
reserved |
uint32_t |
capabilities |
uint64_t |
id |
const char * |
sql_name |
const char * |
version |
const char * |
shared_memory_name |
const char * |
shared_memory_size |
size_t |
shared_memory_alignment |
size_t |
session_state_size |
size_t |
resources |
const char *const * |
resource_count |
size_t |
library_initialize |
pgmex_library_initialize_callback |
instance_request |
pgmex_lifecycle_callback |
instance_startup |
pgmex_lifecycle_callback |
instance_shutdown |
pgmex_lifecycle_destroy_callback |
session_initialize |
pgmex_lifecycle_callback |
session_reset |
pgmex_lifecycle_callback |
session_destroy |
pgmex_lifecycle_destroy_callback |
Functions¶
pgmex_current_connection_id¶
Return the current logical connection identity, or zero for a role without a session.
pgmex_current_instance_generation¶
Return the generation of the instance owning the current PostgreSQL role.
pgmex_instance_shared_memory¶
Return the extension's instance-owned shared-memory region after validating its declared size.
pgmex_register¶
Register one immutable bundled-extension descriptor from the extension's PostgreSQL initialization hook.
pgmex_resource_read¶
int pgmex_resource_read(const char *extension_id, const char *logical_path, size_t offset, void *buffer, size_t capacity, size_t *transferred);
Read a bounded slice of one immutable manifest-declared extension resource.
pgmex_session_state¶
Return the extension's logical-session state after validating its declared size.