skip_list.h
Go to the documentation of this file.
1 /******************************************************************************/
35 /******************************************************************************/
36 
37 #if !defined(SKIP_LIST_STORE_H_)
38 #define SKIP_LIST_STORE_H_
39 
40 #if defined(__cplusplus)
41 extern "C" {
42 #endif
43 
44 #include "skip_list_types.h"
45 /* #include <time.h> / * For random seed * / */
46 
69  ion_key_type_t key_type,
70  int key_size,
71  int value_size,
72  int maxheight,
73  int pnum,
74  int pden
75 );
76 
89 );
90 
107 sl_insert(
109  ion_key_t key,
110  ion_value_t value
111 );
112 
128 sl_get(
130  ion_key_t key,
131  ion_value_t value
132 );
133 
151 sl_update(
153  ion_key_t key,
154  ion_value_t value
155 );
156 
172 sl_delete(
174  ion_key_t key
175 );
176 
189  ion_key_t key
190 );
191 
199 void
202 );
203 
216 );
217 
218 #if defined(__cplusplus)
219 }
220 #endif
221 
222 #endif /* SKIP_LIST_STORE_H_ */
ion_status_t sl_update(ion_skiplist_t *skiplist, ion_key_t key, ion_value_t value)
Updates the value stored at key with the new value.
Definition: skip_list.c:225
enum ION_KEY_TYPE ion_key_type_t
This is the available key types for ION_DB. All types will be based on system defines.
ion_sl_node_t * sl_find_node(ion_skiplist_t *skiplist, ion_key_t key)
Searches for a node with the given key. Used in conjunction with sl_query to perform key lookups...
Definition: skip_list.c:317
Struct of the Skiplist, holds metadata and the entry point into the skiplist.
ion_err_t sl_initialize(ion_skiplist_t *skiplist, ion_key_type_t key_type, int key_size, int value_size, int maxheight, int pnum, int pden)
Initializes an in-memory skiplist.
Definition: skip_list.c:41
ion_status_t sl_delete(ion_skiplist_t *skiplist, ion_key_t key)
Attempts to delete all key/value pairs stored at the given key.
Definition: skip_list.c:261
int ion_sl_level_t
ion_sl_level_t sl_gen_level(ion_skiplist_t *skiplist)
Generates a psuedo-random height, bounded within [0, maxheight). The generator is seeded using the cu...
Definition: skip_list.c:340
Contains all types local to the skiplist data structure.
#define key(k)
Definition: bpp_tree.c:75
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
Struct of a node in the skiplist.
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
void print_skiplist(ion_skiplist_t *skiplist)
Iterates through each level of a skiplist and prints out the content of each node in a meaningful way...
Definition: skip_list.c:353
void * ion_value_t
A dictionary value.
Definition: kv_system.h:246
ion_err_t sl_destroy(ion_skiplist_t *skiplist)
Destroys the skiplist in memory.
Definition: skip_list.c:95
ion_status_t sl_get(ion_skiplist_t *skiplist, ion_key_t key, ion_value_t value)
Requests the value stored at the given key.
Definition: skip_list.c:206
ion_status_t sl_insert(ion_skiplist_t *skiplist, ion_key_t key, ion_value_t value)
Inserts a key value pair into the skiplist.
Definition: skip_list.c:115
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290