Veil
|
Define all Veil public datatypes. More...
#include "utils/hsearch.h"
#include "storage/lwlock.h"
Go to the source code of this file.
Data Structures | |
struct | MemChunk |
Chunks provide a linked list of dynamically allocated shared memory segments, with the most recently allocated chunk at the tail. More... | |
struct | Object |
General purpose object-type. More... | |
struct | ShmemCtl |
The ShmemCtl structure is the first object allocated from the first chunk of shared memory in context 0. More... | |
struct | Int4Var |
Subtype of Object for storing simple int4 values. More... | |
struct | Range |
Subtype of Object for storing range values. More... | |
struct | Bitmap |
Subtype of Object for storing bitmaps. More... | |
struct | BitmapRef |
Subtype of Object for storing bitmap refs. More... | |
struct | BitmapArray |
Subtype of Object for storing bitmap arrays. More... | |
struct | BitmapHash |
Subtype of Object for storing bitmap hashes. More... | |
struct | Int4Array |
Subtype of Object for storing arrays of integers. More... | |
struct | VarEntry |
A Veil variable. More... | |
struct | veil_variable_t |
Describes a veil shared or session variable. More... | |
Macros | |
#define | VEIL_DATATYPES 1 |
Prevent this header from being included multiple times. | |
#define | VEIL_DEBUG 1 |
Enables various debugging constructs, such as canaries, in code and data structures. More... | |
#define | DBG_CANARY 0xca96ca96 |
Value to be set in sacrificial "canary" fields. More... | |
#define | DBG_CANARY_ENTRY int32 canary; |
Defines a canary element in a data structure. | |
#define | DBG_ELEMS_ENTRY int32 dbgelems; |
Field to record the size of an array so that its canary element can be found. | |
#define | DBG_SET_ELEMS(x, y) (x).dbgelems = y |
Code to records the size of an array so that its canary element can be found. | |
#define | DBG_SET_CANARY(x) (x).canary = DBG_CANARY |
Code to initialise a canary. | |
#define | DBG_TEST_CANARY(x) |
Code to test for a canary having been overwritten. More... | |
#define | EMPTY 1 |
Base size for an array containing a canary. More... | |
#define | DBG_SET_TRAILER(x, y) (x).y[(x).dbgelems] = DBG_CANARY; |
Set a trailing canary in an array. | |
#define | DBG_SET_TRAILERP(x, y) (x).y[(x).dbgelems] = (void *) DBG_CANARY; |
Set a trailing canary in an array (using a void pointer). | |
#define | DBG_TEST_TRAILER(x, y) |
Test the trailing canary in an array. More... | |
#define | DBG_CHECK_INDEX(x, i) |
Check whether an array index is in bounds. More... | |
#define | HASH_KEYLEN 60 |
The key length for veil hash types. | |
#define | BITZERO(x) (x & 0xffffffe0) |
Gives the bitmask index for the bitzero value of a Bitmap. More... | |
#define | BITMAX(x) (x | 0x1f) |
Gives the bitmask index for the bitmax value of a bitmap. More... | |
#define | BITSET_ELEM(x) (x >> 5) |
Gives the index of a bit within the array of 32-bit words that comprise the bitmap. More... | |
#define | BITSET_BIT(x) (x & 0x1f) |
Gives the index into bitmasks for the bit specified in x. More... | |
#define | ARRAYELEMS(min, max) (((max - BITZERO(min)) >> 5) + 1) |
Gives the number of array elements in a Bitmap that runs from element min to element max. More... | |
#define | MIN(a, b) ((a < b)? a: b) |
Return the smaller of a or b. More... | |
Typedefs | |
typedef struct MemChunk | MemChunk |
Chunks provide a linked list of dynamically allocated shared memory segments, with the most recently allocated chunk at the tail. More... | |
typedef struct Object | Object |
General purpose object-type. More... | |
typedef struct ShmemCtl | ShmemCtl |
The ShmemCtl structure is the first object allocated from the first chunk of shared memory in context 0. More... | |
typedef struct Int4Var | Int4Var |
Subtype of Object for storing simple int4 values. More... | |
typedef struct Range | Range |
Subtype of Object for storing range values. More... | |
typedef uint32 | bm_int |
typedef struct Bitmap | Bitmap |
Subtype of Object for storing bitmaps. More... | |
typedef struct BitmapRef | BitmapRef |
Subtype of Object for storing bitmap refs. More... | |
typedef struct BitmapArray | BitmapArray |
Subtype of Object for storing bitmap arrays. More... | |
typedef struct BitmapHash | BitmapHash |
Subtype of Object for storing bitmap hashes. More... | |
typedef struct Int4Array | Int4Array |
Subtype of Object for storing arrays of integers. | |
typedef struct VarEntry | VarEntry |
A Veil variable. More... | |
typedef struct veil_variable_t | veil_variable_t |
Describes a veil shared or session variable. More... | |
Enumerations | |
enum | ObjType { OBJ_UNDEFINED = 0, OBJ_SHMEMCTL, OBJ_INT4, OBJ_RANGE, OBJ_BITMAP, OBJ_BITMAP_ARRAY, OBJ_BITMAP_HASH, OBJ_BITMAP_REF, OBJ_INT4_ARRAY, OBJ_UNDEFINED = 0, OBJ_SHMEMCTL, OBJ_INT4, OBJ_RANGE, OBJ_BITMAP, OBJ_BITMAP_ARRAY, OBJ_BITMAP_HASH, OBJ_BITMAP_REF, OBJ_INT4_ARRAY } |
Describes the type of an Object record or one of its subtypes. | |
Define all Veil public datatypes.
Definition in file veil_datatypes.h.
#define VEIL_DEBUG 1 |
Enables various debugging constructs, such as canaries, in code and data structures.
If such debugging is required, define VEIL_DEBUG in the make invocation, eg: "make VEIL_DEBUG=1".
Definition at line 27 of file veil_datatypes.h.
#define DBG_CANARY 0xca96ca96 |
Value to be set in sacrificial "canary" fields.
If this value is not as expected, the canary has been killed by something inappropriately stomping on memory.
Definition at line 36 of file veil_datatypes.h.
#define DBG_TEST_CANARY | ( | x | ) |
Code to test for a canary having been overwritten.
Definition at line 63 of file veil_datatypes.h.
Referenced by vl_BitmapFromArray(), vl_BitmapSetbit(), vl_ClearBitmapArray(), and vl_NewBitmapArray().
#define EMPTY 1 |
Base size for an array containing a canary.
This is zero if VEIL_DEBUG is not defined, when this is defined arrays will be one element longer to allow a canary to be placed at the end of the array.
Definition at line 71 of file veil_datatypes.h.
#define DBG_TEST_TRAILER | ( | x, | |
y | |||
) |
Test the trailing canary in an array.
Definition at line 85 of file veil_datatypes.h.
Referenced by vl_BitmapFromArray(), vl_BitmapSetbit(), vl_ClearBitmapArray(), and vl_NewBitmapArray().
#define DBG_CHECK_INDEX | ( | x, | |
i | |||
) |
Check whether an array index is in bounds.
Definition at line 92 of file veil_datatypes.h.
Referenced by vl_BitmapFromArray(), vl_BitmapSetbit(), and vl_ClearBitmapArray().
#define BITZERO | ( | x | ) | (x & 0xffffffe0) |
Gives the bitmask index for the bitzero value of a Bitmap.
This is part of the "normalisation" process for bitmap ranges. This process allows unlike bitmaps to be more easily compared by forcing bitmap indexes to be normalised around 32 or 64 bit word boundaries. Eg, 2 bitmaps with domains 1 to 50 and 3 to 55, will have identical bit patterns for bits 3 to 50.
x | The bitzero value of a bitmap |
Definition at line 229 of file veil_datatypes.h.
Referenced by vl_BitmapClearbit(), vl_BitmapSetbit(), and vl_BitmapTestbit().
#define BITMAX | ( | x | ) | (x | 0x1f) |
Gives the bitmask index for the bitmax value of a bitmap.
See BITZERO() for more information.
x | The bitmax value of a bitmap |
Definition at line 243 of file veil_datatypes.h.
#define BITSET_ELEM | ( | x | ) | (x >> 5) |
Gives the index of a bit within the array of 32-bit words that comprise the bitmap.
x | The bit in question |
Definition at line 257 of file veil_datatypes.h.
Referenced by vl_BitmapClearbit(), vl_BitmapSetbit(), and vl_BitmapTestbit().
#define BITSET_BIT | ( | x | ) | (x & 0x1f) |
Gives the index into bitmasks for the bit specified in x.
x | The bit in question |
Definition at line 270 of file veil_datatypes.h.
Referenced by vl_BitmapClearbit(), vl_BitmapSetbit(), and vl_BitmapTestbit().
#define ARRAYELEMS | ( | min, | |
max | |||
) | (((max - BITZERO(min)) >> 5) + 1) |
Gives the number of array elements in a Bitmap that runs from element min to element max.
min | |
max |
Definition at line 285 of file veil_datatypes.h.
Referenced by deserialise_one_bitmap(), serialise_bitmap(), serialise_bitmap_array(), serialise_bitmap_hash(), serialise_one_bitmap(), vl_BitmapIntersect(), vl_BitmapUnion(), vl_ClearBitmap(), vl_NewBitmap(), and vl_NewBitmapArray().
#define MIN | ( | a, | |
b | |||
) | ((a < b)? a: b) |
Return the smaller of a or b.
Note that expressions a and b may be evaluated more than once.
a | |
b |
Definition at line 298 of file veil_datatypes.h.
Chunks provide a linked list of dynamically allocated shared memory segments, with the most recently allocated chunk at the tail.
Shmalloc allocates space from this list of chunks, creating new chunks as needed up to MAX_ALLOWED_SHMEM.
General purpose object-type.
All veil variables are effectively sub-types of this.
The ShmemCtl structure is the first object allocated from the first chunk of shared memory in context 0.
This object describes and manages shared memory allocated by shmalloc()
Subtype of Object for storing simple int4 values.
These values are allowed to be null.
Subtype of Object for storing range values.
A range has an upper and lower bound, both stored as int4s. Nulls are not allowed.
Subtype of Object for storing bitmaps.
A bitmap is stored as an array of int4 values. See veil_bitmap.c for more information. Note that the size of a Bitmap structure is determined dynamically at run time as the size of the array is only known then.
Subtype of Object for storing bitmap refs.
A bitmapref is like a bitmap but instead of containing a bitmap it contains a reference to one. This reference may be set during a transaction and then referenced only from within the setting transaction.
typedef struct BitmapArray BitmapArray |
typedef struct BitmapHash BitmapHash |
Subtype of Object for storing bitmap hashes.
A bitmap hash is a hash of dynamically allocated bitmaps, keyed by strings. Note that these cannot be created as shared variables.
A Veil variable.
These may be session or shared variables, and may contain any Veil variable type. They are created and accessed by vl_lookup_shared_variable() and vl_lookup_variable(), and are stored in either the shared hash or one of the session hashes. See veil_shmem.c and veil_variables.c for more details.
typedef struct veil_variable_t veil_variable_t |
Describes a veil shared or session variable.
This matches the SQL veil_variable_t which is defined as:
create type veil_variable_t as ( name text, type text, shared bool, );