open_address_file_hash.c
Go to the documentation of this file.
103 int record_size = SIZEOF(STATUS) + hashmap->super.record.key_size + hashmap->super.record.value_size;
191 ion_hash_t hash = hash_map->compute_hash(hash_map, key, hash_map->super.record.key_size); /* compute hash value for given key */
200 int record_size = hash_map->super.record.key_size + hash_map->super.record.value_size + SIZEOF(STATUS);
216 if (hash_map->super.compare(item->data, key, hash_map->super.record.key_size) == ION_IS_EQUAL) {
225 fseek(hash_map->file, SIZEOF(STATUS) + hash_map->super.record.key_size - record_size, SEEK_CUR);
236 return ION_STATUS_ERROR(err_file_write_error); /* there is a configuration issue with write concern */
249 memcpy(item->data + hash_map->super.record.key_size, value, (hash_map->super.record.value_size));
294 int record_size = hash_map->super.record.key_size + hash_map->super.record.value_size + SIZEOF(STATUS);
355 int record_size = hash_map->super.record.key_size + hash_map->super.record.value_size + SIZEOF(STATUS);
393 int record_size = hash_map->super.record.key_size + hash_map->super.record.value_size + SIZEOF(STATUS);
396 fseek(hash_map->file, (loc * record_size) + SIZEOF(STATUS) + hash_map->super.record.key_size, SEEK_SET);
422 ion_hash_t hash = (ion_hash_t) (((*(int *) key) % hashmap->map_size) + hashmap->map_size) % hashmap->map_size;
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.
Struct used to maintain an instance of an in memory hashmap.
Definition: open_address_hash.h:70
ion_status_t oafh_delete(ion_file_hashmap_t *hash_map, ion_key_t key)
Deletes item from map.
Definition: open_address_file_hash.c:339
ion_status_t oafh_update(ion_file_hashmap_t *hash_map, ion_key_t key, ion_value_t value)
Updates a value in the map.
Definition: open_address_file_hash.c:170
unsigned int ion_dictionary_id_t
A type used to identify dictionaries, specifically in the master table.
Definition: dictionary_types.h:51
Definition: kv_system.h:188
Definition: dictionary_types.h:427
ion_err_t oafh_initialize(ion_file_hashmap_t *hashmap, ion_hash_t(*hashing_function)(ion_file_hashmap_t *, ion_key_t, int), ion_key_type_t key_type, ion_key_size_t key_size, ion_value_size_t value_size, int size, ion_dictionary_id_t id)
This function initializes an open address in memory hash map.
Definition: open_address_file_hash.c:63
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 oafh_find_item_loc(ion_file_hashmap_t *hash_map, ion_key_t key, int *location)
Locates item in map.
Definition: open_address_file_hash.c:279
int(* compute_hash)(ion_file_hashmap_t *, ion_key_t, int)
Definition: open_address_file_hash.h:75
Struct used to maintain individual records in the hashmap.
Definition: dictionary_types.h:445
Definition: kv_system.h:168
ion_hash_t oafh_compute_simple_hash(ion_file_hashmap_t *hashmap, ion_key_t key, int size_of_key)
A simple hashing algorithm implementation.
Definition: open_address_file_hash.c:414
#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
Definition: kv_system.h:179
ion_err_t oafh_close(ion_file_hashmap_t *hash_map)
This function closes a hashmap dictionary.
Definition: open_address_file_hash.c:48
Definition: kv_system.h:165
A hash table using linear probing. Designed for in memory use.
Definition: kv_system.h:162
Definition: kv_system.h:171
ion_status_t oafh_insert(ion_file_hashmap_t *hash_map, ion_key_t key, ion_value_t value)
Insert record into hashmap.
Definition: open_address_file_hash.c:186
int oafh_get_location(ion_hash_t num, int size)
Returns the theoretical location of item in hashmap.
Definition: open_address_file_hash.c:133
Definition: kv_system.h:212
char ion_write_concern_t
A type for write concern information used by hash table based dictionaries which limit insert/update ...
Definition: dictionary_types.h:440
Definition: dictionary_types.h:430
Struct used to maintain an instance of an in memory hashmap.
Definition: open_address_file_hash.h:69
ion_status_t oafh_get(ion_file_hashmap_t *hash_map, ion_key_t key, ion_value_t value)
Locates the record if it exists.
Definition: open_address_file_hash.c:381
ion_err_t oafh_destroy(ion_file_hashmap_t *hash_map)
Destroys the map in memory.
Definition: open_address_file_hash.c:141
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290