PostgreSQL Source Code  git master
toast_internals.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * toast_internals.h
4  * Internal definitions for the TOAST system.
5  *
6  * Copyright (c) 2000-2019, PostgreSQL Global Development Group
7  *
8  * src/include/access/toast_internals.h
9  *
10  *-------------------------------------------------------------------------
11  */
12 #ifndef TOAST_INTERNALS_H
13 #define TOAST_INTERNALS_H
14 
15 #include "storage/lockdefs.h"
16 #include "utils/relcache.h"
17 #include "utils/snapshot.h"
18 
19 /*
20  * The information at the start of the compressed toast data.
21  */
22 typedef struct toast_compress_header
23 {
24  int32 vl_len_; /* varlena header (do not touch directly!) */
27 
28 /*
29  * Utilities for manipulation of header information for compressed
30  * toast entries.
31  */
32 #define TOAST_COMPRESS_HDRSZ ((int32) sizeof(toast_compress_header))
33 #define TOAST_COMPRESS_RAWSIZE(ptr) (((toast_compress_header *) (ptr))->rawsize)
34 #define TOAST_COMPRESS_SIZE(ptr) ((int32) VARSIZE_ANY(ptr) - TOAST_COMPRESS_HDRSZ)
35 #define TOAST_COMPRESS_RAWDATA(ptr) \
36  (((char *) (ptr)) + TOAST_COMPRESS_HDRSZ)
37 #define TOAST_COMPRESS_SET_RAWSIZE(ptr, len) \
38  (((toast_compress_header *) (ptr))->rawsize = (len))
39 
41 extern Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock);
42 
43 extern void toast_delete_datum(Relation rel, Datum value, bool is_speculative);
45  struct varlena *oldexternal, int options);
46 
47 extern int toast_open_indexes(Relation toastrel,
48  LOCKMODE lock,
49  Relation **toastidxs,
50  int *num_indexes);
51 extern void toast_close_indexes(Relation *toastidxs, int num_indexes,
52  LOCKMODE lock);
53 extern void init_toast_snapshot(Snapshot toast_snapshot);
54 
55 #endif /* TOAST_INTERNALS_H */
void toast_close_indexes(Relation *toastidxs, int num_indexes, LOCKMODE lock)
int LOCKMODE
Definition: lockdefs.h:26
static struct @145 value
void toast_delete_datum(Relation rel, Datum value, bool is_speculative)
unsigned int Oid
Definition: postgres_ext.h:31
signed int int32
Definition: c.h:347
struct toast_compress_header toast_compress_header
int toast_open_indexes(Relation toastrel, LOCKMODE lock, Relation **toastidxs, int *num_indexes)
Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock)
uintptr_t Datum
Definition: postgres.h:367
void init_toast_snapshot(Snapshot toast_snapshot)
Datum toast_compress_datum(Datum value)
Datum toast_save_datum(Relation rel, Datum value, struct varlena *oldexternal, int options)
Definition: c.h:550