linear_hash.h
Go to the documentation of this file.
ion_status_t linear_hash_delete(ion_byte_t *key, linear_hash_table_t *linear_hash)
Delete all records with keys matching the key specified in the linear hash.
Definition: linear_hash.c:867
ion_err_t linear_hash_decrement_num_records(linear_hash_table_t *linear_hash)
Helper method to decrement the number of records in the linear hash.
Definition: linear_hash.c:313
ion_err_t linear_hash_init(ion_dictionary_id_t id, ion_dictionary_size_t dictionary_size, ion_key_type_t key_type, ion_key_size_t key_size, ion_value_size_t value_size, int initial_size, int split_threshold, int records_per_bucket, linear_hash_table_t *linear_hash)
Definition: linear_hash.c:47
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_err_t linear_hash_increment_num_buckets(linear_hash_table_t *linear_hash)
Helper method to increment the number of buckets in the linear hash.
Definition: linear_hash.c:328
ion_fpos_t get_bucket_records_location(ion_fpos_t bucket_loc)
ion_err_t create_overflow_bucket(int bucket_idx, ion_fpos_t *overflow_location, linear_hash_table_t *linear_hash)
Create an overflow bucket and write it to the linear hash's .lhd file.
Definition: linear_hash.c:1240
void print_linear_hash_distribution(linear_hash_table_t *linear_hash)
ion_err_t linear_hash_increment_next_split(linear_hash_table_t *linear_hash)
Helper method to increment the split linear hash.
Definition: linear_hash.c:349
ion_err_t split(linear_hash_table_t *linear_hash)
Performs the split operation on a linear hash instance.
Definition: linear_hash.c:364
void print_linear_hash_bucket(linear_hash_bucket_t bucket)
ion_err_t array_list_insert(int bucket_idx, ion_fpos_t bucket_loc, array_list_t *array_list)
Insert a value into an array list.
Definition: linear_hash.c:1404
int linear_hash_bucket_is_full(linear_hash_bucket_t bucket, linear_hash_table_t *linear_hash)
Helper method to check if a linear hash bucket is full.
Definition: linear_hash.c:270
ion_err_t linear_hash_update_state(linear_hash_table_t *linear_hash)
ion_err_t write_new_bucket(int idx, linear_hash_table_t *linear_hash)
Write a new bucket to the linear hash's .lhd file.
Definition: linear_hash.c:1099
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
ion_err_t linear_hash_write_record(ion_fpos_t record_loc, ion_byte_t *key, ion_byte_t *value, ion_byte_t *status, linear_hash_table_t *linear_hash)
Write record data to the location specified from the linear hash's .lhd file.
Definition: linear_hash.c:1059
ion_err_t linear_hash_destroy(linear_hash_table_t *linear_hash)
Close a linear hash instance and delete its associated .lhs and .lhd files.
Definition: linear_hash.c:1507
int insert_hash_to_bucket(ion_byte_t *key, linear_hash_table_t *linear_hash)
Map a key to the address space of the linear hash. Used to map records to buckets with an index less ...
Definition: linear_hash.c:1358
ion_status_t linear_hash_update(ion_key_t key, ion_value_t value, linear_hash_table_t *linear_hash)
Update the value of the first record matching the key specified in the linear hash.
Definition: linear_hash.c:774
int hash_to_bucket(ion_byte_t *key, linear_hash_table_t *linear_hash)
Map a key to the address space of the linear hash. Used to map records to buckets with an index great...
Definition: linear_hash.c:1339
ion_err_t linear_hash_update_bucket(ion_fpos_t bucket_loc, linear_hash_bucket_t *bucket, linear_hash_table_t *linear_hash)
Write the bucket provided at the location specified from in linear hash's .lhd file.
Definition: linear_hash.c:1205
void print_linear_hash_bucket_map(linear_hash_table_t *linear_hash)
Header for linear hash types.
ion_status_t linear_hash_get(ion_byte_t *key, ion_byte_t *value, linear_hash_table_t *linear_hash)
Retrieve a record from the linear hash. The key and value will be written to the key and value pointe...
Definition: linear_hash.c:673
ion_err_t linear_hash_get_record(ion_fpos_t loc, ion_byte_t *key, ion_byte_t *value, ion_byte_t *status, linear_hash_table_t *linear_hash)
Read the record data at the location specified from the linear hash's .lhd file.
Definition: linear_hash.c:1017
Definition: linear_hash_types.h:49
ion_err_t linear_hash_write_state(linear_hash_table_t *linear_hash)
Writes the current state of the linear hash to a .lhs file.
Definition: linear_hash.c:168
Definition: linear_hash_types.h:69
ion_fpos_t bucket_idx_to_ion_fpos_t(int idx, linear_hash_table_t *linear_hash)
Helper method to get the location of a bucket chain from the linear hash's bucket map...
Definition: linear_hash.c:1298
ion_err_t array_list_init(int init_size, array_list_t *array_list)
Initialize an array list.
Definition: linear_hash.c:1377
ion_err_t invalidate_buffer_records(ion_byte_t *key, int record_count, ion_byte_t *records, linear_hash_table_t *linear_hash)
ion_fpos_t array_list_get(int bucket_idx, array_list_t *array_list)
Retreive a value from an array list.
Definition: linear_hash.c:1444
ion_err_t linear_hash_get_bucket(ion_fpos_t bucket_loc, linear_hash_bucket_t *bucket, linear_hash_table_t *linear_hash)
Read the bucket at the location specified from the linear hash's .lhd file.
Definition: linear_hash.c:1163
linear_hash_bucket_t linear_hash_get_overflow_bucket(ion_fpos_t loc)
ion_err_t linear_hash_close(linear_hash_table_t *linear_hash)
Close a linear hash instance with proper resource clean-up.
Definition: linear_hash.c:1466
ion_err_t linear_hash_read_state(linear_hash_table_t *linear_hash)
Read the state of a linear hash from a .lhs file.
Definition: linear_hash.c:219
Definition: linear_hash_types.h:61
ion_err_t linear_hash_increment_num_records(linear_hash_table_t *linear_hash)
Helper method to increment the number of records in the linear hash.
Definition: linear_hash.c:285
ion_boolean_t linear_hash_above_threshold(linear_hash_table_t *linear_hash)
Helper method to increment check if a linear hash's load is above its split threshold.
Definition: linear_hash.c:477
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290
ion_err_t store_bucket_loc_in_map(int idx, ion_fpos_t bucket_loc, linear_hash_table_t *linear_hash)
ion_status_t linear_hash_insert(ion_key_t key, ion_value_t value, int hash_bucket_idx, linear_hash_table_t *linear_hash)
Insert a record into the linear hash.
Definition: linear_hash.c:573