2012-08-29 00:02:07 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* resowner_private.h
|
|
|
|
* POSTGRES resource owner private definitions.
|
|
|
|
*
|
|
|
|
* See utils/resowner/README for more info.
|
|
|
|
*
|
|
|
|
*
|
2023-01-02 21:00:37 +01:00
|
|
|
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
2012-08-29 00:02:07 +02:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
* src/include/utils/resowner_private.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef RESOWNER_PRIVATE_H
|
|
|
|
#define RESOWNER_PRIVATE_H
|
|
|
|
|
2013-10-10 03:05:02 +02:00
|
|
|
#include "storage/dsm.h"
|
2012-08-29 00:02:07 +02:00
|
|
|
#include "storage/fd.h"
|
|
|
|
#include "storage/lock.h"
|
|
|
|
#include "utils/catcache.h"
|
|
|
|
#include "utils/plancache.h"
|
|
|
|
#include "utils/resowner.h"
|
|
|
|
#include "utils/snapshot.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* support for buffer refcount management */
|
|
|
|
extern void ResourceOwnerEnlargeBuffers(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberBuffer(ResourceOwner owner, Buffer buffer);
|
|
|
|
extern void ResourceOwnerForgetBuffer(ResourceOwner owner, Buffer buffer);
|
|
|
|
|
2023-04-05 22:55:15 +02:00
|
|
|
/* support for IO-in-progress management */
|
|
|
|
extern void ResourceOwnerEnlargeBufferIOs(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberBufferIO(ResourceOwner owner, Buffer buffer);
|
|
|
|
extern void ResourceOwnerForgetBufferIO(ResourceOwner owner, Buffer buffer);
|
|
|
|
|
2012-08-29 00:02:07 +02:00
|
|
|
/* support for local lock management */
|
|
|
|
extern void ResourceOwnerRememberLock(ResourceOwner owner, LOCALLOCK *locallock);
|
|
|
|
extern void ResourceOwnerForgetLock(ResourceOwner owner, LOCALLOCK *locallock);
|
|
|
|
|
|
|
|
/* support for catcache refcount management */
|
|
|
|
extern void ResourceOwnerEnlargeCatCacheRefs(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberCatCacheRef(ResourceOwner owner,
|
|
|
|
HeapTuple tuple);
|
|
|
|
extern void ResourceOwnerForgetCatCacheRef(ResourceOwner owner,
|
|
|
|
HeapTuple tuple);
|
|
|
|
extern void ResourceOwnerEnlargeCatCacheListRefs(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberCatCacheListRef(ResourceOwner owner,
|
|
|
|
CatCList *list);
|
|
|
|
extern void ResourceOwnerForgetCatCacheListRef(ResourceOwner owner,
|
|
|
|
CatCList *list);
|
|
|
|
|
|
|
|
/* support for relcache refcount management */
|
|
|
|
extern void ResourceOwnerEnlargeRelationRefs(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberRelationRef(ResourceOwner owner,
|
|
|
|
Relation rel);
|
|
|
|
extern void ResourceOwnerForgetRelationRef(ResourceOwner owner,
|
|
|
|
Relation rel);
|
|
|
|
|
|
|
|
/* support for plancache refcount management */
|
|
|
|
extern void ResourceOwnerEnlargePlanCacheRefs(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberPlanCacheRef(ResourceOwner owner,
|
|
|
|
CachedPlan *plan);
|
|
|
|
extern void ResourceOwnerForgetPlanCacheRef(ResourceOwner owner,
|
|
|
|
CachedPlan *plan);
|
|
|
|
|
|
|
|
/* support for tupledesc refcount management */
|
|
|
|
extern void ResourceOwnerEnlargeTupleDescs(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberTupleDesc(ResourceOwner owner,
|
|
|
|
TupleDesc tupdesc);
|
|
|
|
extern void ResourceOwnerForgetTupleDesc(ResourceOwner owner,
|
|
|
|
TupleDesc tupdesc);
|
|
|
|
|
|
|
|
/* support for snapshot refcount management */
|
|
|
|
extern void ResourceOwnerEnlargeSnapshots(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberSnapshot(ResourceOwner owner,
|
|
|
|
Snapshot snapshot);
|
|
|
|
extern void ResourceOwnerForgetSnapshot(ResourceOwner owner,
|
|
|
|
Snapshot snapshot);
|
|
|
|
|
|
|
|
/* support for temporary file management */
|
|
|
|
extern void ResourceOwnerEnlargeFiles(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberFile(ResourceOwner owner,
|
|
|
|
File file);
|
|
|
|
extern void ResourceOwnerForgetFile(ResourceOwner owner,
|
|
|
|
File file);
|
|
|
|
|
2013-10-10 03:05:02 +02:00
|
|
|
/* support for dynamic shared memory management */
|
|
|
|
extern void ResourceOwnerEnlargeDSMs(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberDSM(ResourceOwner owner,
|
|
|
|
dsm_segment *);
|
|
|
|
extern void ResourceOwnerForgetDSM(ResourceOwner owner,
|
|
|
|
dsm_segment *);
|
|
|
|
|
2018-03-22 03:28:28 +01:00
|
|
|
/* support for JITContext management */
|
|
|
|
extern void ResourceOwnerEnlargeJIT(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberJIT(ResourceOwner owner,
|
|
|
|
Datum handle);
|
|
|
|
extern void ResourceOwnerForgetJIT(ResourceOwner owner,
|
|
|
|
Datum handle);
|
|
|
|
|
2020-12-04 02:49:23 +01:00
|
|
|
/* support for cryptohash context management */
|
|
|
|
extern void ResourceOwnerEnlargeCryptoHash(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberCryptoHash(ResourceOwner owner,
|
|
|
|
Datum handle);
|
|
|
|
extern void ResourceOwnerForgetCryptoHash(ResourceOwner owner,
|
|
|
|
Datum handle);
|
|
|
|
|
Refactor HMAC implementations
Similarly to the cryptohash implementations, this refactors the existing
HMAC code into a single set of APIs that can be plugged with any crypto
libraries PostgreSQL is built with (only OpenSSL currently). If there
is no such libraries, a fallback implementation is available. Those new
APIs are designed similarly to the existing cryptohash layer, so there
is no real new design here, with the same logic around buffer bound
checks and memory handling.
HMAC has a dependency on cryptohashes, so all the cryptohash types
supported by cryptohash{_openssl}.c can be used with HMAC. This
refactoring is an advantage mainly for SCRAM, that included its own
implementation of HMAC with SHA256 without relying on the existing
crypto libraries even if PostgreSQL was built with their support.
This code has been tested on Windows and Linux, with and without
OpenSSL, across all the versions supported on HEAD from 1.1.1 down to
1.0.1. I have also checked that the implementations are working fine
using some sample results, a custom extension of my own, and doing
cross-checks across different major versions with SCRAM with the client
and the backend.
Author: Michael Paquier
Reviewed-by: Bruce Momjian
Discussion: https://postgr.es/m/X9m0nkEJEzIPXjeZ@paquier.xyz
2021-04-03 10:30:49 +02:00
|
|
|
/* support for HMAC context management */
|
|
|
|
extern void ResourceOwnerEnlargeHMAC(ResourceOwner owner);
|
|
|
|
extern void ResourceOwnerRememberHMAC(ResourceOwner owner,
|
|
|
|
Datum handle);
|
|
|
|
extern void ResourceOwnerForgetHMAC(ResourceOwner owner,
|
|
|
|
Datum handle);
|
|
|
|
|
2012-08-29 00:02:07 +02:00
|
|
|
#endif /* RESOWNER_PRIVATE_H */
|