XMMS2
|
Data Structures | |
struct | s4_St |
struct | s4_intpair_t |
Typedefs | |
typedef uint32_t | log_number_t |
typedef struct s4_index_data_St | s4_index_data_t |
typedef struct s4_const_data_St | s4_const_data_t |
typedef struct s4_entry_data_St | s4_entry_data_t |
typedef struct s4_log_data_St | s4_log_data_t |
typedef struct str_St | str_t |
typedef struct s4_index_St | s4_index_t |
typedef int(* | index_function_t )(const s4_val_t *val, void *data) |
typedef struct s4_lock_St | s4_lock_t |
typedef struct oplist_St | oplist_t |
Functions | |
void | s4_set_errno (s4_errno_t err) |
Sets errno to the given error number. More... | |
void | _start_sync (s4_t *s4) |
void | _sync (s4_t *s4) |
int | _reread_file (s4_t *s4) |
int | _s4_add_internal (s4_t *s4, const char *key_a, const s4_val_t *value_a, const char *key_b, const s4_val_t *value_b, const char *src) |
s4_entry_data_t * | _entry_create_data (void) |
void | _entry_free_data (s4_entry_data_t *data) |
s4_val_t * | s4_val_new_internal_string (const char *str, s4_t *s4) |
Creates a new internal string value. More... | |
const char * | _string_lookup (s4_t *s4, const char *str) |
Gets a pointer to a constant string that's equal to str. More... | |
const char * | _string_lookup_casefolded (s4_t *s4, const char *str) |
Gets the casefolded string corresponding to str. More... | |
const char * | _string_lookup_collated (s4_t *s4, const char *str) |
Gets the collated string corresponding to str. More... | |
const s4_val_t * | _string_lookup_val (s4_t *s4, const char *str) |
Gets a pointer to a constant string value with a string equal to str. More... | |
const s4_val_t * | _int_lookup_val (s4_t *s4, int32_t i) |
const s4_val_t * | _const_lookup (s4_t *s4, const s4_val_t *val) |
s4_const_data_t * | _const_create_data (void) |
void | _const_free_data (s4_const_data_t *data) |
s4_index_data_t * | _index_create_data (void) |
void | _index_free_data (s4_index_data_t *data) |
s4_index_t * | _index_get_a (s4_t *s4, const char *key, int create) |
Gets the a-index associated with key. More... | |
s4_index_t * | _index_get_b (s4_t *s4, const char *key) |
Gets the b-index associated with key. More... | |
GList * | _index_get_all_a (s4_t *s4) |
Gets all a-indexes. More... | |
GList * | _index_get_all_b (s4_t *s4) |
Gets all b-indexes. More... | |
s4_index_t * | _index_create (void) |
Creates a new index. More... | |
int | _index_add (s4_t *s4, const char *key, s4_index_t *index) |
Adds an index to a database. More... | |
int | _index_insert (s4_index_t *index, const s4_val_t *val, void *data) |
Inserts a new value-data pair into the index. More... | |
int | _index_delete (s4_index_t *index, const s4_val_t *val, void *data) |
Removes a value-data pair from the index. More... | |
GList * | _index_search (s4_index_t *index, index_function_t func, void *data) |
Searches an index. More... | |
GList * | _index_lsearch (s4_index_t *index, index_function_t func, void *data) |
Searches an index using a linear search. More... | |
void | _index_free (s4_index_t *index) |
Frees an index. More... | |
int | _index_lock_shared (s4_index_t *index, s4_transaction_t *trans) |
int | _index_lock_exclusive (s4_index_t *index, s4_transaction_t *trans) |
int32_t | s4_cond_get_ikey (s4_condition_t *cond) |
void | s4_cond_set_ikey (s4_condition_t *cond, int32_t ikey) |
s4_result_t * | s4_result_create (s4_result_t *next, const char *key, const s4_val_t *val, const char *src) |
Creates a new result. More... | |
void | s4_result_free (s4_result_t *res) |
Frees a result. More... | |
s4_resultrow_t * | s4_resultrow_create (int colcount) |
Creates a new row. More... | |
s4_resultrow_t * | s4_resultrow_ref (s4_resultrow_t *row) |
References a resultrow. More... | |
void | s4_resultrow_unref (s4_resultrow_t *row) |
Unreferences a resultrow. More... | |
int | _s4_add (s4_transaction_t *trans, const char *key_a, const s4_val_t *val_a, const char *key_b, const s4_val_t *val_b, const char *src) |
Adds a new relation to a database. More... | |
int | _s4_del (s4_transaction_t *trans, const char *key_a, const s4_val_t *val_a, const char *key_b, const s4_val_t *val_b, const char *src) |
Deletes a relation from a database. More... | |
s4_resultset_t * | _s4_query (s4_transaction_t *trans, s4_fetchspec_t *fs, s4_condition_t *cond) |
Queries a database for all entries matching a condition, then fetches data from them. More... | |
void | _free_relations (s4_t *s4) |
Frees all relations in a database. More... | |
s4_lock_t * | _lock_alloc (void) |
void | _lock_free (s4_lock_t *lock) |
int | _lock_exclusive (s4_lock_t *lock, s4_transaction_t *trans) |
int | _lock_shared (s4_lock_t *lock, s4_transaction_t *trans) |
void | _lock_unlock_all (s4_transaction_t *trans) |
s4_t * | _transaction_get_db (s4_transaction_t *trans) |
void | _transaction_writing (s4_transaction_t *trans) |
s4_lock_t * | _transaction_get_waiting_for (s4_transaction_t *trans) |
void | _transaction_set_waiting_for (s4_transaction_t *trans, s4_lock_t *waiting_for) |
GList * | _transaction_get_locks (s4_transaction_t *trans) |
void | _transaction_add_lock (s4_transaction_t *trans, s4_lock_t *lock) |
void | _transaction_set_deadlocked (s4_transaction_t *trans) |
s4_transaction_t * | _transaction_dummy_alloc (s4_t *s4) |
void | _transaction_dummy_free (s4_transaction_t *trans) |
int | _transaction_get_flags (s4_transaction_t *trans) |
oplist_t * | _oplist_new (s4_transaction_t *trans) |
void | _oplist_free (oplist_t *list) |
s4_t * | _oplist_get_db (oplist_t *list) |
s4_transaction_t * | _oplist_get_trans (oplist_t *list) |
void | _oplist_insert_add (oplist_t *list, const char *key_a, const s4_val_t *val_a, const char *key_b, const s4_val_t *val_b, const char *src) |
void | _oplist_insert_del (oplist_t *list, const char *key_a, const s4_val_t *val_a, const char *key_b, const s4_val_t *val_b, const char *src) |
void | _oplist_insert_writing (oplist_t *list) |
int | _oplist_get_add (oplist_t *list, const char **key_a, const s4_val_t **val_a, const char **key_b, const s4_val_t **val_b, const char **src) |
int | _oplist_get_del (oplist_t *list, const char **key_a, const s4_val_t **val_a, const char **key_b, const s4_val_t **val_b, const char **src) |
int | _oplist_get_writing (oplist_t *list) |
int | _oplist_next (oplist_t *list) |
void | _oplist_first (oplist_t *list) |
void | _oplist_last (oplist_t *list) |
int | _oplist_rollback (oplist_t *list) |
int | _oplist_execute (oplist_t *list, int rollback_on_failure) |
s4_log_data_t * | _log_create_data (void) |
void | _log_free_data (s4_log_data_t *data) |
void | _log_lock_file (s4_t *s4) |
Locks the log file. More... | |
void | _log_unlock_file (s4_t *s4) |
Unlocks the log file. More... | |
void | _log_lock_db (s4_t *s4) |
Locks the database file. More... | |
void | _log_unlock_db (s4_t *s4) |
Unlocks the database file. More... | |
int | _log_write (oplist_t *list) |
Writes all the operations in an oplist to disk. More... | |
void | _log_checkpoint (s4_t *s4) |
Writes a checkpoint entry to the log, marking that the database has finished being written to disk. More... | |
int | _log_open (s4_t *s4) |
Opens a log file. More... | |
int | _log_close (s4_t *s4) |
Closes the log file. More... | |
log_number_t | _log_last_synced (s4_t *s4) |
void | _log_init (s4_t *s4, log_number_t last_checkpoint) |
typedef uint32_t log_number_t |
typedef struct oplist_St oplist_t |
typedef struct s4_const_data_St s4_const_data_t |
typedef struct s4_entry_data_St s4_entry_data_t |
typedef struct s4_index_data_St s4_index_data_t |
typedef struct s4_index_St s4_index_t |
typedef struct s4_lock_St s4_lock_t |
typedef struct s4_log_data_St s4_log_data_t |
typedef struct str_St str_t |
s4_const_data_t* _const_create_data | ( | void | ) |
void _const_free_data | ( | s4_const_data_t * | data | ) |
int _index_add | ( | s4_t * | s4, |
const char * | key, | ||
s4_index_t * | index | ||
) |
Adds an index to a database.
s4 | The database to add the index to |
key | The key to associate the index with |
index | The index to insert |
Referenced by s4_open().
s4_index_t* _index_create | ( | void | ) |
s4_index_data_t* _index_create_data | ( | void | ) |
Referenced by _reread_file().
int _index_delete | ( | s4_index_t * | index, |
const s4_val_t * | val, | ||
void * | data | ||
) |
Removes a value-data pair from the index.
index | The index to remove from |
val | The value to remove |
data | The data to remove |
Referenced by _s4_del().
void _index_free | ( | s4_index_t * | index | ) |
Frees an index.
The values and data is NOT freed
index | The index to free |
Referenced by _index_create_data().
void _index_free_data | ( | s4_index_data_t * | data | ) |
Referenced by _reread_file().
s4_index_t* _index_get_a | ( | s4_t * | s4, |
const char * | key, | ||
int | create | ||
) |
Gets the a-index associated with key.
A a-index is used to lookup entries by the a-value. If an index has not yet been created for this key and create is non-zero, one will be created and returned.
s4 | The database to look for the index in |
key | The key the index should be indexing |
create | Creates the index if it does not exist |
Referenced by _s4_add(), _s4_add_internal(), _s4_del(), and _s4_query().
GList* _index_get_all_a | ( | s4_t * | s4 | ) |
Gets all a-indexes.
s4 | The database to get the index of. |
Referenced by _free_relations(), and _s4_query().
GList* _index_get_all_b | ( | s4_t * | s4 | ) |
Gets all b-indexes.
s4 | The database to get the index of. |
s4_index_t* _index_get_b | ( | s4_t * | s4, |
const char * | key | ||
) |
Gets the b-index associated with key.
A b-index is used to lookup entries by the b-value.
s4 | The database to look for the index in |
key | The key the index should be indexing |
Referenced by _s4_add(), _s4_add_internal(), _s4_del(), and _s4_query().
int _index_insert | ( | s4_index_t * | index, |
const s4_val_t * | val, | ||
void * | new_data | ||
) |
Inserts a new value-data pair into the index.
index | The index to insert into |
val | The value to associate the data with |
new_data | The data |
Referenced by _s4_add(), and _s4_add_internal().
int _index_lock_exclusive | ( | s4_index_t * | index, |
s4_transaction_t * | trans | ||
) |
int _index_lock_shared | ( | s4_index_t * | index, |
s4_transaction_t * | trans | ||
) |
Referenced by _s4_add(), _s4_del(), and _s4_query().
GList* _index_lsearch | ( | s4_index_t * | index, |
index_function_t | func, | ||
void * | func_data | ||
) |
Searches an index using a linear search.
index | The index to search |
func | The function to use when searching. It should return 0 if the value matches, -1 if the value is too small and 1 if the value is too big, |
func_data | Data passed as the second argument to func |
Referenced by _s4_query().
GList* _index_search | ( | s4_index_t * | index, |
index_function_t | func, | ||
void * | func_data | ||
) |
Searches an index.
index | The index to search |
func | The function to use when searching. It must be monotonic, It should return 0 if the value matches, -1 if the value is too small and 1 if the value is too big, |
func_data | Data passed as the second argument to func |
Referenced by _free_relations(), _s4_add(), _s4_add_internal(), _s4_del(), and _s4_query().
Referenced by _const_lookup().
int _oplist_execute | ( | oplist_t * | list, |
int | rollback_on_failure | ||
) |
void _oplist_first | ( | oplist_t * | list | ) |
Referenced by _log_write(), and _oplist_execute().
void _oplist_free | ( | oplist_t * | list | ) |
int _oplist_get_add | ( | oplist_t * | list, |
const char ** | key_a, | ||
const s4_val_t ** | val_a, | ||
const char ** | key_b, | ||
const s4_val_t ** | val_b, | ||
const char ** | src | ||
) |
Referenced by _log_write(), _oplist_execute(), and _oplist_rollback().
Referenced by _log_write().
int _oplist_get_del | ( | oplist_t * | list, |
const char ** | key_a, | ||
const s4_val_t ** | val_a, | ||
const char ** | key_b, | ||
const s4_val_t ** | val_b, | ||
const char ** | src | ||
) |
Referenced by _log_write(), _oplist_execute(), and _oplist_rollback().
s4_transaction_t* _oplist_get_trans | ( | oplist_t * | list | ) |
int _oplist_get_writing | ( | oplist_t * | list | ) |
Referenced by _log_write().
void _oplist_insert_add | ( | oplist_t * | list, |
const char * | key_a, | ||
const s4_val_t * | val_a, | ||
const char * | key_b, | ||
const s4_val_t * | val_b, | ||
const char * | src | ||
) |
Referenced by s4_add().
void _oplist_insert_del | ( | oplist_t * | list, |
const char * | key_a, | ||
const s4_val_t * | val_a, | ||
const char * | key_b, | ||
const s4_val_t * | val_b, | ||
const char * | src | ||
) |
Referenced by s4_del().
void _oplist_insert_writing | ( | oplist_t * | list | ) |
Referenced by _transaction_writing().
void _oplist_last | ( | oplist_t * | list | ) |
Referenced by s4_abort(), and s4_commit().
oplist_t* _oplist_new | ( | s4_transaction_t * | trans | ) |
Referenced by s4_begin().
int _oplist_next | ( | oplist_t * | list | ) |
Referenced by _log_write(), and _oplist_execute().
int _oplist_rollback | ( | oplist_t * | list | ) |
Referenced by _oplist_execute(), s4_abort(), and s4_commit().
const char* _string_lookup | ( | s4_t * | s4, |
const char * | str | ||
) |
Gets a pointer to a constant string that's equal to str.
_string_lookup will always return the same pointer for the same string
s4 | The database to look for the string in |
str | The string to find the constant string of |
Referenced by _string_lookup_casefolded(), _string_lookup_collated(), s4_add(), s4_cond_update_key(), s4_del(), and s4_fetchspec_update_key().
const char* _string_lookup_casefolded | ( | s4_t * | s4, |
const char * | str | ||
) |
Gets the casefolded string corresponding to str.
str must have been obtained by calling _string_lookup.
s4 | The database to look in |
str | The string to find the casefold string of |
Referenced by s4_val_get_casefolded_str().
const char* _string_lookup_collated | ( | s4_t * | s4, |
const char * | str | ||
) |
Gets the collated string corresponding to str.
str must have been obtained by calling _string_lookup.
s4 | The database to look in |
str | The string to find the collated string of |
Referenced by s4_val_get_collated_str().
Gets a pointer to a constant string value with a string equal to str.
_string_lookup_val will always return the same value for the same string.
s4 | The database to look for the string in |
str | The string to find the constant string of |
Referenced by _const_lookup(), and _string_lookup().
int32_t s4_cond_get_ikey | ( | s4_condition_t * | cond | ) |
void s4_cond_set_ikey | ( | s4_condition_t * | cond, |
int32_t | ikey | ||
) |