MobilityDB  1.0
Functions | Variables
skiplist.c File Reference

Functions manipulating skiplists. More...

#include "general/skiplist.h"
#include <assert.h>
#include <executor/spi.h>
#include <gsl/gsl_rng.h>
#include <libpq/pqformat.h>
#include <utils/memutils.h>
#include <utils/timestamp.h>
#include "general/timestampset.h"
#include "general/period.h"
#include "general/periodset.h"
#include "general/timeops.h"
#include "general/temporal_util.h"
Include dependency graph for skiplist.c:

Functions

static MemoryContext set_aggregation_context (FunctionCallInfo fcinfo)
 Switch to the memory context for aggregation. More...
 
static void unset_aggregation_context (MemoryContext ctx)
 Switch to the given memory context. More...
 
static long int gsl_random48 ()
 
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 (FunctionCallInfo fcinfo, SkipList *list)
 Allocate memory for the skiplist. More...
 
static void skiplist_free (FunctionCallInfo fcinfo, SkipList *list, int cur)
 Free memory for the skiplist. More...
 
static RelativeTimePos skiplist_elmpos (const SkipList *list, int cur, TimestampTz t)
 Comparison function used for skiplists. More...
 
SkipListskiplist_make (FunctionCallInfo fcinfo, void **values, int count, ElemType elemtype)
 Outputs the skiplist in graphviz dot format for visualisation and debugging purposes. More...
 
void * skiplist_headval (SkipList *list)
 Returns the value at the head of the skiplist. More...
 
void skiplist_splice (FunctionCallInfo fcinfo, SkipList *list, void **values, int count, datum_func2 func, bool crossings)
 Splice the skiplist with the array of values using the aggregation function. More...
 
void ** skiplist_values (SkipList *list)
 Returns the values contained in the skiplist. More...
 
static void aggstate_write (SkipList *state, StringInfo buf)
 Writes the state value into the buffer. More...
 
static SkipListaggstate_read (FunctionCallInfo fcinfo, StringInfo buf)
 Reads the state value from the buffer. More...
 
void aggstate_set_extra (FunctionCallInfo fcinfo, SkipList *state, void *data, size_t size)
 Reads the state value from the buffer. More...
 
PGDLLEXPORT Datum tagg_serialize (PG_FUNCTION_ARGS)
 Serialize the state value. More...
 
PGDLLEXPORT Datum tagg_deserialize (PG_FUNCTION_ARGS)
 Deserialize the state value. More...
 

Variables

gsl_rng * _aggregation_rng = NULL
 

Detailed Description

Functions manipulating skiplists.