-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use rendezvous variables for set_user post hooks
This patch changes the set_user hooks so that they're held in the rendezvous variable hash map as function pointers, rather than in the set_user .so. This way, we don't have to ensure that set_user comes before any extension that implements them -- load order doesn't matter. Just query the hash map during the hook execution and if there are hooks implemented, call them.
- Loading branch information
1 parent
4543aec
commit 6df909a
Showing
2 changed files
with
24 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
#ifndef SET_USER_H | ||
#define SET_USER_H | ||
|
||
/* Expose a hook for other extensions to use after reset_user finishes up. */ | ||
typedef void (*post_reset_user_hook_type) (void); | ||
extern PGDLLIMPORT post_reset_user_hook_type post_reset_user_hook; | ||
typedef struct SetUserHooks | ||
{ | ||
void (*post_set_user) (const char *username); | ||
void (*post_reset_user) (); | ||
} SetUserHooks; | ||
|
||
#define SET_USER_HOOKS_KEY "SetUserHooks" | ||
|
||
/* Expose a hook for other extensions to use after set_user finishes up. */ | ||
typedef void (*post_set_user_hook_type) (const char *username); | ||
extern PGDLLIMPORT post_set_user_hook_type post_set_user_hook; | ||
#endif |