dictionary.c
Go to the documentation of this file.
137 err = handler->create_dictionary(id, key_type, key_size, value_size, dictionary_size, compare, handler, dictionary);
262 /* Do bit comparison on the sign bit to do positive/negative comparison. Lets us exit early in many cases */
326 err = dictionary_create(handler, dictionary, config->id, config->type, config->key_size, config->value_size, config->dictionary_size);
334 while (cs_cursor_active == (cursor_status = cursor->next(cursor, &record)) || cs_cursor_initialized == cursor_status) {
406 err = dictionary_create(&fallback_handler, &fallback_dict, dictionary->instance->id, key_type, key_size, value_size, 1);
414 while (cs_cursor_active == (cursor_status = cursor->next(cursor, &record)) || cs_cursor_initialized == cursor_status) {
581 if (parent->compare(key, cursor->predicate->statement.equality.equality_value, cursor->dictionary->instance->record.key_size) == 0) {
ion_status_t(* insert)(ion_dictionary_t *, ion_key_t, ion_value_t)
Definition: dictionary_types.h:208
void dictionary_destroy_predicate_all_records(ion_predicate_t **predicate)
Destroys an all records predicate.
Definition: dictionary.c:502
Definition: kv_system.h:276
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: dictionary_types.h:139
ion_cursor_status_t(* next)(ion_dict_cursor_t *, ion_record_t *record)
Definition: dictionary_types.h:405
void dictionary_destroy_predicate_range(ion_predicate_t **predicate)
Destroys a range predicate.
Definition: dictionary.c:482
Definition: kv_system.h:130
char dictionary_compare_signed_value(ion_key_t first_key, ion_key_t second_key, ion_key_size_t key_size)
Compares two signed integer numeric keys.
Definition: dictionary.c:239
ion_err_t ffdict_destroy_dictionary(ion_dictionary_id_t id)
Cleans up all files created by the dictionary, and frees any allocated memory, for an already closed ...
Definition: flat_file_dictionary_handler.c:446
char dictionary_compare_char_array(ion_key_t first_key, ion_key_t second_key, ion_key_size_t key_size)
Compare any two character (byte) arrays. These are not assumed to be null-terminated.
Definition: dictionary.c:61
ion_value_size_t value_size
Definition: dictionary_types.h:191
Function declarations at the dictionary interface level for the flat file store.
ion_status_t(* remove)(ion_dictionary_t *, ion_key_t)
Definition: dictionary_types.h:243
ion_err_t(* destroy_dictionary)(ion_dictionary_id_t id)
Definition: dictionary_types.h:252
unsigned int ion_dictionary_id_t
A type used to identify dictionaries, specifically in the master table.
Definition: dictionary_types.h:51
unsigned int ion_dictionary_size_t
The implementation specific size of the dictionary.
Definition: kv_system.h:264
Struct containing details for opening a dictionary previously created.
Definition: dictionary_types.h:183
char dictionary_compare_null_terminated_string(ion_key_t first_key, ion_key_t second_key, ion_key_size_t key_size)
Compare any two null-terminated strings.
Definition: dictionary.c:80
ion_status_t dictionary_update(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Update all records with a given key.
Definition: dictionary.c:169
Definition: kv_system.h:127
void dictionary_destroy_predicate_equality(ion_predicate_t **predicate)
Destroys an equality predicate.
Definition: dictionary.c:463
char dictionary_compare_unsigned_value(ion_key_t first_key, ion_key_t second_key, ion_key_size_t key_size)
Compares two unsigned integer numeric keys.
Definition: dictionary.c:207
ion_status_t dictionary_delete(ion_dictionary_t *dictionary, ion_key_t key)
Delete a value given a key.
Definition: dictionary.c:199
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_status_t dictionary_insert(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Insert a value into a dictionary.
Definition: dictionary.c:151
Definition: dictionary_types.h:165
char(* ion_dictionary_compare_t)(ion_key_t, ion_key_t, ion_key_size_t)
Function pointer type for dictionary comparison methods.
Definition: dictionary_types.h:83
int dictionary_get_filename(ion_dictionary_id_t id, char *ext, char *filename)
Given the ID, implementation specific extension, and a buffer to write to, writes back the formatted ...
Definition: dictionary.c:41
ion_err_t dictionary_create(ion_dictionary_handler_t *handler, ion_dictionary_t *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)
Creates as instance of a specific type of dictionary.
Definition: dictionary.c:125
ion_status_t(* update)(ion_dictionary_t *, ion_key_t, ion_value_t)
Definition: dictionary_types.h:231
Definition: kv_system.h:278
A dictionary contains information regarding an instance of the storage element and the associated han...
Definition: dictionary_types.h:273
ion_status_t dictionary_get(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Retrieve a value given a key.
Definition: dictionary.c:160
Definition: dictionary_types.h:305
ion_err_t(* close_dictionary)(ion_dictionary_t *)
Definition: dictionary_types.h:263
#define ION_MAX_FILENAME_LENGTH
Since the arduino conforms to 8.3 syntax, that's 8 + 3 = 11 + 1 (null terminator) characters...
Definition: kv_system.h:73
ion_err_t(* open_dictionary)(ion_dictionary_handler_t *, ion_dictionary_t *, ion_dictionary_config_info_t *, ion_dictionary_compare_t)
Definition: dictionary_types.h:256
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 *)
Definition: dictionary_types.h:214
Definition: dictionary_types.h:306
Definition: dictionary_types.h:307
void ffdict_init(ion_dictionary_handler_t *handler)
Given the handler instance, bind the appropriate flat file functions.
Definition: flat_file_dictionary_handler.c:364
ion_err_t dictionary_destroy_dictionary(ion_dictionary_handler_t *handler, ion_dictionary_id_t id)
Destroys dictionary.
Definition: dictionary.c:185
Definition: kv_system.h:173
Definition: kv_system.h:203
ion_err_t(* delete_dictionary)(ion_dictionary_t *)
Definition: dictionary_types.h:248
Definition: kv_system.h:125
ion_err_t dictionary_delete_dictionary(ion_dictionary_t *dictionary)
Destroys dictionary.
Definition: dictionary.c:178
ion_err_t(* find)(ion_dictionary_t *, ion_predicate_t *, ion_dict_cursor_t **)
Definition: dictionary_types.h:237
ion_err_t dictionary_close(ion_dictionary_t *dictionary)
Closes a dictionary.
Definition: dictionary.c:372
Definition: dictionary_types.h:130
ion_err_t dictionary_open(ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary, ion_dictionary_config_info_t *config)
Opens a dictionary, given the desired config.
Definition: dictionary.c:287
Definition: kv_system.h:212
ion_dictionary_size_t dictionary_size
Definition: dictionary_types.h:192
ion_err_t dictionary_find(ion_dictionary_t *dictionary, ion_predicate_t *predicate, ion_dict_cursor_t **cursor)
Uses the given predicate and cursor to search the dictionary.
Definition: dictionary.c:562
Definition: dictionary_types.h:143
ion_dictionary_compare_t dictionary_switch_compare(ion_key_type_t key_type)
Definition: dictionary.c:89
Definition: dictionary_types.h:308
ion_err_t dictionary_build_predicate(ion_predicate_t *predicate, ion_predicate_type_t type,...)
Builds a predicate based on the type given.
Definition: dictionary.c:512
ion_status_t(* get)(ion_dictionary_t *, ion_key_t, ion_value_t)
Definition: dictionary_types.h:225
A dictionary_handler is responsible for dealing with the specific interface for an underlying diction...
Definition: dictionary_types.h:207
Definition: dictionary_types.h:133
Definition: kv_system.h:123
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290