Veil
Bitmap Hashes

A bitmap hashes is a hash table of identically-ranged bitmaps, indexed by a text key.

Typically bitmap hashes are used for sparse collections of privileges.

Note that bitmap hashes may not be stored in shared variables as hashes in shared memory are insufficiently dynamic.

The following functions comprise the Veil bitmap hashes API:

init_bitmap_hash(bmhash text, range text)

function veil.init_bitmap_hash(bmhash text, range text) returns bool

Creates, or resets, a bitmap hash. Implemented by C function veil_init_bitmap_hash().

clear_bitmap_hash(bmhash text)

function veil.clear_bitmap_hash(bmhash text) returns bool

Clear all bits in all bitmaps of a bitmap hash. Implemented by C function veil_clear_bitmap_hash(). Implemented by C function veil_clear_bitmap_hash().

bitmap_hash_key_exists(bmhash text, key text)

function veil.bitmap_hash_key_exists(bmhash text, key text) returns bool

Determine whether a given key exists in the hash (contains a bitmap). Implemented by C function veil_bitmap_hash_key_exists().

bitmap_from_hash(bmref text, bmhash text, key text)

function veil.bitmap_from_hash(bmref text, bmhash text, key text) returns text

Generate a reference to a specific bitmap in a bitmap hash. Implemented by C function veil_bitmap_from_hash().

bitmap_hash_testbit(bmhash text, key text, bitno int4)

function veil.bitmap_hash_testbit(bmhash text, key text, bitno int4) returns bool

Test a specific bit in a bitmap hash. Implemented by C function veil_bitmap_hash_testbit().

bitmap_hash_setbit(bmhash text, kay text, bitno int4)

function veil.bitmap_hash_setbit(bmhash text, key text, bitno int4) returns bool

Set a specific bit in a bitmap hash. Implemented by C function veil_bitmap_hash_setbit().

bitmap_hash_clearbit(bmhash text, key text, bitno int4)

function veil.bitmap_hash_clearbit(bmhash text, key text, bitno int4) returns bool

Clear a specific bit in a bitmap hash. Implemented by C function veil_bitmap_hash_clearbit().

union_into_bitmap_hash(bmhash text, key text, bitmap text)

function veil.union_into_bitmap_hash(bmhash text, key text, bitmap text) returns bool

Union a specified bitmap from a hash with a bitmap, with the result in the bitmap hash. Implemented by C function veil_union_into_bitmap_hash(). This is a faster shortcut for the following logical construction:

veil.bitmap_union(veil.bitmap_from_hash(<bitmap_hash>, <key>), <bitmap>)

union_from_bitmap_hash(bmhash text, key text, bitmap text)

function veil.union_from_bitmap_hash(bmhash text, key text, bitmap text) returns bool

Union a bitmap with a specified bitmap from a hash, with the result in the bitmap. Implemented by C function veil_union_from_bitmap_hash(). This is a faster shortcut for the following logical construction:

veil.bitmap_union(<bitmap>, veil.bitmap_from_hash(<bitmap_array>, <key>))

intersect_from_bitmap_hash(bitmap text, bmhash text, key text)

function veil.intersect_from_bitmap_hash(bitmap text, bmhash text, key text) returns bool

Intersect a bitmap with a specified bitmap from a hash, with the result in the bitmap. Implemented by C function veil_intersect_from_bitmap_hash(). This is a faster shortcut for the following logical construction:

veil.bitmap_intersect(<bitmap>, veil.bitmap_from_hash(<bitmap_array>, <key>))

bitmap_hash_bits(bmhash text, key text)

function veil.bitmap_hash_bits(bmhash text, key text) returns setof int4

Show all bits in the specific bitmap within a hash. This is primarily intended for interactive use when developing and debugging Veil-based systems. Implemented by C function veil_bitmap_hash_bits().

bitmap_hash_range(bmhash text)

function veil.bitmap_hash_range(bmhash text) returns veil_range_t

Show the range, as a veil_range_t, of all bitmaps in the hash. Primarily intended for interactive use. Implemented by C function veil_bitmap_hash_range().

bitmap_hash_entries(bmhash text)

function veil.bitmap_hash_entries(bmhash text) returns setof text

Show every key in the hash. Primarily intended for interactive use. Implemented by C function veil_bitmap_hash_entries().

Next: Integer Arrays