Veil
|
Provide definitions for all non-local C-callable Veil functions. More...
Go to the source code of this file.
Functions | |
void * | vl_malloc (size_t size) |
Dynamically allocate memory using palloc in TopMemoryContext. More... | |
char * | vl_ObjTypeName (ObjType obj) |
Return a static string describing an ObjType object. More... | |
VarEntry * | vl_lookup_shared_variable (char *name) |
Define a new, or attach to an existing, shared variable. More... | |
VarEntry * | vl_lookup_variable (char *name) |
Lookup a variable by name, creating it as as a session variable if it does not already exist. More... | |
veil_variable_t * | vl_next_variable (veil_variable_t *prev) |
Return the next variable from a scan of the hash of variables. More... | |
void | vl_ClearInt4Array (Int4Array *array) |
Reset all Int4 entries in an Int4Array (to zero). More... | |
Int4Array * | vl_NewInt4Array (Int4Array *current, bool shared, int32 min, int32 max) |
Return a newly initialised (zeroed) Int4Array. More... | |
void | vl_Int4ArraySet (Int4Array *array, int32 idx, int32 value) |
Set an entry within an Int4Array. More... | |
int32 | vl_Int4ArrayGet (Int4Array *array, int32 idx) |
Get an entry from an Int4Array. More... | |
Range * | vl_NewRange (bool shared) |
Create a new session or shared Range object. More... | |
Int4Var * | vl_NewInt4 (bool shared) |
Create a new session or shared Int4Var object. More... | |
void | vl_ClearBitmap (Bitmap *bitmap) |
Clear all bits in a Bitmap. More... | |
void | vl_NewBitmap (Bitmap **p_bitmap, bool shared, int32 min, int32 max) |
Return a newly initialised (empty) Bitmap. More... | |
void | vl_BitmapSetbit (Bitmap *bitmap, int32 bit) |
Set a bit within a Bitmap. More... | |
void | vl_BitmapClearbit (Bitmap *bitmap, int32 bit) |
Clear a bit within a Bitmap. More... | |
bool | vl_BitmapTestbit (Bitmap *bitmap, int32 bit) |
Test a bit within a Bitmap. More... | |
void | vl_BitmapUnion (Bitmap *target, Bitmap *source) |
Create the union of two bitmaps, updating the first with the result. More... | |
void | vl_BitmapIntersect (Bitmap *target, Bitmap *source) |
Create the intersection of two bitmaps, updating the first with the result. More... | |
int32 | vl_BitmapNextBit (Bitmap *bitmap, int32 bit, bool *found) |
Return the next set bit in the Bitmap. More... | |
Bitmap * | vl_BitmapFromArray (BitmapArray *bmarray, int32 elem) |
Return a specified Bitmap from a BitmapArray. More... | |
void | vl_ClearBitmapArray (BitmapArray *bmarray) |
Clear all bitmaps in the given BitmapArray. More... | |
void | vl_NewBitmapArray (BitmapArray **p_bmarray, bool shared, int32 arrayzero, int32 arraymax, int32 bitzero, int32 bitmax) |
Return a newly initialised (empty) BitmapArray. More... | |
VarEntry * | vl_NextHashEntry (HTAB *hash, VarEntry *prev) |
Utility function for scanning the hash table of a BitmapHash. More... | |
void | vl_NewBitmapHash (BitmapHash **p_bmhash, char *name, int32 bitzero, int32 bitmax) |
Return a newly initialised (empty) BitmapHash. More... | |
Bitmap * | vl_BitmapFromHash (BitmapHash *bmhash, char *hashelem) |
Return a specified Bitmap from a BitmapHash. More... | |
Bitmap * | vl_AddBitmapToHash (BitmapHash *bmhash, char *hashelem) |
Create a newly allocated empty Bitmap to a BitmapHash. More... | |
bool | vl_BitmapHashHasKey (BitmapHash *bmhash, char *hashelem) |
Determine whether the supplied key exists in the BitmapHash. More... | |
HTAB * | vl_get_shared_hash (void) |
Return the shared hash for the current context. More... | |
bool | vl_prepare_context_switch (void) |
Prepare for a switch to the alternate context. More... | |
bool | vl_complete_context_switch (void) |
Complete the context switch started by vl_prepare_context_switch(). More... | |
void | vl_force_context_switch (void) |
In desparation, if we are unable to complete a context switch, we should use this function. | |
void * | vl_shmalloc (size_t size) |
Dynamically allocate a piece of shared memory from the current context. More... | |
void | vl_free (void *mem) |
Free a piece of shared memory within the current context. More... | |
void | _PG_init (void) |
Veil's startup function. More... | |
int | vl_spi_connect (bool *p_pushed) |
If already connected in this session, push the current connection, and get a new one. More... | |
int | vl_spi_finish (bool pushed) |
Reciprocal function for vl_spi_connect() | |
bool | vl_bool_from_query (const char *qry, bool *result) |
Executes a query that returns a single bool value. More... | |
bool | vl_db_exists (Oid db_id) |
Determine whether the given oid represents an existing database or not. More... | |
int | vl_call_init_fns (bool param) |
Identify any registered init_functions and execute them. More... | |
void | veil_config_init (void) |
Initialise Veil's use of GUC variables. | |
void | veil_load_config (void) |
Retrieve Veil's GUC variables for this session. | |
int | veil_shared_hash_elems (void) |
Return the number of entries that should be allocated for shared variables in our shared hashes. More... | |
int | veil_dbs_in_cluster (void) |
Return the number of databases, within the database cluster, that will use Veil. More... | |
int | veil_shmem_context_size (void) |
Return the amount of shared memory to be requested for each of the two shared memory contexts. More... | |
void | vl_type_mismatch (char *name, ObjType expected, ObjType got) |
Report, by raising an error, a type mismatch between the expected and actual type of a VarEntry variable. More... | |
Datum | veil_variables (PG_FUNCTION_ARGS) |
veil_variables() returns setof veil_variable_t Return a veil_variable_t record for each defined variable. More... | |
Datum | veil_share (PG_FUNCTION_ARGS) |
veil_share(name text) returns bool Define a shared variable called NAME, returning true. More... | |
Datum | veil_init_range (PG_FUNCTION_ARGS) |
veil_init_range(name text, min int4, max int4) returns int4 Initialise a Range variable called NAME constrained by MIN and MAX, returning the number of elements in the range. More... | |
Datum | veil_range (PG_FUNCTION_ARGS) |
veil_range(name text) returns veil_range_t Return the range (as a SQL veil_range_t composite type) from the named variable. More... | |
Datum | veil_init_bitmap (PG_FUNCTION_ARGS) |
veil_init_bitmap(bitmap_name text, range_nametext) returns bool Create or re-initialise a Bitmap, for dealing with a named range of values. More... | |
Datum | veil_clear_bitmap (PG_FUNCTION_ARGS) |
veil_clear_bitmap(name text) returns bool Clear all bits in the specified Bitmap. More... | |
Datum | veil_bitmap_setbit (PG_FUNCTION_ARGS) |
veil_bitmap_setbit(name text, bit_number int4) returns bool Set the specified bit in the specified Bitmap. More... | |
Datum | veil_bitmap_clearbit (PG_FUNCTION_ARGS) |
veil_bitmap_clearbit(name int4, bit_number text) returns bool Clear the specified bit in the specified Bitmap. More... | |
Datum | veil_bitmap_testbit (PG_FUNCTION_ARGS) |
veil_bitmap_testbit(name text, bit_number int4) returns bool Test the specified bit in the specified Bitmap, returning true if it is set. More... | |
Datum | veil_bitmap_union (PG_FUNCTION_ARGS) |
veil_bitmap_union(result_name text, name2 text) returns bool Union the bitmap specified in parameter 1 with that in parameter 2, with the result in parameter 1. More... | |
Datum | veil_bitmap_intersect (PG_FUNCTION_ARGS) |
veil_bitmap_intersect(result_name text, name2 text) returns bool Intersect the bitmap specified in parameter 1 with that in parameter 2, with the result in parameter 1. More... | |
Datum | veil_bitmap_bits (PG_FUNCTION_ARGS) |
veil_bitmap_bits(name text) returns setof int4 Return the set of all bits set in the specified Bitmap or BitmapRef. More... | |
Datum | veil_bitmap_range (PG_FUNCTION_ARGS) |
veil_bitmap_range(name text) returns veil_range_t Return composite type giving the range of the specified Bitmap or BitmapRef. More... | |
Datum | veil_init_bitmap_array (PG_FUNCTION_ARGS) |
veil_init_bitmap_array(text, text, text) returns bool Create or reset a BitmapArray. More... | |
Datum | veil_clear_bitmap_array (PG_FUNCTION_ARGS) |
veil_clear_bitmap_array(bmarray text) returns bool Clear the bits in an existing BitmapArray. More... | |
Datum | veil_bitmap_from_array (PG_FUNCTION_ARGS) |
veil_bitmap_from_array(bmref text, bmarray text, index int4) returns text Place a reference to the specified Bitmap from a BitmapArray into the specified BitmapRef An error will be raised if any parameter is not of the correct type. More... | |
Datum | veil_bitmap_array_testbit (PG_FUNCTION_ARGS) |
veil_bitmap_array_testbit(bmarray text, arr_idx int4, bitno int4) returns bool Test a specified bit within a BitmapArray More... | |
Datum | veil_bitmap_array_setbit (PG_FUNCTION_ARGS) |
veil_bitmap_array_setbit(bmarray text, arr_idx int4, bitno int4) returns bool Set a specified bit within a BitmapArray More... | |
Datum | veil_bitmap_array_clearbit (PG_FUNCTION_ARGS) |
veil_bitmap_array_clearbit(bmarray text, arr_idx int4, bitno int4) returns bool Clear a specified bit within a BitmapArray More... | |
Datum | veil_union_from_bitmap_array (PG_FUNCTION_ARGS) |
veil_union_from_bitmap_array(bitmap text, bmarray text, arr_idx int4) returns bool Union a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the first parameter. More... | |
Datum | veil_intersect_from_bitmap_array (PG_FUNCTION_ARGS) |
veil_intersect_from_bitmap_array(bitmap text, bmarray text, arr_idx int4) returns bool Intersect a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the first parameter. More... | |
Datum | veil_bitmap_array_bits (PG_FUNCTION_ARGS) |
veil_bitmap_array_bits(bmarray text, arr_idx int4) returns setof int4 Return the set of all bits set in the specified Bitmap from the BitmapArray. More... | |
Datum | veil_bitmap_array_arange (PG_FUNCTION_ARGS) |
veil_bitmap_array_arange(bmarray text) returns veil_range_t Return composite type giving the range of the array part of the specified BitmapArray More... | |
Datum | veil_bitmap_array_brange (PG_FUNCTION_ARGS) |
veil_bitmap_array_brange(bmarray text) returns veil_range_t Return composite type giving the range of every Bitmap within the BitmapArray. More... | |
Datum | veil_init_bitmap_hash (PG_FUNCTION_ARGS) |
veil_init_bitmap_hash(bmhash text, range text) returns bool Create or reset a BitmapHash. More... | |
Datum | veil_clear_bitmap_hash (PG_FUNCTION_ARGS) |
veil_clear_bitmap_hash(bmhash text) returns bool Clear the bits in an existing BitmapHash. More... | |
Datum | veil_bitmap_hash_key_exists (PG_FUNCTION_ARGS) |
veil_bitmap_hashkey_exists(bmhash text, key text) returns bool Return true if the key exists in the bitmap hash. More... | |
Datum | veil_bitmap_from_hash (PG_FUNCTION_ARGS) |
veil_bitmap_from_hash(bmref text, bmhash text, key text) returns text Place a reference to the specified Bitmap from a BitmapHash into the specified BitmapRef An error will be raised if any parameter is not of the correct type. More... | |
Datum | veil_bitmap_hash_testbit (PG_FUNCTION_ARGS) |
veil_bitmap_hash_testbit(bmhash text, key text, bitno int4) returns bool Test a specified bit within a BitmapHash More... | |
Datum | veil_bitmap_hash_setbit (PG_FUNCTION_ARGS) |
veil_bitmap_hash_setbit(bmhash text, key text, bitno int4) returns bool Set a specified bit within a BitmapHash More... | |
Datum | veil_bitmap_hash_clearbit (PG_FUNCTION_ARGS) |
veil_bitmap_hash_clearbit(bmhash text, key text, bitno int4) returns bool Clear a specified bit within a BitmapHash More... | |
Datum | veil_union_into_bitmap_hash (PG_FUNCTION_ARGS) |
veil_union_into_bitmap_hash(bmhash text, key text, bitmap text) returns bool Union a Bitmap with the specified Bitmap from a BitmapHash with the result placed into the bitmap hash. More... | |
Datum | veil_union_from_bitmap_hash (PG_FUNCTION_ARGS) |
veil_union_from_bitmap_hash(bmhash text, key text, bitmap text) returns bool Union a Bitmap with the specified Bitmap from a BitmapHash with the result placed into the bitmap parameter. More... | |
Datum | veil_intersect_from_bitmap_hash (PG_FUNCTION_ARGS) |
veil_intersect_from_bitmap_hash(bitmap text, bmhash text, key text) returns bool Intersect a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the bitmap parameter. More... | |
Datum | veil_bitmap_hash_bits (PG_FUNCTION_ARGS) |
veil_bitmap_hash_bits(bmhash text, key text) returns setof int4 Return the set of all bits set in the specified Bitmap from the BitmapHash. More... | |
Datum | veil_bitmap_hash_entries (PG_FUNCTION_ARGS) |
veil_bitmap_hash_entries(bmhash text) returns setof text Return the key of every Bitmap within the BitmapHash. More... | |
Datum | veil_bitmap_hash_range (PG_FUNCTION_ARGS) |
veil_bitmap_hash_range(bmhash text) returns veil_range_t Return composite type giving the range of every Bitmap within the BitmapHash. More... | |
Datum | veil_int4_set (PG_FUNCTION_ARGS) |
veil_int4_set(name text,value int4) returns int4 Set an Int4Var variable type to a specified value. More... | |
Datum | veil_int4_get (PG_FUNCTION_ARGS) |
veil_int4_get(name text) returns int4 Return the value of an Int4Var variable. More... | |
Datum | veil_init_int4array (PG_FUNCTION_ARGS) |
veil_init_int4array(arrayname text, range text) returns bool Initialise an Int4Array variable. More... | |
Datum | veil_clear_int4array (PG_FUNCTION_ARGS) |
veil_clear_int4array(name text) returns bool Clear an Int4Array variable. More... | |
Datum | veil_int4array_set (PG_FUNCTION_ARGS) |
veil_int4array_set(array text, idx int4, value int4) returns int4 Set an Int4Array entry. More... | |
Datum | veil_int4array_get (PG_FUNCTION_ARGS) |
veil_int4array_get(array text, idx int4) returns int4 Get an Int4Array entry. More... | |
Datum | veil_init (PG_FUNCTION_ARGS) |
veil_init(doing_reset bool) returns bool Initialise or reset a veil session. More... | |
Datum | veil_perform_reset (PG_FUNCTION_ARGS) |
veil_perform_reset() returns bool Reset veil shared memory for this database. More... | |
Datum | veil_force_reset (PG_FUNCTION_ARGS) |
veil_force_reset() returns bool Reset veil shared memory for this database, ignoring existing transactions. More... | |
Datum | veil_version (PG_FUNCTION_ARGS) |
veil_version() returns text Return a string describing this version of veil. More... | |
Datum | veil_serialise (PG_FUNCTION_ARGS) |
veil_serialise(varname text) returns text Return a string representing the contents of our variable. More... | |
Datum | veil_deserialise (PG_FUNCTION_ARGS) |
veil_deserialise(stream text) returns text Create or reset variables based on the output of previous veil_serialise calls. More... | |
char * | vl_serialise_var (char *name) |
Serialise a veil variable. More... | |
int32 | vl_deserialise (char **p_stream) |
De-serialise a base64 string containing, possibly many, derialised veil variables. More... | |
VarEntry * | vl_deserialise_next (char **p_stream) |
De-serialise the next veil variable from *p_stream. More... | |
Provide definitions for all non-local C-callable Veil functions.
Definition in file veil_funcs.h.
void* vl_malloc | ( | size_t | size | ) |
Dynamically allocate memory using palloc in TopMemoryContext.
size | The size of the chunk of memory being requested. |
Definition at line 28 of file veil_utils.c.
Referenced by create_shared_hash(), get_shmem_context(), vl_NewBitmap(), vl_NewBitmapArray(), vl_NewInt4(), vl_NewInt4Array(), and vl_NewRange().
char* vl_ObjTypeName | ( | ObjType | obj | ) |
Return a static string describing an ObjType object.
obj | The ObjType for which we want a description. |
Definition at line 45 of file veil_utils.c.
Referenced by vl_next_variable(), and vl_type_mismatch().
VarEntry* vl_lookup_shared_variable | ( | char * | name | ) |
Define a new, or attach to an existing, shared variable.
Raise an ERROR if the variable already exists as a session variable or if we cannot create the variable due to resource limitations (out of memory, or out of space in the shared hash).
name | The name of the variable. |
Definition at line 70 of file veil_variables.c.
References create_session_hash(), VarEntry::obj, session_hash, VarEntry::shared, and vl_get_shared_hash().
Referenced by veil_share().
VarEntry* vl_lookup_variable | ( | char * | name | ) |
Lookup a variable by name, creating it as as a session variable if it does not already exist.
name | The name of the variable |
Definition at line 122 of file veil_variables.c.
References create_session_hash(), VarEntry::obj, session_hash, VarEntry::shared, and vl_get_shared_hash().
Referenced by deserialise_bitmap(), deserialise_bitmap_array(), deserialise_bitmap_hash(), deserialise_int4array(), deserialise_int4var(), deserialise_range(), GetBitmap(), GetBitmapArray(), GetBitmapHash(), GetBitmapRef(), GetInt4Array(), GetInt4Var(), GetRange(), veil_clear_bitmap(), veil_clear_bitmap_array(), veil_clear_bitmap_hash(), veil_init_bitmap(), veil_init_bitmap_array(), veil_init_bitmap_hash(), veil_init_int4array(), and vl_serialise_var().
veil_variable_t* vl_next_variable | ( | veil_variable_t * | prev | ) |
Return the next variable from a scan of the hash of variables.
Note that this function is not re-entrant.
prev | The last variable retrieved by a scan, or NULL if starting a new scan. |
Definition at line 167 of file veil_variables.c.
References create_session_hash(), VarEntry::key, veil_variable_t::name, VarEntry::obj, session_hash, VarEntry::shared, veil_variable_t::shared, Object::type, veil_variable_t::type, vl_get_shared_hash(), and vl_ObjTypeName().
Referenced by veil_variables().
void vl_ClearInt4Array | ( | Int4Array * | array | ) |
Reset all Int4 entries in an Int4Array (to zero).
array | The array to be reset. |
Definition at line 224 of file veil_variables.c.
References Int4Array::array, Int4Array::arraymax, and Int4Array::arrayzero.
Referenced by veil_clear_int4array(), and vl_NewInt4Array().
Return a newly initialised (zeroed) Int4Array.
It may already exist in which case it will be re-used if possible. It may be created in either session or shared memory depending on the value of shared.
current | Pointer to an existing Int4Array if one exists. |
shared | Whether to create the variable in shared or session memory. |
min | Index of the first entry in the array. |
max | Index of the last entry in the array. |
Definition at line 246 of file veil_variables.c.
References Int4Array::arraymax, Int4Array::arrayzero, Int4Array::type, vl_ClearInt4Array(), vl_malloc(), and vl_shmalloc().
Referenced by veil_init_int4array().
void vl_Int4ArraySet | ( | Int4Array * | array, |
int32 | idx, | ||
int32 | value | ||
) |
Set an entry within an Int4Array.
If idx is outside of the acceptable range, raise an error.
array | The Int4Array within which the entry is to be set. |
idx | The index of the entry to be set. |
value | The value to which the entry will be set. |
Definition at line 290 of file veil_variables.c.
References Int4Array::array, Int4Array::arraymax, and Int4Array::arrayzero.
Referenced by veil_int4array_set().
int32 vl_Int4ArrayGet | ( | Int4Array * | array, |
int32 | idx | ||
) |
Get an entry from an Int4Array.
If idx is outside of the acceptable range, raise an error.
array | The Int4Array within from the entry is to be read. |
idx | The index of the entry to be retrieved. |
Definition at line 314 of file veil_variables.c.
References Int4Array::array, Int4Array::arraymax, and Int4Array::arrayzero.
Referenced by veil_int4array_get().
Range* vl_NewRange | ( | bool | shared | ) |
Create a new session or shared Range object.
shared | Whether the object is to be created in shared (true) or session (false) memory. |
Definition at line 28 of file veil_datatypes.c.
References Range::type, vl_malloc(), and vl_shmalloc().
Int4Var* vl_NewInt4 | ( | bool | shared | ) |
Create a new session or shared Int4Var object.
shared | Whether the object is to be created in shared (true) or session (false) memory. |
Definition at line 52 of file veil_datatypes.c.
References Int4Var::type, vl_malloc(), and vl_shmalloc().
void vl_ClearBitmap | ( | Bitmap * | bitmap | ) |
Clear all bits in a Bitmap.
bitmap | The Bitmap in which all bits are to be cleared |
Definition at line 73 of file veil_bitmap.c.
References ARRAYELEMS, Bitmap::bitmax, Bitmap::bitset, and Bitmap::bitzero.
Referenced by veil_clear_bitmap(), veil_intersect_from_bitmap_hash(), vl_ClearBitmapArray(), and vl_NewBitmap().
void vl_NewBitmap | ( | Bitmap ** | p_bitmap, |
bool | shared, | ||
int32 | min, | ||
int32 | max | ||
) |
Return a newly initialised (empty) Bitmap.
The bitmap may already exist in which case it will be re-used if possible. The bitmap may be created in either session or shared memory depending on the value of shared.
p_bitmap | Pointer to an existing bitmap if one exists |
shared | Whether to create the bitmap in shared memory |
min | The smallest bit to be stored in the bitmap |
max | The largest bit to be stored in the bitmap |
Definition at line 95 of file veil_bitmap.c.
References ARRAYELEMS, Bitmap::bitmax, Bitmap::bitzero, DBG_SET_CANARY, DBG_SET_ELEMS, DBG_SET_TRAILER, Bitmap::type, vl_ClearBitmap(), vl_free(), vl_malloc(), and vl_shmalloc().
Referenced by veil_init_bitmap(), and vl_NewBitmapArray().
void vl_BitmapSetbit | ( | Bitmap * | bitmap, |
int32 | bit | ||
) |
Set a bit within a Bitmap.
If the bit is outside of the acceptable range, raise an error.
bitmap | The Bitmap within which the bit is to be set. |
bit | The bit to be set. |
Definition at line 151 of file veil_bitmap.c.
References bitmasks, Bitmap::bitmax, Bitmap::bitset, BITSET_BIT, BITSET_ELEM, BITZERO, Bitmap::bitzero, DBG_CHECK_INDEX, DBG_TEST_CANARY, and DBG_TEST_TRAILER.
Referenced by veil_bitmap_array_setbit(), veil_bitmap_hash_setbit(), and veil_bitmap_setbit().
void vl_BitmapClearbit | ( | Bitmap * | bitmap, |
int32 | bit | ||
) |
Clear a bit within a Bitmap.
If the bit is outside of the acceptable range, raise an error.
bitmap | The Bitmap within which the bit is to be cleared. |
bit | The bit to be cleared. |
Definition at line 181 of file veil_bitmap.c.
References bitmasks, Bitmap::bitmax, Bitmap::bitset, BITSET_BIT, BITSET_ELEM, BITZERO, and Bitmap::bitzero.
Referenced by veil_bitmap_array_clearbit(), veil_bitmap_clearbit(), and veil_bitmap_hash_clearbit().
bool vl_BitmapTestbit | ( | Bitmap * | bitmap, |
int32 | bit | ||
) |
Test a bit within a Bitmap.
If the bit is outside of the acceptable range return false.
bitmap | The Bitmap within which the bit is to be set. |
bit | The bit to be tested. |
Definition at line 210 of file veil_bitmap.c.
References bitmasks, Bitmap::bitmax, Bitmap::bitset, BITSET_BIT, BITSET_ELEM, BITZERO, and Bitmap::bitzero.
Referenced by veil_bitmap_array_testbit(), veil_bitmap_hash_testbit(), veil_bitmap_testbit(), and vl_BitmapNextBit().
Create the union of two bitmaps, updating the first with the result.
target | The Bitmap into which the result will be placed. |
source | The Bitmap to be unioned into target. |
Definition at line 232 of file veil_bitmap.c.
References ARRAYELEMS, Bitmap::bitmax, Bitmap::bitset, and Bitmap::bitzero.
Referenced by veil_bitmap_union(), veil_union_from_bitmap_array(), veil_union_from_bitmap_hash(), and veil_union_into_bitmap_hash().
Create the intersection of two bitmaps, updating the first with the result.
target | The Bitmap into which the result will be placed. |
source | The Bitmap to be intersected into target. |
Definition at line 262 of file veil_bitmap.c.
References ARRAYELEMS, Bitmap::bitmax, Bitmap::bitset, and Bitmap::bitzero.
Referenced by veil_bitmap_intersect(), veil_intersect_from_bitmap_array(), and veil_intersect_from_bitmap_hash().
int32 vl_BitmapNextBit | ( | Bitmap * | bitmap, |
int32 | bit, | ||
bool * | found | ||
) |
Return the next set bit in the Bitmap.
bitmap | The Bitmap being scanned. |
bit | The starting bit from which to scan the bitmap |
found | Boolean that will be set to true when a set bit has been found. |
Definition at line 295 of file veil_bitmap.c.
References vl_BitmapTestbit().
Referenced by veil_bitmap_array_bits(), veil_bitmap_bits(), and veil_bitmap_hash_bits().
Bitmap* vl_BitmapFromArray | ( | BitmapArray * | bmarray, |
int32 | elem | ||
) |
Return a specified Bitmap from a BitmapArray.
bmarray | The BitmapArray from which the result is to be returned. |
elem | The index of the Bitmap within the array. |
Definition at line 321 of file veil_bitmap.c.
References BitmapArray::arraymax, BitmapArray::arrayzero, BitmapArray::bitmap, DBG_CHECK_INDEX, DBG_TEST_CANARY, and DBG_TEST_TRAILER.
Referenced by veil_bitmap_array_bits(), veil_bitmap_array_clearbit(), veil_bitmap_array_setbit(), veil_bitmap_array_testbit(), veil_bitmap_from_array(), veil_intersect_from_bitmap_array(), and veil_union_from_bitmap_array().
void vl_ClearBitmapArray | ( | BitmapArray * | bmarray | ) |
Clear all bitmaps in the given BitmapArray.
bmarray | The BitmapArray to be cleared |
Definition at line 341 of file veil_bitmap.c.
References BitmapArray::arraymax, BitmapArray::arrayzero, BitmapArray::bitmap, DBG_CHECK_INDEX, DBG_TEST_CANARY, DBG_TEST_TRAILER, and vl_ClearBitmap().
Referenced by veil_clear_bitmap_array(), and vl_NewBitmapArray().
void vl_NewBitmapArray | ( | BitmapArray ** | p_bmarray, |
bool | shared, | ||
int32 | arrayzero, | ||
int32 | arraymax, | ||
int32 | bitzero, | ||
int32 | bitmax | ||
) |
Return a newly initialised (empty) BitmapArray.
It may already exist in which case it will be re-used if possible. It may be created in either session or shared memory depending on the value of shared.
p_bmarray | Pointer to an existing bitmap if one exists. |
shared | Whether to create the bitmap in shared memory |
arrayzero | The lowest array index |
arraymax | The highest array index |
bitzero | The smallest bit to be stored in the bitmap |
bitmax | The largest bit to be stored in the bitmap |
Definition at line 368 of file veil_bitmap.c.
References ARRAYELEMS, BitmapArray::arraymax, BitmapArray::arrayzero, BitmapArray::bitmap, BitmapArray::bitmax, BitmapArray::bitzero, DBG_TEST_CANARY, DBG_TEST_TRAILER, BitmapArray::type, vl_ClearBitmapArray(), vl_free(), vl_malloc(), vl_NewBitmap(), and vl_shmalloc().
Referenced by veil_init_bitmap_array().
Utility function for scanning the hash table of a BitmapHash.
hash | The hash table being scanned |
prev | The entry from which to scan, starting with NULL. |
Definition at line 474 of file veil_bitmap.c.
Referenced by serialise_bitmap_hash(), sizeof_bitmaps_in_hash(), veil_bitmap_hash_entries(), and vl_NewBitmapHash().
void vl_NewBitmapHash | ( | BitmapHash ** | p_bmhash, |
char * | name, | ||
int32 | bitzero, | ||
int32 | bitmax | ||
) |
Return a newly initialised (empty) BitmapHash.
It may already exist in which case it will be re-used if possible. BitmapHash variables may only be created as session (not shared) variables.
p_bmhash | Pointer to an existing bitmap if one exists. |
name | The name to be used for the hash table |
bitzero | The smallest bit to be stored in the bitmap |
bitmax | The largest bit to be stored in the bitmap |
Definition at line 499 of file veil_bitmap.c.
References BitmapHash::hash, VarEntry::obj, Object::type, and vl_NextHashEntry().
Referenced by veil_clear_bitmap_hash(), and veil_init_bitmap_hash().
Bitmap* vl_BitmapFromHash | ( | BitmapHash * | bmhash, |
char * | hashelem | ||
) |
Return a specified Bitmap from a BitmapHash.
Raise an error if the returned object from the hash search is not a bitmap.
bmhash | The BitmapHash from which the result is to be returned. |
hashelem | The key of the Bitmap within the hash. |
Definition at line 548 of file veil_bitmap.c.
References BitmapHash::hash, VarEntry::obj, and Object::type.
Referenced by veil_bitmap_hash_bits(), veil_bitmap_hash_testbit(), veil_intersect_from_bitmap_hash(), and veil_union_from_bitmap_hash().
Bitmap* vl_AddBitmapToHash | ( | BitmapHash * | bmhash, |
char * | hashelem | ||
) |
Create a newly allocated empty Bitmap to a BitmapHash.
bmhash | The BitmapHash to which to add the new Bitmap. |
hashelem | The key for the new entry |
Definition at line 588 of file veil_bitmap.c.
References BitmapHash::hash, VarEntry::obj, and Object::type.
Referenced by veil_bitmap_from_hash(), veil_bitmap_hash_clearbit(), veil_bitmap_hash_setbit(), and veil_union_into_bitmap_hash().
bool vl_BitmapHashHasKey | ( | BitmapHash * | bmhash, |
char * | hashelem | ||
) |
Determine whether the supplied key exists in the BitmapHash.
bmhash | The BitmapHash to be tested |
hashelem | The key to be tested |
Definition at line 629 of file veil_bitmap.c.
References BitmapHash::hash.
Referenced by veil_bitmap_hash_key_exists().
HTAB* vl_get_shared_hash | ( | void | ) |
Return the shared hash for the current context.
Definition at line 552 of file veil_shmem.c.
References get_cur_context(), get_cur_context_id(), get_hash0(), and get_hash1().
Referenced by ensure_init(), vl_lookup_shared_variable(), vl_lookup_variable(), and vl_next_variable().
bool vl_prepare_context_switch | ( | void | ) |
Prepare for a switch to the alternate context.
Switching will only be allowed if there are no transactions that may still be using the context to which we are switching, and there is no other process attempting the switch.
Definition at line 604 of file veil_shmem.c.
References clear_hash(), ShmemCtl::context, ShmemCtl::current_context, get_cur_context(), get_hash0(), get_hash1(), MemContext::next, OTHER_CONTEXT, prepared_for_switch, ShmemCtl::switching, VeilLWLock, and ShmemCtl::xid.
Referenced by veil_perform_reset().
bool vl_complete_context_switch | ( | void | ) |
Complete the context switch started by vl_prepare_context_switch().
Raise an ERROR if the context switch cannot be completed.
Definition at line 678 of file veil_shmem.c.
References ShmemCtl::current_context, OTHER_CONTEXT, prepared_for_switch, ShmemCtl::switching, VeilLWLock, and ShmemCtl::xid.
Referenced by veil_perform_reset().
void* vl_shmalloc | ( | size_t | size | ) |
Dynamically allocate a piece of shared memory from the current context.
size | The size of the requested piece of memory. |
Definition at line 414 of file veil_shmem.c.
References do_vl_shmalloc(), get_cur_context(), and VeilLWLock.
Referenced by vl_NewBitmap(), vl_NewBitmapArray(), vl_NewInt4(), vl_NewInt4Array(), and vl_NewRange().
void vl_free | ( | void * | mem | ) |
Free a piece of shared memory within the current context.
Currently this does nothing as implementation of freeing of shared memory has been deferred.
mem | Pointer to the memory to be freed. |
Definition at line 437 of file veil_shmem.c.
Referenced by vl_NewBitmap(), and vl_NewBitmapArray().
void _PG_init | ( | void | ) |
Veil's startup function.
This should be run when the Veil shared library is loaded by postgres.
Definition at line 141 of file veil_shmem.c.
References InitialLWLock, TRANCHE_NAME, veil_config_init(), veil_dbs_in_cluster(), veil_shmem_context_size(), and VeilLWLock.
int vl_spi_connect | ( | bool * | p_pushed | ) |
If already connected in this session, push the current connection, and get a new one.
We are already connected, if:
Definition at line 46 of file veil_query.c.
Referenced by ensure_init(), exec_init_fn(), veil_perform_reset(), and vl_call_init_fns().
bool vl_bool_from_query | ( | const char * | qry, |
bool * | result | ||
) |
Executes a query that returns a single bool value.
qry | The text of the query to be performed. |
result | Variable into which the result of the query will be placed. |
Definition at line 232 of file veil_query.c.
References fetch_one_bool(), and query().
Referenced by ensure_init(), exec_init_fn(), and veil_perform_reset().
bool vl_db_exists | ( | Oid | db_id | ) |
Determine whether the given oid represents an existing database or not.
db_id | Oid of the database in which we are interested. |
Definition at line 275 of file veil_query.c.
References str_from_oid_query().
Referenced by get_shmem_context().
int vl_call_init_fns | ( | bool | param | ) |
Identify any registered init_functions and execute them.
param | The boolean parameter to be passed to each init_function. |
Definition at line 336 of file veil_query.c.
References exec_init_fn(), query(), vl_spi_connect(), and vl_spi_finish().
Referenced by veil_init().
int veil_shared_hash_elems | ( | void | ) |
Return the number of entries that should be allocated for shared variables in our shared hashes.
This defaults to 32 and may be defined in postgresql.conf using eg: "veil.shared_hash_elems = 64"
Definition at line 65 of file veil_config.c.
References shared_hash_elems, and veil_load_config().
Referenced by create_shared_hash().
int veil_dbs_in_cluster | ( | void | ) |
Return the number of databases, within the database cluster, that will use Veil.
Each such database will be allocated 2 chunks of shared memory (of shmem_context_size), and a single LWLock. It defaults to 1 and may be defined in postgresql.conf using eg: "veil.dbs_in_cluster = 2"
Definition at line 52 of file veil_config.c.
References dbs_in_cluster, and veil_load_config().
Referenced by _PG_init(), and get_shmem_context().
int veil_shmem_context_size | ( | void | ) |
Return the amount of shared memory to be requested for each of the two shared memory contexts.
This variable has no effect unless shared_preload_libraries has been defined in postgresql.conf to load the Veil shared library Note that this must be large enough to allocate at least one chunk of memory for each veil-using database in the Postgres cluster. It defaults to 16K and may be defined in postgresql.conf using eg: "veil.shmem_context_size = 16384"
Definition at line 82 of file veil_config.c.
References shmem_context_size, and veil_load_config().
Referenced by _PG_init(), and shmalloc_init().
Report, by raising an error, a type mismatch between the expected and actual type of a VarEntry variable.
name | The name of the variable |
expected | The expected type. |
got | The actual type |
Definition at line 199 of file veil_interface.c.
References vl_ObjTypeName().
Datum veil_variables | ( | PG_FUNCTION_ARGS | ) |
veil_variables() returns setof veil_variable_t
Return a veil_variable_t
record for each defined variable.
This includes both session and shared variables.
fcinfo | None |
setof veil_variable_t
Definition at line 597 of file veil_interface.c.
References copystr(), ensure_init(), veil_variable_t::name, veil_variable_t::shared, strfrombool(), veil_variable_t::type, veil_share(), and vl_next_variable().
Referenced by GetInt4Array().
Datum veil_share | ( | PG_FUNCTION_ARGS | ) |
veil_share(name text) returns bool
Define a shared variable called NAME, returning true.
If the variable is already defined as a session variable an ERROR will be raised.
Session variables are simply defined by their first usage. Shared variables must be defined using this function. They may then be used in exactly the same way as session variables. Shared variables are shared by all backends and so need only be initialised once. The result of this function tells the caller whether the variable needs to be initialised. The caller that first defines a shared variable will get a false result and from this will know that the variable must be initialised. All subsequent callers will get a true result and so will know that the variable is already initialised.
fcinfo | name text name of variable. |
bool
true if the variable already exists Definition at line 672 of file veil_interface.c.
References ensure_init(), VarEntry::obj, strfromtext(), veil_init_range(), and vl_lookup_shared_variable().
Referenced by veil_variables().
Datum veil_init_range | ( | PG_FUNCTION_ARGS | ) |
veil_init_range(name text, min int4, max int4) returns int4 Initialise a Range variable called NAME constrained by MIN and MAX, returning the number of elements in the range.
Ranges may be examined using the veil_range() function.
fcinfo | name text The name of the variable to initialise. min int4 The min value of the range. max int4 The max value of the range. |
int4
The size of the range ((max - min) + 1). Definition at line 700 of file veil_interface.c.
References ensure_init(), GetRange(), Range::max, Range::min, and strfromtext().
Referenced by veil_share().
Datum veil_range | ( | PG_FUNCTION_ARGS | ) |
veil_range(name text) returns veil_range_t
Return the range (as a SQL veil_range_t composite type) from the named variable.
An Error will be raised if the variable is not defined or is of the wrong type.
fcinfo | name text The name of the range variable. |
veil_range_t
Composite type containing the min and max values from the named variable. Definition at line 780 of file veil_interface.c.
References datum_from_range(), ensure_init(), GetRange(), Range::max, Range::min, strfromtext(), and veil_init_bitmap().
Referenced by datum_from_range().
Datum veil_init_bitmap | ( | PG_FUNCTION_ARGS | ) |
veil_init_bitmap(bitmap_name text, range_nametext) returns bool
Create or re-initialise a Bitmap, for dealing with a named range of values.
An error will be raised if the variable already exists and is not a Bitmap.
fcinfo | bitmap_name text The name of the bitmap to create or reset range_name text The name of a Range variable that defines the range of the new bitmap. |
bool
true Definition at line 811 of file veil_interface.c.
References ensure_init(), GetBitmapFromVar(), GetRange(), Range::max, Range::min, VarEntry::obj, VarEntry::shared, strfromtext(), veil_clear_bitmap(), vl_lookup_variable(), and vl_NewBitmap().
Referenced by veil_range().
Datum veil_clear_bitmap | ( | PG_FUNCTION_ARGS | ) |
veil_clear_bitmap(name text) returns bool
Clear all bits in the specified Bitmap.
An error will be raised if the variable is not a Bitmap or BitmapRef.
fcinfo | name text The name of the bitmap to be cleared. |
bool
true Definition at line 845 of file veil_interface.c.
References ensure_init(), GetBitmapFromVar(), strfromtext(), veil_bitmap_setbit(), vl_ClearBitmap(), and vl_lookup_variable().
Referenced by veil_init_bitmap().
Datum veil_bitmap_setbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_setbit(name text, bit_number int4) returns bool
Set the specified bit in the specified Bitmap.
An error will be raised if the variable is not a Bitmap or BitmapRef.
fcinfo | name text The name of the bitmap variable. bit_number int4 The bit to be set. |
bool
true Definition at line 874 of file veil_interface.c.
References ensure_init(), GetBitmap(), strfromtext(), veil_bitmap_clearbit(), and vl_BitmapSetbit().
Referenced by veil_clear_bitmap().
Datum veil_bitmap_clearbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_clearbit(name int4, bit_number text) returns bool
Clear the specified bit in the specified Bitmap.
An error will be raised if the variable is not a Bitmap or BitmapRef.
fcinfo | name text The name of the bitmap variable. bit_number int4 The bit to be cleared. |
bool
true Definition at line 902 of file veil_interface.c.
References ensure_init(), GetBitmap(), strfromtext(), veil_bitmap_testbit(), and vl_BitmapClearbit().
Referenced by veil_bitmap_setbit().
Datum veil_bitmap_testbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_testbit(name text, bit_number int4) returns bool
Test the specified bit in the specified Bitmap, returning true if it is set.
An error will be raised if the variable is not a Bitmap or BitmapRef.
fcinfo | name text The name of the bitmap variable. bit_number int4 The bit to be tested. |
bool
true if the bit was set Definition at line 931 of file veil_interface.c.
References ensure_init(), GetBitmap(), strfromtext(), veil_bitmap_union(), and vl_BitmapTestbit().
Referenced by veil_bitmap_clearbit().
Datum veil_bitmap_union | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_union(result_name text, name2 text) returns bool
Union the bitmap specified in parameter 1 with that in parameter 2, with the result in parameter 1.
An error will be raised if the variables are not of type Bitmap or BitmapRef.
fcinfo | result_name text The target bitmap name2 text The bitmap with which to union the target |
bool
true Definition at line 963 of file veil_interface.c.
References ensure_init(), GetBitmap(), strfromtext(), veil_bitmap_intersect(), and vl_BitmapUnion().
Referenced by veil_bitmap_testbit().
Datum veil_bitmap_intersect | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_intersect(result_name text, name2 text) returns bool
Intersect the bitmap specified in parameter 1 with that in parameter 2, with the result in parameter 1.
An error will be raised if the variables are not of type Bitmap or BitmapRef.
fcinfo | result_name text The target bitmap name2 text The bitmap with which to intersect the target |
bool
true Definition at line 999 of file veil_interface.c.
References ensure_init(), GetBitmap(), strfromtext(), veil_bitmap_bits(), and vl_BitmapIntersect().
Referenced by veil_bitmap_union().
Datum veil_bitmap_bits | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_bits(name text)
returns setof int4 Return the set of all bits set in the specified Bitmap or BitmapRef.
fcinfo | name text The name of the bitmap. |
setof int4
The set of bits that are set in the bitmap. Definition at line 1028 of file veil_interface.c.
References ensure_init(), GetBitmap(), strfromtext(), veil_bitmap_range(), and vl_BitmapNextBit().
Referenced by veil_bitmap_intersect().
Datum veil_bitmap_range | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_range(name text) returns veil_range_t
Return composite type giving the range of the specified Bitmap or BitmapRef.
fcinfo | name text The name of the bitmap. |
veil_range_t
Composite type containing the min and max values of the bitmap's range Definition at line 1092 of file veil_interface.c.
References Bitmap::bitmax, Bitmap::bitzero, datum_from_range(), ensure_init(), GetBitmap(), strfromtext(), and veil_init_bitmap_array().
Referenced by veil_bitmap_bits().
Datum veil_init_bitmap_array | ( | PG_FUNCTION_ARGS | ) |
veil_init_bitmap_array(text, text, text) returns bool
Create or reset a BitmapArray.
An error will be raised if any parameter is not of the correct type.
fcinfo | bmarray text The name of the bitmap array. array_range text Name of the Range variable that provides the range of the array part of the bitmap array. bitmap_range text Name of the Range variable that provides the range of each bitmap in the array. |
bool
True Definition at line 1128 of file veil_interface.c.
References ensure_init(), GetBitmapArrayFromVar(), GetRange(), Range::max, Range::min, VarEntry::obj, VarEntry::shared, strfromtext(), veil_clear_bitmap_array(), vl_lookup_variable(), and vl_NewBitmapArray().
Referenced by veil_bitmap_range().
Datum veil_clear_bitmap_array | ( | PG_FUNCTION_ARGS | ) |
veil_clear_bitmap_array(bmarray text) returns bool
Clear the bits in an existing BitmapArray.
An error will be raised if the parameter is not of the correct type.
fcinfo | bmarray text The name of the BitmapArray. |
bool
True Definition at line 1168 of file veil_interface.c.
References ensure_init(), GetBitmapArrayFromVar(), strfromtext(), veil_bitmap_from_array(), vl_ClearBitmapArray(), and vl_lookup_variable().
Referenced by veil_init_bitmap_array().
Datum veil_bitmap_from_array | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_from_array(bmref text, bmarray text, index int4) returns text
Place a reference to the specified Bitmap from a BitmapArray into the specified BitmapRef An error will be raised if any parameter is not of the correct type.
fcinfo | bmref text The name of the BitmapRef into which a reference to the relevant Bitmap will be placed. bmarray text Name of the BitmapArray containing the Bitmap in which we are interested. index int4 Index into the array of the bitmap in question. |
text
The name of the BitmapRef Definition at line 1200 of file veil_interface.c.
References BitmapArray::arraymax, BitmapArray::arrayzero, BitmapRef::bitmap, GetBitmapArray(), GetBitmapRef(), strfromtext(), veil_bitmap_array_testbit(), vl_BitmapFromArray(), and BitmapRef::xid.
Referenced by veil_clear_bitmap_array().
Datum veil_bitmap_array_testbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_array_testbit(bmarray text, arr_idx int4, bitno int4) returns bool
Test a specified bit within a BitmapArray
An error will be raised if the first parameter is not a BitmapArray.
fcinfo | bmarray text The name of the BitmapArray arr_idx int4 Index of the Bitmap within the array. bitno int4 Bit id of the bit within the Bitmap. |
bool
True if the bit was set, false otherwise. Definition at line 1245 of file veil_interface.c.
References ensure_init(), GetBitmapArray(), strfromtext(), veil_bitmap_array_setbit(), vl_BitmapFromArray(), and vl_BitmapTestbit().
Referenced by veil_bitmap_from_array().
Datum veil_bitmap_array_setbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_array_setbit(bmarray text, arr_idx int4, bitno int4) returns bool
Set a specified bit within a BitmapArray
An error will be raised if the first parameter is not a BitmapArray.
fcinfo | bmarray text The name of the BitmapArray arr_idx int4 Index of the Bitmap within the array. ibitno nt4 Bit id of the bit within the Bitmap. |
bool
True Definition at line 1284 of file veil_interface.c.
References BitmapArray::arraymax, BitmapArray::arrayzero, ensure_init(), GetBitmapArray(), strfromtext(), veil_bitmap_array_clearbit(), vl_BitmapFromArray(), and vl_BitmapSetbit().
Referenced by veil_bitmap_array_testbit().
Datum veil_bitmap_array_clearbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_array_clearbit(bmarray text, arr_idx int4, bitno int4) returns bool
Clear a specified bit within a BitmapArray
An error will be raised if the first parameter is not a BitmapArray.
fcinfo | bmarray text The name of the BitmapArray arr_idx int4 Index of the Bitmap within the array. bitno int4 Bit id of the bit within the Bitmap. |
bool
True Definition at line 1329 of file veil_interface.c.
References BitmapArray::arraymax, BitmapArray::arrayzero, ensure_init(), GetBitmapArray(), strfromtext(), veil_union_from_bitmap_array(), vl_BitmapClearbit(), and vl_BitmapFromArray().
Referenced by veil_bitmap_array_setbit().
Datum veil_union_from_bitmap_array | ( | PG_FUNCTION_ARGS | ) |
veil_union_from_bitmap_array(bitmap text, bmarray text, arr_idx int4) returns bool
Union a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the first parameter.
An error will be raised if the parameters are not of the correct types.
fcinfo | bitmap text The name of the Bitmap into which the resulting union will be placed. bmarray text Name of the BitmapArray arr_idx int4 Index of the required bitmap in the array |
bool
True Definition at line 1376 of file veil_interface.c.
References ensure_init(), GetBitmap(), GetBitmapArray(), strfromtext(), veil_intersect_from_bitmap_array(), vl_BitmapFromArray(), and vl_BitmapUnion().
Referenced by veil_bitmap_array_clearbit().
Datum veil_intersect_from_bitmap_array | ( | PG_FUNCTION_ARGS | ) |
veil_intersect_from_bitmap_array(bitmap text, bmarray text, arr_idx int4) returns bool
Intersect a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the first parameter.
An error will be raised if the parameters are not of the correct types.
fcinfo | bitmap text The name of the Bitmap into which the resulting intersection will be placed. bmarray text Name of the BitmapArray arr_idx int4 Index of the required bitmap in the array |
bool
True Definition at line 1417 of file veil_interface.c.
References ensure_init(), GetBitmap(), GetBitmapArray(), strfromtext(), veil_bitmap_array_bits(), vl_BitmapFromArray(), and vl_BitmapIntersect().
Referenced by veil_union_from_bitmap_array().
Datum veil_bitmap_array_bits | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_array_bits(bmarray text, arr_idx int4)
returns setof int4 Return the set of all bits set in the specified Bitmap from the BitmapArray.
fcinfo | bmarray text The name of the bitmap array. arr_idx int4 Index of the required bitmap in the array |
setof int4
The set of bits that are set in the bitmap. Definition at line 1455 of file veil_interface.c.
References BitmapArray::arraymax, BitmapArray::arrayzero, ensure_init(), GetBitmapArray(), strfromtext(), veil_bitmap_array_arange(), vl_BitmapFromArray(), and vl_BitmapNextBit().
Referenced by veil_intersect_from_bitmap_array().
Datum veil_bitmap_array_arange | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_array_arange(bmarray text) returns veil_range_t
Return composite type giving the range of the array part of the specified BitmapArray
fcinfo | bmarray text The name of the bitmap array. |
veil_range_t
Composite type containing the min and max indices of the array Definition at line 1533 of file veil_interface.c.
References BitmapArray::arraymax, BitmapArray::arrayzero, datum_from_range(), ensure_init(), GetBitmapArray(), strfromtext(), and veil_bitmap_array_brange().
Referenced by veil_bitmap_array_bits().
Datum veil_bitmap_array_brange | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_array_brange(bmarray text) returns veil_range_t
Return composite type giving the range of every Bitmap within the BitmapArray.
fcinfo | bmarray text The name of the bitmap array. |
veil_range_t
Composite type containing the min and max values of the bitmap array's range Definition at line 1567 of file veil_interface.c.
References BitmapArray::bitmax, BitmapArray::bitzero, datum_from_range(), ensure_init(), GetBitmapArray(), strfromtext(), and veil_init_bitmap_hash().
Referenced by veil_bitmap_array_arange().
Datum veil_init_bitmap_hash | ( | PG_FUNCTION_ARGS | ) |
veil_init_bitmap_hash(bmhash text, range text) returns bool
Create or reset a BitmapHash.
An error will be raised if any parameter is not of the correct type.
fcinfo | bmhash text The name of the bitmap hash. range text Name of the Range variable that provides the range of each bitmap in the hash. |
bool
True Definition at line 1603 of file veil_interface.c.
References ensure_init(), GetBitmapHashFromVar(), GetRange(), Range::max, Range::min, VarEntry::obj, VarEntry::shared, strfromtext(), veil_clear_bitmap_hash(), vl_lookup_variable(), and vl_NewBitmapHash().
Referenced by veil_bitmap_array_brange().
Datum veil_clear_bitmap_hash | ( | PG_FUNCTION_ARGS | ) |
veil_clear_bitmap_hash(bmhash text) returns bool
Clear the bits in an existing BitmapHash.
An error will be raised if the parameter is not of the correct type.
fcinfo | bmhash text The name of the BitmapHash. |
bool
True Definition at line 1647 of file veil_interface.c.
References BitmapHash::bitmax, BitmapHash::bitzero, ensure_init(), GetBitmapHashFromVar(), VarEntry::obj, strfromtext(), veil_bitmap_hash_key_exists(), vl_lookup_variable(), and vl_NewBitmapHash().
Referenced by veil_init_bitmap_hash().
Datum veil_bitmap_hash_key_exists | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_hashkey_exists(bmhash text, key text) returns bool
Return true if the key exists in the bitmap hash.
fcinfo | bmhash text Name of the BitmapHashin which we are interested. key text Key, into the hash, of the bitmap in question. |
boolean
Whether the key is present in the BitmapHash Definition at line 1679 of file veil_interface.c.
References GetBitmapHash(), strfromtext(), veil_bitmap_from_hash(), and vl_BitmapHashHasKey().
Referenced by veil_clear_bitmap_hash().
Datum veil_bitmap_from_hash | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_from_hash(bmref text, bmhash text, key text) returns text
Place a reference to the specified Bitmap from a BitmapHash into the specified BitmapRef An error will be raised if any parameter is not of the correct type.
fcinfo | bmref text The name of the BitmapRef into which a reference to the relevant Bitmap will be placed. bmhash text Name of the BitmapHash containing the Bitmap in which we are interested. key text Key, into the hash, of the bitmap in question. |
text
The name of the BitmapRef Definition at line 1711 of file veil_interface.c.
References BitmapRef::bitmap, GetBitmapHash(), GetBitmapRef(), strfromtext(), veil_bitmap_hash_testbit(), vl_AddBitmapToHash(), and BitmapRef::xid.
Referenced by veil_bitmap_hash_key_exists().
Datum veil_bitmap_hash_testbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_hash_testbit(bmhash text, key text, bitno int4) returns bool
Test a specified bit within a BitmapHash
An error will be raised if the first parameter is not a BitmapHash.
fcinfo | bmhash text The name of the BitmapHash key text Key of the Bitmap within the hash. bitno int4 Bit id of the bit within the Bitmap. |
bool
True if the bit was set, false otherwise. Definition at line 1750 of file veil_interface.c.
References ensure_init(), GetBitmapHash(), strfromtext(), veil_bitmap_hash_setbit(), vl_BitmapFromHash(), and vl_BitmapTestbit().
Referenced by veil_bitmap_from_hash().
Datum veil_bitmap_hash_setbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_hash_setbit(bmhash text, key text, bitno int4) returns bool
Set a specified bit within a BitmapHash
An error will be raised if the first parameter is not a BitmapHash.
fcinfo | bmhash text The name of the BitmapHash key text Key of the Bitmap within the hash. bitno int4 Bit id of the bit within the Bitmap. |
bool
True Definition at line 1789 of file veil_interface.c.
References ensure_init(), GetBitmapHash(), strfromtext(), veil_bitmap_hash_clearbit(), vl_AddBitmapToHash(), and vl_BitmapSetbit().
Referenced by veil_bitmap_hash_testbit().
Datum veil_bitmap_hash_clearbit | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_hash_clearbit(bmhash text, key text, bitno int4) returns bool
Clear a specified bit within a BitmapHash
An error will be raised if the first parameter is not a BitmapHash.
fcinfo | bmhash text The name of the BitmapHash key text Key of the Bitmap within the hash. bitno int4 Bit id of the bit within the Bitmap. |
bool
True Definition at line 1824 of file veil_interface.c.
References ensure_init(), GetBitmapHash(), strfromtext(), veil_union_into_bitmap_hash(), vl_AddBitmapToHash(), and vl_BitmapClearbit().
Referenced by veil_bitmap_hash_setbit().
Datum veil_union_into_bitmap_hash | ( | PG_FUNCTION_ARGS | ) |
veil_union_into_bitmap_hash(bmhash text, key text, bitmap text) returns bool
Union a Bitmap with the specified Bitmap from a BitmapHash with the result placed into the bitmap hash.
An error will be raised if the parameters are not of the correct types.
fcinfo | bmhash text Name of the BitmapHash key text Key of the required bitmap in the hash bitmap text The name of the Bitmap into which the resulting union will be placed. |
bool
True Definition at line 1861 of file veil_interface.c.
References ensure_init(), GetBitmap(), GetBitmapHash(), strfromtext(), veil_union_from_bitmap_hash(), vl_AddBitmapToHash(), and vl_BitmapUnion().
Referenced by veil_bitmap_hash_clearbit().
Datum veil_union_from_bitmap_hash | ( | PG_FUNCTION_ARGS | ) |
veil_union_from_bitmap_hash(bmhash text, key text, bitmap text) returns bool
Union a Bitmap with the specified Bitmap from a BitmapHash with the result placed into the bitmap parameter.
An error will be raised if the parameters are not of the correct types.
fcinfo | bmhash text The name of the Bitmap into which the resulting union will be placed. key text Name of the BitmapHash bitmap text Key of the required bitmap in the hash |
bool
True Definition at line 1901 of file veil_interface.c.
References ensure_init(), GetBitmap(), GetBitmapHash(), strfromtext(), veil_intersect_from_bitmap_hash(), vl_BitmapFromHash(), and vl_BitmapUnion().
Referenced by veil_union_into_bitmap_hash().
Datum veil_intersect_from_bitmap_hash | ( | PG_FUNCTION_ARGS | ) |
veil_intersect_from_bitmap_hash(bitmap text, bmhash text, key text) returns bool
Intersect a Bitmap with the specified Bitmap from a BitmapArray with the result placed into the bitmap parameter.
An error will be raised if the parameters are not of the correct types.
fcinfo | bitmap text The name of the Bitmap into which the resulting intersection will be placed. bmhash text Name of the BitmapHash key text Key of the required bitmap in the hash |
bool
True Definition at line 1941 of file veil_interface.c.
References ensure_init(), GetBitmap(), GetBitmapHash(), strfromtext(), veil_bitmap_hash_bits(), vl_BitmapFromHash(), vl_BitmapIntersect(), and vl_ClearBitmap().
Referenced by veil_union_from_bitmap_hash().
Datum veil_bitmap_hash_bits | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_hash_bits(bmhash text, key text)
returns setof int4 Return the set of all bits set in the specified Bitmap from the BitmapHash.
fcinfo | bmhashtext The name of the bitmap hash. key text Key of the required bitmap in the hash |
setof int4
The set of bits that are set in the bitmap. Definition at line 1983 of file veil_interface.c.
References ensure_init(), GetBitmapHash(), strfromtext(), veil_bitmap_hash_range(), vl_BitmapFromHash(), and vl_BitmapNextBit().
Referenced by veil_intersect_from_bitmap_hash().
Datum veil_bitmap_hash_entries | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_hash_entries(bmhash text) returns setof text
Return the key of every Bitmap within the BitmapHash.
fcinfo | bmhash text The name of the bitmap hash. |
setof text
Every key in the hash. Definition at line 2081 of file veil_interface.c.
References ensure_init(), GetBitmapHash(), HASH_KEYLEN, strfromtext(), textfromstrn(), veil_int4_set(), and vl_NextHashEntry().
Referenced by veil_bitmap_hash_range().
Datum veil_bitmap_hash_range | ( | PG_FUNCTION_ARGS | ) |
veil_bitmap_hash_range(bmhash text) returns veil_range_t
Return composite type giving the range of every Bitmap within the BitmapHash.
fcinfo | bmhash text The name of the bitmap array. |
veil_range_t
Composite type containing the min and max values of the bitmap hash's range Definition at line 2052 of file veil_interface.c.
References BitmapHash::bitmax, BitmapHash::bitzero, datum_from_range(), ensure_init(), GetBitmapHash(), strfromtext(), and veil_bitmap_hash_entries().
Referenced by veil_bitmap_hash_bits().
Datum veil_int4_set | ( | PG_FUNCTION_ARGS | ) |
veil_int4_set(name text,value int4) returns int4
Set an Int4Var variable type to a specified value.
An Error will be raised if the variable is not defined or is of the wrong type.
fcinfo | name text The name of the int4 variable. |
fcinfo | value int4 The value to be set (may be null). |
int4
The new value of the variable. Definition at line 2144 of file veil_interface.c.
References ensure_init(), GetInt4Var(), Int4Var::isnull, strfromtext(), Int4Var::value, and veil_int4_get().
Referenced by veil_bitmap_hash_entries().
Datum veil_int4_get | ( | PG_FUNCTION_ARGS | ) |
veil_int4_get(name text) returns int4
Return the value of an Int4Var variable.
An Error will be raised if the variable is not defined or is of the wrong type.
fcinfo | name text The name of the int4 variable. |
int4
The value of the variable. Definition at line 2182 of file veil_interface.c.
References ensure_init(), GetInt4Var(), Int4Var::isnull, strfromtext(), Int4Var::value, and veil_init_int4array().
Referenced by veil_int4_set().
Datum veil_init_int4array | ( | PG_FUNCTION_ARGS | ) |
veil_init_int4array(arrayname text, range text) returns bool
Initialise an Int4Array variable.
Each entry in the array will be zeroed.
fcinfo | arrayname text The name of the Int4Array variable. range text Name of the range variable defining the size of the array. |
bool
True Definition at line 2212 of file veil_interface.c.
References ensure_init(), GetInt4ArrayFromVar(), GetRange(), Range::max, Range::min, VarEntry::obj, VarEntry::shared, strfromtext(), veil_clear_int4array(), vl_lookup_variable(), and vl_NewInt4Array().
Referenced by veil_int4_get().
Datum veil_clear_int4array | ( | PG_FUNCTION_ARGS | ) |
veil_clear_int4array(name text) returns bool
Clear an Int4Array variable.
Each entry in the array will be zeroed.
fcinfo | name text The name of the Int4Array variable. |
bool
True Definition at line 2245 of file veil_interface.c.
References ensure_init(), GetInt4Array(), strfromtext(), veil_int4array_set(), and vl_ClearInt4Array().
Referenced by veil_init_int4array().
Datum veil_int4array_set | ( | PG_FUNCTION_ARGS | ) |
veil_int4array_set(array text, idx int4, value int4) returns int4
Set an Int4Array entry.
fcinfo | array text The name of the Int4Array variable. idx int4 Index of the entry to be set value int4 Value to which the entry will be set |
int4
The new value of the array entry Definition at line 2271 of file veil_interface.c.
References ensure_init(), GetInt4Array(), strfromtext(), veil_int4array_get(), and vl_Int4ArraySet().
Referenced by veil_clear_int4array().
Datum veil_int4array_get | ( | PG_FUNCTION_ARGS | ) |
veil_int4array_get(array text, idx int4) returns int4
Get an Int4Array entry.
fcinfo | array text The name of the Int4Array variable. idx int4 Index of the entry to be retrieved |
int4
The value of the array entry Definition at line 2299 of file veil_interface.c.
References ensure_init(), GetInt4Array(), strfromtext(), veil_init(), and vl_Int4ArrayGet().
Referenced by veil_int4array_set().
Datum veil_init | ( | PG_FUNCTION_ARGS | ) |
veil_init(doing_reset bool) returns bool
Initialise or reset a veil session.
The boolean parameter will be false when called for initialisation, and true when performing a reset.
This function may be redefined as a custom function in your implementation, or will call initialisation functions registered in the table veil.veil_init_fns.
fcinfo | doing_reset bool Whether we are being called in order to reset (true) the session or (false) simply to initialise it. |
bool
True Definition at line 2334 of file veil_interface.c.
References veil_perform_reset(), and vl_call_init_fns().
Referenced by veil_int4array_get().
Datum veil_perform_reset | ( | PG_FUNCTION_ARGS | ) |
veil_perform_reset() returns bool
Reset veil shared memory for this database.
This creates a new shared memory context with none of the existing shared variables. All current transactions will be able to continue using the current variables, all new transactions will see the new set, once this function has completed.
fcinfo |
bool
True if the function is able to complete successfully. If it is unable, no harm will have been done but neither will a memory reset have been performed. Definition at line 2364 of file veil_interface.c.
References ensure_init(), veil_force_reset(), vl_bool_from_query(), vl_complete_context_switch(), vl_prepare_context_switch(), vl_spi_connect(), and vl_spi_finish().
Referenced by veil_init().
Datum veil_force_reset | ( | PG_FUNCTION_ARGS | ) |
veil_force_reset() returns bool
Reset veil shared memory for this database, ignoring existing transactions.
This function will always reset the shared memory context, even for sessions that are still using it. Having taken this drastic action, it will then cause a panic to reset the server.
Question - won't a panic reset the shared memory in any case? Is the panic superfluous, or maybe is this entire function superfluous?
fcinfo |
bool
True. Definition at line 2420 of file veil_interface.c.
References ensure_init(), veil_version(), and vl_force_context_switch().
Referenced by veil_perform_reset().
Datum veil_version | ( | PG_FUNCTION_ARGS | ) |
veil_version() returns text
Return a string describing this version of veil.
fcinfo |
text
String describing the version. Definition at line 2437 of file veil_interface.c.
References textfromstr(), veil_serialise(), VEIL_VERSION, and VEIL_VERSION_INFO.
Referenced by veil_force_reset().
Datum veil_serialise | ( | PG_FUNCTION_ARGS | ) |
veil_serialise(varname text) returns text
Return a string representing the contents of our variable.
fcinfo | varname text Name of the variable to be serialised. |
text
String containing the serialised variable. Definition at line 2460 of file veil_interface.c.
References ensure_init(), strfromtext(), textfromstr(), veil_deserialise(), and vl_serialise_var().
Referenced by veil_version().
Datum veil_deserialise | ( | PG_FUNCTION_ARGS | ) |
veil_deserialise(stream text) returns text
Create or reset variables based on the output of previous veil_serialise calls.
fcinfo | stream text Serialised variables string |
int4
Count of the items de-serialised from the string. Definition at line 2495 of file veil_interface.c.
References ensure_init(), strfromtext(), and vl_deserialise().
Referenced by veil_serialise().
char* vl_serialise_var | ( | char * | name | ) |
Serialise a veil variable.
name | The name of the variable to be serialised. |
Definition at line 911 of file veil_serialise.c.
References VarEntry::obj, Object::type, and vl_lookup_variable().
Referenced by veil_serialise().
int32 vl_deserialise | ( | char ** | p_stream | ) |
De-serialise a base64 string containing, possibly many, derialised veil variables.
**p_stream | Pointer into the stream currently being read. |
Definition at line 996 of file veil_serialise.c.
References vl_deserialise_next().
Referenced by veil_deserialise().
VarEntry* vl_deserialise_next | ( | char ** | p_stream | ) |
De-serialise the next veil variable from *p_stream.
**p_stream | Pointer into the stream currently being read. pointer is updated to point to the next free slot in the stream after reading the stream |
Definition at line 958 of file veil_serialise.c.
References deserialise_bitmap(), deserialise_bitmap_array(), deserialise_bitmap_hash(), deserialise_char(), deserialise_int4array(), deserialise_int4var(), and deserialise_range().
Referenced by vl_deserialise().