XMMS2
Functions
Transactions

Functions dealing with transactions. More...

Functions

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)
 
s4_transaction_ts4_begin (s4_t *s4, int flags)
 Starts a new transaction. More...
 
int s4_commit (s4_transaction_t *trans)
 Commits a transaction. More...
 
int s4_abort (s4_transaction_t *trans)
 Aborts a transaction. More...
 
s4_t_transaction_get_db (s4_transaction_t *trans)
 
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 relationship to the 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 relationship from the database. More...
 
s4_resultset_ts4_query (s4_transaction_t *trans, s4_fetchspec_t *spec, s4_condition_t *cond)
 Queries an S4 database. More...
 

Detailed Description

Functions dealing with transactions.

Function Documentation

void _transaction_add_lock ( s4_transaction_t trans,
s4_lock_t lock 
)

Referenced by _lock_exclusive(), and _lock_shared().

s4_transaction_t* _transaction_dummy_alloc ( s4_t s4)
void _transaction_dummy_free ( s4_transaction_t trans)
s4_t* _transaction_get_db ( s4_transaction_t trans)
int _transaction_get_flags ( s4_transaction_t trans)

Referenced by _lock_shared().

GList* _transaction_get_locks ( s4_transaction_t trans)

Referenced by _lock_unlock_all().

s4_lock_t* _transaction_get_waiting_for ( s4_transaction_t trans)
void _transaction_set_deadlocked ( s4_transaction_t trans)

Referenced by _s4_add(), _s4_del(), and _s4_query().

void _transaction_set_waiting_for ( s4_transaction_t trans,
s4_lock_t waiting_for 
)

Referenced by _lock_exclusive(), and _lock_shared().

void _transaction_writing ( s4_transaction_t trans)
int s4_abort ( s4_transaction_t trans)

Aborts a transaction.

The database will behave like the transaction never happened.

Parameters
transThe transaction
Returns
0 on error, non-zero on success.

Referenced by CASE(), and xmms_medialib_session_abort().

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 relationship to the database.

It takes both a database handle and a transaction handle, but only one if used. If the transaction handle is NULL it will create a local transaction, otherwise it will use the transaction passed, and thus s4 is not needed.

Parameters
s4The database to add to.
transThe transaction to use.
key_aKey A.
val_aValue A.
key_bKey B.
val_bValue B.
srcSource.
Returns
0 on error, non-zero on success.

Referenced by CASE(), main(), and xmms_medialib_session_property_set().

s4_transaction_t* s4_begin ( s4_t s4,
int  flags 
)

Starts a new transaction.

Parameters
s4The database to run the transaction on.
flagsFlags specifying what kind of transaction this should be.
Returns
A new transaction that can be used when calling s4_add, s4_del and s4_query.

Referenced by CASE(), and main().

int s4_commit ( s4_transaction_t trans)

Commits a transaction.

On success the operations in the transactions will be applied in one atomic step, on error none of the operations in the transaction will be applied.

Parameters
transThe transaction to commit.
Returns
0 on error (and sets s4_errno), non-zero on success.

Referenced by CASE(), main(), and xmms_medialib_session_commit().

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 relationship from the database.

It takes both a database handle and a transaction handle, but only one if used. If the transaction handle is NULL it will create a local transaction, otherwise it will use the transaction passed, and thus s4 is not needed.

Parameters
s4The database to delete from.
transThe transaction to use.
key_aKey A.
val_aValue A.
key_bKey B.
val_bValue B.
srcSource.
Returns
0 on error, non-zero on success.

Referenced by CASE(), main(), xmms_medialib_session_property_set(), and xmms_medialib_session_property_unset().

s4_resultset_t* s4_query ( s4_transaction_t trans,
s4_fetchspec_t spec,
s4_condition_t cond 
)

Queries an S4 database.

Parameters
s4The database to query. If s4 is NULL trans must be non-null.
transThe transaction to use. If trans is NULL s4 must be non-null.
specThe fetchspecification to use when querying.
condThe condition to use when querying.
Returns
A resultset containing the fetched data.

Referenced by CASE(), xmms_medialib_session_property_set(), and xmms_medialib_session_query().