skip_list_handler.c File Reference

Description

Handler liaison between dictionary API and skiplist implementation.

Author
Eric Huang
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1.Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2.Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3.Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file skip_list_handler.c.

Include dependency graph for skip_list_handler.c:

Functions

ion_status_t sldict_get (ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
 Queries a dictionary instance for a given key and returns the corresponding value. More...
 
ion_cursor_status_t sldict_next (ion_dict_cursor_t *cursor, ion_record_t *record)
 Next function queries and retrieves the next key/value pair that satisfies the predicate of the cursor. More...
 
ion_err_t sldict_close_dictionary (ion_dictionary_t *dictionary)
 Closes a skiplist instance of a dictionary. More...
 
void sldict_destroy_cursor (ion_dict_cursor_t **cursor)
 Destroys the cursor. More...
 
ion_err_t sldict_find (ion_dictionary_t *dictionary, ion_predicate_t *predicate, ion_dict_cursor_t **cursor)
 Finds multiple keys based on the provided predicate. More...
 
ion_err_t sldict_open_dictionary (ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary, ion_dictionary_config_info_t *config, ion_dictionary_compare_t compare)
 Opens a specific skiplist instance of a dictionary. More...
 
void sldict_init (ion_dictionary_handler_t *handler)
 Registers a skiplist handler to a dictionary instance. More...
 
ion_status_t sldict_insert (ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
 Inserts a key and value pair into the dictionary. More...
 
ion_err_t sldict_create_dictionary (ion_dictionary_id_t id, ion_key_type_t key_type, ion_key_size_t key_size, ion_value_size_t value_size, ion_dictionary_size_t dictionary_size, ion_dictionary_compare_t compare, ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary)
 Creates an instance of a dictionary. More...
 
ion_status_t sldict_delete (ion_dictionary_t *dictionary, ion_key_t key)
 Deletes the key and associated value from the given dictionary instance. More...
 
ion_err_t sldict_delete_dictionary (ion_dictionary_t *dictionary)
 Deletes an instance of a dictionary and its associated data. More...
 
ion_err_t sldict_destroy_dictionary (ion_dictionary_id_t id)
 Deletes an instance of a closed dictionary. More...
 
ion_status_t sldict_update (ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
 Updates the value stored at a given key. More...
 

Function Documentation

ion_err_t sldict_close_dictionary ( ion_dictionary_t dictionary)

Closes a skiplist instance of a dictionary.

Parameters
dictionaryA pointer to the specific dictionary instance to be closed.
Returns
The status of closing the dictionary.

Definition at line 125 of file skip_list_handler.c.

127  {
128  UNUSED(dictionary);
129  return err_not_implemented;
130 }
#define UNUSED(x)
Definition: kv_system.h:102

Here is the caller graph for this function:

ion_err_t sldict_create_dictionary ( ion_dictionary_id_t  id,
ion_key_type_t  key_type,
ion_key_size_t  key_size,
ion_value_size_t  value_size,
ion_dictionary_size_t  dictionary_size,
ion_dictionary_compare_t  compare,
ion_dictionary_handler_t handler,
ion_dictionary_t dictionary 
)

Creates an instance of a dictionary.

Creates an instance of a dictionary given a key_size and value_size, in bytes as well as the dictionary_size, which is the maximum number of levels in the skiplist. By nature of the structure, the maximum number of elements is bounded only by memory use.

Parameters
id
key_type
key_sizeSize of the key in bytes.
value_sizeSize of the value in bytes.
dictionary_size
compare
handlerHandler to be bound to the dictionary instance being created. Assumption is that the handler has been initialized prior.
dictionaryPointer in which the created dictionary instance is to be stored. Assumption is that it has been properly allocated by the user.
Returns
Status of creation.

Definition at line 376 of file skip_list_handler.c.

385  {
386  UNUSED(id);
387 
388  int pnum, pden;
389 
390  dictionary->instance = malloc(sizeof(ion_skiplist_t));
391 
392  if (NULL == dictionary->instance) {
393  return err_out_of_memory;
394  }
395 
396  dictionary->instance->compare = compare;
398 
399  pnum = 1;
400  pden = 4;
401 
402  ion_err_t result = sl_initialize((ion_skiplist_t *) dictionary->instance, key_type, key_size, value_size, dictionary_size, pnum, pden);
403 
404  if ((err_ok == result) && (NULL != handler)) {
405  dictionary->handler = handler;
406  }
407 
408  return result;
409 }
Struct of the Skiplist, holds metadata and the entry point into the skiplist.
ion_dictionary_handler_t * handler
ion_dictionary_parent_t * instance
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
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
ion_dictionary_type_t type
#define UNUSED(x)
Definition: kv_system.h:102
ion_dictionary_compare_t compare

Here is the call graph for this function:

Here is the caller graph for this function:

ion_status_t sldict_delete ( ion_dictionary_t dictionary,
ion_key_t  key 
)

Deletes the key and associated value from the given dictionary instance.

Parameters
dictionaryThe instance of the dictionary to delete from.
keyThe key to be deleted.
Returns
Status of deletion.

Definition at line 412 of file skip_list_handler.c.

415  {
416  return sl_delete((ion_skiplist_t *) dictionary->instance, key);
417 }
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
Struct of the Skiplist, holds metadata and the entry point into the skiplist.
ion_dictionary_parent_t * instance
#define key(k)
Definition: bpp_tree.c:75

Here is the call graph for this function:

Here is the caller graph for this function:

ion_err_t sldict_delete_dictionary ( ion_dictionary_t dictionary)

Deletes an instance of a dictionary and its associated data.

Parameters
dictionaryThe instance of the dictionary to be deleted.
Returns
Status of dictionary deletion.

Definition at line 420 of file skip_list_handler.c.

422  {
423  ion_err_t result = sl_destroy((ion_skiplist_t *) dictionary->instance);
424 
425  free(dictionary->instance);
426  dictionary->instance = NULL;
427  return result;
428 }
Struct of the Skiplist, holds metadata and the entry point into the skiplist.
ion_dictionary_parent_t * instance
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
ion_err_t sl_destroy(ion_skiplist_t *skiplist)
Destroys the skiplist in memory.
Definition: skip_list.c:95

Here is the call graph for this function:

Here is the caller graph for this function:

void sldict_destroy_cursor ( ion_dict_cursor_t **  cursor)

Destroys the cursor.

Destroys the cursor when the user is finished with it. All memory internally used by the cursor is freed as well. Cursor pointers will be set to NULL as per IonDB specification.

Parameters
cursorPointer to a pointer of a cursor.

Definition at line 143 of file skip_list_handler.c.

145  {
146  (*cursor)->predicate->destroy(&(*cursor)->predicate);
147  free(*cursor);
148  *cursor = NULL;
149 }

Here is the caller graph for this function:

ion_err_t sldict_destroy_dictionary ( ion_dictionary_id_t  id)

Deletes an instance of a closed dictionary.

Parameters
idThe identifier identifying the dictionary to destroy.
Returns
Status of dictionary deletion.

Definition at line 431 of file skip_list_handler.c.

433  {
434  UNUSED(id);
435  return err_not_implemented;
436 }
#define UNUSED(x)
Definition: kv_system.h:102

Here is the caller graph for this function:

ion_err_t sldict_find ( ion_dictionary_t dictionary,
ion_predicate_t predicate,
ion_dict_cursor_t **  cursor 
)

Finds multiple keys based on the provided predicate.

Finds multiple keys based on the provided predicate. Gives a cursor that allows traversal of all key/value pairs that satisfy the predicate. Not all implementations support a find.

Parameters
dictionaryThe instance of a dictionary to search within.
predicateThe predicate used to match.
cursorThe pointer to a cursor declared by the caller, but initialized and populated within the function.
Returns
Status of find.

Definition at line 168 of file skip_list_handler.c.

172  {
173  *cursor = malloc(sizeof(ion_sldict_cursor_t));
174 
175  ion_skiplist_t *skip_list = (ion_skiplist_t *) dictionary->instance;
176 
177  if (NULL == *cursor) {
178  return err_out_of_memory;
179  }
180 
181  (*cursor)->dictionary = dictionary;
182  (*cursor)->status = cs_cursor_uninitialized;
183 
184  (*cursor)->destroy = sldict_destroy_cursor;
185  (*cursor)->next = sldict_next;
186 
187  (*cursor)->predicate = malloc(sizeof(ion_predicate_t));
188 
189  if (NULL == (*cursor)->predicate) {
190  free(*cursor);
191  return err_out_of_memory;
192  }
193 
194  (*cursor)->predicate->type = predicate->type;
195  (*cursor)->predicate->destroy = predicate->destroy;
196 
197  ion_key_size_t key_size = dictionary->instance->record.key_size;
198 
199  switch (predicate->type) {
200  case predicate_equality: {
201  ion_key_t target_key = predicate->statement.equality.equality_value;
202 
203  (*cursor)->predicate->statement.equality.equality_value = malloc(key_size);
204 
205  if (NULL == (*cursor)->predicate->statement.equality.equality_value) {
206  free((*cursor)->predicate);
207  free(*cursor);
208  return err_out_of_memory;
209  }
210 
211  memcpy((*cursor)->predicate->statement.equality.equality_value, target_key, key_size);
212 
213  ion_sl_node_t *loc = sl_find_node((ion_skiplist_t *) dictionary->instance, target_key);
214 
215  if ((NULL == loc->key) || (dictionary->instance->compare(loc->key, target_key, key_size) != 0)) {
216  /* If this happens, that means the target key doesn't exist */
217  (*cursor)->status = cs_end_of_results;
218  return err_ok;
219  }
220  else {
221  (*cursor)->status = cs_cursor_initialized;
222 
223  ion_sldict_cursor_t *sl_cursor = (ion_sldict_cursor_t *) (*cursor);
224 
225  sl_cursor->current = loc;
226  return err_ok;
227  }
228 
229  break;
230  }
231 
232  case predicate_range: {
233  (*cursor)->predicate->statement.range.lower_bound = malloc(key_size);
234 
235  if (NULL == (*cursor)->predicate->statement.range.lower_bound) {
236  free((*cursor)->predicate);
237  free(*cursor);
238  return err_out_of_memory;
239  }
240 
241  memcpy((*cursor)->predicate->statement.range.lower_bound, predicate->statement.range.lower_bound, key_size);
242 
243  (*cursor)->predicate->statement.range.upper_bound = malloc(key_size);
244 
245  if (NULL == (*cursor)->predicate->statement.range.upper_bound) {
246  free((*cursor)->predicate->statement.range.lower_bound);
247  free((*cursor)->predicate);
248  free(*cursor);
249  return err_out_of_memory;
250  }
251 
252  memcpy((*cursor)->predicate->statement.range.upper_bound, predicate->statement.range.upper_bound, key_size);
253 
254  /* Try to find the node containing the upper bound. */
255  ion_sl_node_t *loc = sl_find_node((ion_skiplist_t *) dictionary->instance, (*cursor)->predicate->statement.range.upper_bound);
256 
257  if ((NULL == loc->key) || (dictionary->instance->compare(loc->key, (*cursor)->predicate->statement.range.lower_bound, key_size) < 0)) {
258  /* This means the returned node is smaller than the lower bound, which means that there are no valid records to return */
259  (*cursor)->status = cs_end_of_results;
260  return err_ok;
261  }
262  else {
263  loc = sl_find_node((ion_skiplist_t *) dictionary->instance, (*cursor)->predicate->statement.range.lower_bound);
264 
265  if (NULL == loc->key) {
266  /* If this happens, then we hit the head node. Just move to the first valid data item (if exists) */
267  loc = loc->next[0];
268  }
269 
270  /* Increment the location until we hit valid data. It is impossible to fall through here, since we just confirmed previously */
271  /* that there does indeed exist valid data (See above check). */
272  while (NULL != loc && (dictionary->instance->compare(loc->key, (*cursor)->predicate->statement.range.lower_bound, key_size) < 0)) {
273  loc = loc->next[0];
274  }
275 
276  /* We sanity check this anyways just in case. */
277  if (NULL == loc) {
278  (*cursor)->status = cs_end_of_results;
279  return err_ok;
280  }
281 
282  (*cursor)->status = cs_cursor_initialized;
283 
284  ion_sldict_cursor_t *sl_cursor = (ion_sldict_cursor_t *) (*cursor);
285 
286  sl_cursor->current = loc;
287  return err_ok;
288  }
289 
290  break;
291  }
292 
293  case predicate_all_records: {
294  ion_sldict_cursor_t *sl_cursor = (ion_sldict_cursor_t *) (*cursor);
295 
296  if (NULL == skip_list->head->next[0]) {
297  (*cursor)->status = cs_end_of_results;
298  }
299  else {
300  sl_cursor->current = skip_list->head->next[0];
301  (*cursor)->status = cs_cursor_initialized;
302  }
303 
304  return err_ok;
305  break;
306  }
307 
308  case predicate_predicate: {
309  break;
310  }
311 
312  default: {
313  return err_invalid_predicate;
314  break;
315  }
316  }
317 
318  return err_ok;
319 }
ion_record_info_t record
Struct of the Skiplist, holds metadata and the entry point into the skiplist.
ion_predicate_statement_t statement
ion_dictionary_parent_t * instance
struct sl_node ** next
ion_sl_node_t * head
Struct of a node in the skiplist.
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
void(* destroy)(ion_predicate_t **)
ion_equality_statement_t equality
void sldict_destroy_cursor(ion_dict_cursor_t **cursor)
Destroys the cursor.
ion_predicate_type_t type
ion_key_t key
ion_key_size_t key_size
Definition: kv_system.h:307
A supertype for cursor predicate objects.
ion_sl_node_t * current
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_dictionary_compare_t compare
int ion_key_size_t
The size (length) of a dictionary key in bytes.
Definition: kv_system.h:251
ion_cursor_status_t sldict_next(ion_dict_cursor_t *cursor, ion_record_t *record)
Next function queries and retrieves the next key/value pair that satisfies the predicate of the curso...
ion_range_statement_t range
ion_dictionary_status_t status

Here is the call graph for this function:

Here is the caller graph for this function:

ion_status_t sldict_get ( ion_dictionary_t dictionary,
ion_key_t  key,
ion_value_t  value 
)

Queries a dictionary instance for a given key and returns the corresponding value.

Queries a dictionary instance for a given key and returns the value within, copied into the pointer provided by the user. Assumption is that the pointer is passed unallocated, for this function to allocate. The responsibility is then on the user to free the given memory.

Parameters
dictionaryThe instance of the dictionary to query
keyThe key to search for.
valueA pointer used to hold the returned value from the query. The memory for value is assumed to be allocated and freed by the user.
Returns
Status of query.

Definition at line 60 of file skip_list_handler.c.

64  {
65  return sl_get((ion_skiplist_t *) dictionary->instance, key, value);
66 }
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.
ion_dictionary_parent_t * instance
#define key(k)
Definition: bpp_tree.c:75

Here is the call graph for this function:

Here is the caller graph for this function:

void sldict_init ( ion_dictionary_handler_t handler)

Registers a skiplist handler to a dictionary instance.

Binds each unique skiplist function to the generic dictionary interface. Only needs to be called once when the skiplist is initialized.

Parameters
handlerAn instance of a dictionary handler that is to be bound. It is assumed handler is initialized by the user.

Definition at line 351 of file skip_list_handler.c.

353  {
354  handler->insert = sldict_insert;
355  handler->get = sldict_get;
357  handler->remove = sldict_delete;
360  handler->update = sldict_update;
361  handler->find = sldict_find;
364 }
ion_status_t(* insert)(ion_dictionary_t *, ion_key_t, ion_value_t)
ion_err_t sldict_find(ion_dictionary_t *dictionary, ion_predicate_t *predicate, ion_dict_cursor_t **cursor)
Finds multiple keys based on the provided predicate.
ion_status_t sldict_update(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Updates the value stored at a given key.
ion_status_t(* remove)(ion_dictionary_t *, ion_key_t)
ion_err_t(* destroy_dictionary)(ion_dictionary_id_t id)
ion_err_t sldict_create_dictionary(ion_dictionary_id_t id, ion_key_type_t key_type, ion_key_size_t key_size, ion_value_size_t value_size, ion_dictionary_size_t dictionary_size, ion_dictionary_compare_t compare, ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary)
Creates an instance of a dictionary.
ion_err_t sldict_close_dictionary(ion_dictionary_t *dictionary)
Closes a skiplist instance of a dictionary.
ion_status_t(* update)(ion_dictionary_t *, ion_key_t, ion_value_t)
ion_status_t sldict_delete(ion_dictionary_t *dictionary, ion_key_t key)
Deletes the key and associated value from the given dictionary instance.
ion_err_t sldict_destroy_dictionary(ion_dictionary_id_t id)
Deletes an instance of a closed dictionary.
ion_err_t(* close_dictionary)(ion_dictionary_t *)
ion_err_t(* open_dictionary)(ion_dictionary_handler_t *, ion_dictionary_t *, ion_dictionary_config_info_t *, ion_dictionary_compare_t)
ion_err_t(* create_dictionary)(ion_dictionary_id_t, ion_key_type_t, ion_key_size_t, ion_value_size_t, ion_dictionary_size_t, ion_dictionary_compare_t, ion_dictionary_handler_t *, ion_dictionary_t *)
ion_err_t(* delete_dictionary)(ion_dictionary_t *)
ion_status_t sldict_insert(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Inserts a key and value pair into the dictionary.
ion_err_t(* find)(ion_dictionary_t *, ion_predicate_t *, ion_dict_cursor_t **)
ion_err_t sldict_delete_dictionary(ion_dictionary_t *dictionary)
Deletes an instance of a dictionary and its associated data.
ion_status_t sldict_get(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Queries a dictionary instance for a given key and returns the corresponding value.
ion_err_t sldict_open_dictionary(ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary, ion_dictionary_config_info_t *config, ion_dictionary_compare_t compare)
Opens a specific skiplist instance of a dictionary.
ion_status_t(* get)(ion_dictionary_t *, ion_key_t, ion_value_t)

Here is the call graph for this function:

Here is the caller graph for this function:

ion_status_t sldict_insert ( ion_dictionary_t dictionary,
ion_key_t  key,
ion_value_t  value 
)

Inserts a key and value pair into the dictionary.

Parameters
dictionaryThe dictionary instance to insert the value into.
keyThe key to use.
valueThe value to use.
Returns
Status of insertion.

Definition at line 367 of file skip_list_handler.c.

371  {
372  return sl_insert((ion_skiplist_t *) dictionary->instance, key, value);
373 }
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
Struct of the Skiplist, holds metadata and the entry point into the skiplist.
ion_dictionary_parent_t * instance
#define key(k)
Definition: bpp_tree.c:75

Here is the call graph for this function:

Here is the caller graph for this function:

ion_cursor_status_t sldict_next ( ion_dict_cursor_t cursor,
ion_record_t record 
)

Next function queries and retrieves the next key/value pair that satisfies the predicate of the cursor.

Parameters
cursorThe cursor used to iterate over results.
recordA record pointer that is allocated by the caller in which the cursor will fill with the next key/value result. The assumption is that the caller will also free this memory.
Returns
Status of cursor.

Definition at line 81 of file skip_list_handler.c.

84  {
85  ion_sldict_cursor_t *sl_cursor = (ion_sldict_cursor_t *) cursor;
86 
87  if (cursor->status == cs_cursor_uninitialized) {
88  return cursor->status;
89  }
90  else if (cursor->status == cs_end_of_results) {
91  return cursor->status;
92  }
93  else if ((cursor->status == cs_cursor_initialized) || (cursor->status == cs_cursor_active)) {
94  if (cursor->status == cs_cursor_active) {
95  if ((NULL == sl_cursor->current) || (test_predicate(cursor, sl_cursor->current->key) == boolean_false)) {
96  cursor->status = cs_end_of_results;
97  return cursor->status;
98  }
99  }
100  else {
101  /* The status is cs_cursor_initialized */
102  cursor->status = cs_cursor_active;
103  }
104 
105  /*Copy both key and value into user provided struct */
106  memcpy(record->key, sl_cursor->current->key, cursor->dictionary->instance->record.key_size);
107  memcpy(record->value, sl_cursor->current->value, cursor->dictionary->instance->record.value_size);
108 
109  sl_cursor->current = sl_cursor->current->next[0];
110  return cursor->status;
111  }
112 
113  return cs_invalid_cursor;
114 }
ion_value_t value
ion_record_info_t record
ion_dictionary_parent_t * instance
struct sl_node ** next
ion_value_t value
Definition: kv_system.h:318
ion_dictionary_t * dictionary
ion_cursor_status_t status
ion_boolean_t test_predicate(ion_dict_cursor_t *cursor, ion_key_t key)
Tests the supplied key against the predicate registered in the cursor. If the supplied cursor if of t...
Definition: dictionary.c:571
ion_key_t key
Definition: kv_system.h:316
ion_key_t key
ion_key_size_t key_size
Definition: kv_system.h:307
ion_sl_node_t * current
ion_value_size_t value_size
Definition: kv_system.h:309

Here is the call graph for this function:

Here is the caller graph for this function:

ion_err_t sldict_open_dictionary ( ion_dictionary_handler_t handler,
ion_dictionary_t dictionary,
ion_dictionary_config_info_t config,
ion_dictionary_compare_t  compare 
)

Opens a specific skiplist instance of a dictionary.

Parameters
handlerA pointer to the handler for the specific dictionary being opened.
dictionaryThe pointer declared by the caller that will reference the instance of the dictionary opened.
configThe configuration info of the specific dictionary to be opened.
compareFunction pointer for the comparison function for the dictionary.
Returns
The status of opening the dictionary.

Definition at line 337 of file skip_list_handler.c.

342  {
343  UNUSED(handler);
344  UNUSED(dictionary);
345  UNUSED(config);
346  UNUSED(compare);
347  return err_not_implemented;
348 }
#define UNUSED(x)
Definition: kv_system.h:102

Here is the caller graph for this function:

ion_status_t sldict_update ( ion_dictionary_t dictionary,
ion_key_t  key,
ion_value_t  value 
)

Updates the value stored at a given key.

Updates the value for a given key. If the key doesn't exist, the key value pair will be added as if it was an insert.

Parameters
dictionaryThe instance of the dictionary to be updated.
keyThe key that is to be updated.
valueThe new value to be used.
Returns
Status of update.

Definition at line 439 of file skip_list_handler.c.

443  {
444  return sl_update((ion_skiplist_t *) dictionary->instance, key, value);
445 }
Struct of the Skiplist, holds metadata and the entry point into the skiplist.
ion_dictionary_parent_t * instance
#define key(k)
Definition: bpp_tree.c:75
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

Here is the call graph for this function:

Here is the caller graph for this function: