ion_master_table.h
Go to the documentation of this file.
1 /******************************************************************************/
45 /******************************************************************************/
46 
47 #if !defined(ION_MASTER_TABLE_H_)
48 #define ION_MASTER_TABLE_H_
49 
50 #if defined(__cplusplus)
51 extern "C" {
52 #endif
53 
54 #include "dictionary.h"
55 #include "../file/sd_stdio_c_iface.h"
56 #include "../file/kv_stdio_intercept.h"
63 
64 #define ION_MASTER_TABLE_CALCULATE_POS -1
65 #define ION_MASTER_TABLE_WRITE_FROM_END -2
66 #define ION_MASTER_TABLE_RECORD_SIZE(cp) (sizeof((cp)->id) + sizeof((cp)->use_type) + sizeof((cp)->type) + sizeof((cp)->key_size) + sizeof((cp)->value_size) + sizeof((cp)->dictionary_size) + sizeof((cp)->dictionary_type) + sizeof((cp)->dictionary_status))
67 
68 #if ION_USING_MASTER_TABLE
69 
74 #define ION_MASTER_TABLE_FILENAME "ion_mt.tbl"
75 
79 #define ION_MASTER_TABLE_ID 0
80 
85 #define ION_MASTER_TABLE_FIND_FIRST 1
86 
91 #define ION_MASTER_TABLE_FIND_LAST -1
92 
97 
101 extern FILE *ion_master_table_file;
102 
120 ion_err_t
123  long where
124 );
125 
130 ion_err_t
132  void
133 );
134 
138 ion_err_t
140  void
141 );
142 
148 ion_err_t
150  void
151 );
152 
156 ion_err_t
158  void
159 );
160 
182 ion_err_t
184  ion_dictionary_handler_t *handler,
186  ion_key_type_t key_type,
187  ion_key_size_t key_size,
188  ion_value_size_t value_size,
189  ion_dictionary_size_t dictionary_size
190 );
191 
201 ion_err_t
205 );
206 
224 ion_err_t
227  ion_dict_use_t use_type,
228  char whence
229 );
230 
238 ion_err_t
241 );
242 
254 ion_err_t
256  ion_dictionary_handler_t *handler,
259 );
260 
266 ion_err_t
269 );
270 
281 ion_err_t
285 );
286 
296 ion_err_t
299  ion_dictionary_handler_t *handler
300 );
301 
308 ion_err_t
311 );
312 
324 );
325 
326 #if defined(__cplusplus)
327 }
328 #endif /* C++ Guard */
329 
330 #endif /* ION_USING_MASTER_TABLE */
331 
332 #endif /* ION_MASTER_TABLE_H_ */
ion_err_t ion_lookup_in_master_table(ion_dictionary_id_t id, ion_dictionary_config_info_t *config)
Looks up the config of the given id.
FILE * ion_master_table_file
Master table file.
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_byte_t ion_dict_use_t
A type describing how a dictionary is used.
int ion_value_size_t
The size (length) of a dictionary value in bytes.
Definition: kv_system.h:256
Handler liaison between dictionary API and skiplist implementation.
The handler for a disk-backed B+ Tree.
Function declarations at the dictionary interface level for the flat file store.
enum ION_DICTIONARY_TYPE ion_dictionary_type_t
This is the available dictionary types for ION_DB. All types will be based on system defines...
The handler for a hash table using linear probing.
ion_err_t ion_switch_handler(ion_dictionary_type_t type, ion_dictionary_handler_t *handler)
Retrieves the type of dictionary stored under a particular id in the master table.
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
Struct containing details for opening a dictionary previously created.
ion_err_t ion_open_dictionary(ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary, ion_dictionary_id_t id)
Finds the target dictionary and opens it.
ion_err_t ion_find_by_use_master_table(ion_dictionary_config_info_t *config, ion_dict_use_t use_type, char whence)
Find first or last dictionary in master table with a given use.
ion_err_t ion_master_table_write(ion_dictionary_config_info_t *config, long where)
Write a record to the master table.
ion_err_t ion_delete_master_table(void)
Deletes the master table.
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
The handler for a hash table using linear probing.
ion_err_t ion_delete_dictionary(ion_dictionary_t *dictionary, ion_dictionary_id_t id)
Deletes a given dictionary instance and deletes it from the master table.
A dictionary contains information regarding an instance of the storage element and the associated han...
ion_err_t ion_init_master_table(void)
Opens the master table.
ion_err_t ion_master_table_get_next_id(ion_dictionary_id_t *id)
Returns the next dictionary ID, then increments.
ion_err_t ion_master_table_create_dictionary(ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary, 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 a dictionary through use of the master table.
ion_err_t ion_close_dictionary(ion_dictionary_t *dictionary)
Closes a given dictionary.
ion_err_t ion_delete_from_master_table(ion_dictionary_id_t id)
Deletes a dictionary from the master table.
ion_err_t ion_close_master_table(void)
Closes the master table.
Header for handler for a linear hash .
int ion_key_size_t
The size (length) of a dictionary key in bytes.
Definition: kv_system.h:251
ion_dictionary_id_t ion_master_table_next_id
Master table resposible for managing instances.
ion_err_t ion_close_all_master_table(void)
Closes the master table and all dictionary instances within it.
A dictionary_handler is responsible for dealing with the specific interface for an underlying diction...
ion_dictionary_type_t ion_get_dictionary_type(ion_dictionary_id_t id)
Retrieves the type of dictionary stored under a particular id in the master table.