Veil
veil_shmem.h File Reference

Define the basic veil shared memory structures. 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  MemContext
 MemContexts are large single chunks of shared memory from which smaller allocations may be made. 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 multiple definitions of the contents of this file.
 
#define CHUNK_SIZE   8192
 Chunks od shared memory are allocated in multiples of this size.
 
#define MAX_ALLOWED_SHMEM   CHUNK_SIZE * 100
 Limits the total amount of memory available for veil shared variables.
 
#define HASH_KEYLEN   60
 The key length for veil hash types.
 

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 MemContext MemContext
 MemContexts are large single chunks of shared memory from which smaller allocations may be made.
 
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 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.
 

Detailed Description

Define the basic veil shared memory structures.

Author: Marc Munro
Copyright (c) 2005 - 2018 Marc Munro
License: BSD

Definition in file veil_shmem.h.

Typedef Documentation

◆ MemChunk

typedef struct MemChunk MemChunk

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.

◆ Object

typedef struct Object Object

General purpose object-type.

All veil variables are effectively sub-types of this.

◆ ShmemCtl

typedef struct ShmemCtl ShmemCtl

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()

◆ Int4Var

typedef struct Int4Var Int4Var

Subtype of Object for storing simple int4 values.

These values are allowed to be null.

◆ Range

typedef struct Range Range

Subtype of Object for storing range values.

A range has an upper and lower bound, both stored as int4s. Nulls are not allowed.

◆ Bitmap

typedef struct Bitmap Bitmap

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.

◆ BitmapRef

typedef struct BitmapRef BitmapRef

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.

◆ BitmapArray

typedef struct BitmapArray BitmapArray

Subtype of Object for storing bitmap arrays.

A bitmap array is simply an array of pointers to dynamically allocated Bitmaps. Note that the size of a Bitmap structure is determined dynamically at run time as the size of the array is only known then.

◆ BitmapHash

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.

◆ VarEntry

typedef struct VarEntry VarEntry

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.

◆ 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,
);