skip_list.c
Go to the documentation of this file.
151 if ((NULL != duplicate->key) && (skiplist->super.compare(duplicate->key, key, key_size) == 0)) {
166 while (NULL != duplicate->next[0] && skiplist->super.compare(duplicate->next[0]->key, key, key_size) == 0) {
191 while (NULL != cursor->next[h] && skiplist->super.compare(key, cursor->next[h]->key, key_size) >= 0) {
249 while (NULL != cursor && skiplist->super.compare(cursor->key, key, skiplist->super.record.key_size) == 0) {
277 while (NULL != cursor->next[h] && skiplist->super.compare(cursor->next[h]->key, key, key_size) < 0) {
281 if ((NULL != cursor->next[h]) && (skiplist->super.compare(cursor->next[h]->key, key, key_size) == 0)) {
284 while (NULL != cursor->next[h] && skiplist->super.compare(cursor->next[h]->key, key, key_size) == 0) {
326 while (NULL != cursor->next[h] && skiplist->super.compare(cursor->next[h]->key, key, key_size) <= 0) {
327 if ((NULL != cursor->next[h]) && (skiplist->super.compare(cursor->next[h]->key, key, key_size) == 0)) {
345 while ((rand() < skiplist->pnum * (RAND_MAX / skiplist->pden)) && level < skiplist->maxheight) {
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
Definition: kv_system.h:160
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.
Definition: kv_system.h:130
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
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
Struct of the Skiplist, holds metadata and the entry point into the skiplist.
Definition: skip_list_types.h:67
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
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
Definition: kv_system.h:176
Definition: kv_system.h:162
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
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
ion_err_t sl_destroy(ion_skiplist_t *skiplist)
Destroys the skiplist in memory.
Definition: skip_list.c:95
Implementation of a Skiplist data store.
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
Definition: kv_system.h:123
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290