flat_file.h
Go to the documentation of this file.
1 /******************************************************************************/
35 /******************************************************************************/
36 
37 #if !defined(FLAT_FILE_H)
38 #define FLAT_FILE_H
39 
40 #if defined(__cplusplus)
41 extern "C" {
42 #endif
43 
44 #include "flat_file_types.h"
45 
73  ion_flat_file_t *flat_file,
75  ion_key_type_t key_type,
76  ion_key_size_t key_size,
77  ion_value_size_t value_size,
78  ion_dictionary_size_t dictionary_size
79 );
80 
90  ion_flat_file_t *flat_file
91 );
92 
106  ion_flat_file_t *flat_file,
107  ion_key_t key,
108  ion_value_t value
109 );
110 
124  ion_flat_file_t *flat_file,
125  ion_key_t key,
126  ion_value_t value
127 );
128 
140  ion_flat_file_t *flat_file,
141  ion_key_t key
142 );
143 
157  ion_flat_file_t *flat_file,
158  ion_key_t key,
159  ion_value_t value
160 );
161 
168 ion_err_t
170  ion_flat_file_t *flat_file
171 );
172 
202 ion_err_t
204  ion_flat_file_t *flat_file,
205  ion_fpos_t start_location,
206  ion_fpos_t *location,
207  ion_flat_file_row_t *row,
208  ion_byte_t scan_direction,
210  ...
211 );
212 
220  ion_flat_file_t *flat_file,
221  ion_flat_file_row_t *row,
222  va_list *args
223 );
224 
235  ion_flat_file_t *flat_file,
236  ion_flat_file_row_t *row,
237  va_list *args
238 );
239 
246  ion_flat_file_t *flat_file,
247  ion_flat_file_row_t *row,
248  va_list *args
249 );
250 
272 ion_err_t
274  ion_flat_file_t *flat_file,
275  ion_fpos_t location,
277 );
278 
296 ion_err_t
298  ion_flat_file_t *flat_file,
299  ion_key_t target_key,
300  ion_fpos_t *location
301 );
302 
303 #if defined(__cplusplus)
304 }
305 #endif
306 
307 #endif
unsigned char ion_byte_t
A byte type.
Definition: kv_system.h:232
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.
Container for the rows written in the flat file data file.
Metadata container that holds flat file specific information.
ion_err_t flat_file_binary_search(ion_flat_file_t *flat_file, ion_key_t target_key, ion_fpos_t *location)
Performs a binary search for the given target_key, returning to location the first-less-than-or-equal...
Definition: flat_file.c:638
int ion_value_size_t
The size (length) of a dictionary value in bytes.
Definition: kv_system.h:256
ion_status_t flat_file_delete(ion_flat_file_t *flat_file, ion_key_t key)
Deletes all records stored with the given key.
Definition: flat_file.c:495
ion_boolean_t flat_file_predicate_within_bounds(ion_flat_file_t *flat_file, ion_flat_file_row_t *row, va_list *args)
Predicate function to return any row that has a key such that lower_bound <= key <= upper_bound holds...
Definition: flat_file.c:291
ion_err_t flat_file_read_row(ion_flat_file_t *flat_file, ion_fpos_t location, ion_flat_file_row_t *row)
Reads the row specified by the given location into the buffer.
Definition: flat_file.c:350
ion_status_t flat_file_get(ion_flat_file_t *flat_file, ion_key_t key, ion_value_t value)
Fetches the record stored with the given key.
Definition: flat_file.c:439
ion_err_t flat_file_destroy(ion_flat_file_t *flat_file)
Destroys and cleans up any implementation specific memory or files.
Definition: flat_file.c:134
unsigned int ion_dictionary_id_t
A type used to identify dictionaries, specifically in the master table.
unsigned int ion_dictionary_size_t
The implementation specific size of the dictionary.
Definition: kv_system.h:264
#define key(k)
Definition: bpp_tree.c:75
ion_err_t flat_file_initialize(ion_flat_file_t *flat_file, 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)
Initializes the flat file implementation and creates all necessary files.
Definition: flat_file.c:40
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
void * ion_value_t
A dictionary value.
Definition: kv_system.h:246
ion_status_t flat_file_update(ion_flat_file_t *flat_file, ion_key_t key, ion_value_t value)
Updates all records stored with the given key to have value.
Definition: flat_file.c:560
Implementation specific type definitions for the flat file store.
A supertype for cursor predicate objects.
ion_status_t flat_file_insert(ion_flat_file_t *flat_file, ion_key_t key, ion_value_t value)
Inserts the given record into the flat file store.
Definition: flat_file.c:388
ion_err_t flat_file_scan(ion_flat_file_t *flat_file, ion_fpos_t start_location, ion_fpos_t *location, ion_flat_file_row_t *row, ion_byte_t scan_direction, ion_flat_file_predicate_t predicate,...)
Performs a linear scan of the flat file writing the first location seen that satisfies the given pred...
Definition: flat_file.c:157
ion_err_t flat_file_close(ion_flat_file_t *flat_file)
Closes and frees any memory associated with the flat file.
Definition: flat_file.c:624
long ion_fpos_t
A file position type.
Definition: kv_system.h:237
ion_boolean_t flat_file_predicate_key_match(ion_flat_file_t *flat_file, ion_flat_file_row_t *row, va_list *args)
Predicate function to return any row that has an exact match to the given target key.
Definition: flat_file.c:280
int ion_key_size_t
The size (length) of a dictionary key in bytes.
Definition: kv_system.h:251
char ion_boolean_t
A boolean type.
Definition: kv_system.h:269
ion_boolean_t flat_file_predicate_not_empty(ion_flat_file_t *flat_file, ion_flat_file_row_t *row, va_list *args)
Predicate function to return any row that is not empty or deleted.
Definition: flat_file.c:268
ion_boolean_t(* ion_flat_file_predicate_t)(ion_flat_file_t *, ion_flat_file_row_t *, va_list *args)
The function signature of a flat file predicate, used in searches.
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290