MobilityDB 1.3
Loading...
Searching...
No Matches
Macros | Functions
skiplist.c File Reference

Functions manipulating skiplists. More...

#include "temporal/skiplist.h"
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <postgres.h>
#include <utils/timestamp.h>
#include <meos.h>
#include <meos_internal.h>
#include "temporal/temporal_aggfuncs.h"
#include "temporal/type_util.h"

Macros

#define MaxAllocSize   ((Size) 0x3fffffff) /* 1 gigabyte - 1 */
 
#define SKIPLIST_GROW   1
 double the capacity to expand the skiplist More...
 
#define SKIPLIST_INITIAL_CAPACITY   1024
 
#define SKIPLIST_INITIAL_FREELIST   32
 

Functions

static long int gsl_random48 ()
 
int keyval_skiplist_common (SkipList *list, void **keys, void **values, int count, int *lower, int *upper, int update[SKIPLIST_MAXLEVEL])
 Output the skiplist in graphviz dot format for visualisation and debugging purposes. More...
 
void ** keyval_skiplist_merge (SkipList *list, void **keys1, void **values1, int count1, void **keys2, void **values2, int count2, int *newcount, void ***newkeys, void ***tofree, int *nfree)
 Generic aggregate function for temporal values. More...
 
static int random_level ()
 This simulates up to SKIPLIST_MAXLEVEL repeated coin flips without spinning the RNG every time (courtesy of the internet) More...
 
static int skiplist_alloc (SkipList *list)
 Return the position to store an additional element in the skiplist. More...
 
static void skiplist_delete (SkipList *list, int cur)
 Delete an element from the skiplist. More...
 
static int skiplist_elempos (const SkipList *list, void *key, void *value, int cur)
 Comparison function used for skiplist elements. More...
 
void skiplist_free (SkipList *list)
 Delete the skiplist and free its allocated memory. More...
 
void * skiplist_headval (SkipList *list)
 Return the value at the head of the skiplist. More...
 
void ** skiplist_keys_values (SkipList *list, void **values)
 Return the keys and the values contained in the skiplist. More...
 
SkipListskiplist_make (size_t key_size, size_t value_size, int(*comp_fn)(void *, void *), void *(*merge_fn)(void *, void *))
 Constructs an empty skiplist. More...
 
int skiplist_search (SkipList *list, void *key, void *value)
 Search an element in the skiplist. More...
 
void skiplist_set_extra (SkipList *list, void *data, size_t size)
 Reads the state value from the buffer. More...
 
void skiplist_splice (SkipList *list, void **keys, void **values, int count, datum_func2 func, bool crossings, SkipListType sktype)
 Insert a new set of values to the skiplist while performing the aggregation between the new values that overlap with the values in the list. More...
 
void ** skiplist_values (SkipList *list)
 Return the values contained in the skiplist. More...
 
SkipListtemporal_skiplist_make ()
 Constructs an empty skiplist. More...
 

Detailed Description

Functions manipulating skiplists.

Note
See the description of skip lists in Wikipedia https://en.wikipedia.org/wiki/Skip_list Note also that according to https://github.com/postgres/postgres/blob/master/src/backend/utils/mmgr/README#L99 pfree/repalloc Do Not Depend On CurrentMemoryContext