XMMS2
Modules | Macros | Functions
S4

A database backend for XMMS2. More...

Modules

 Condition
 Functions to create and use S4 search conditions.
 
 Fetch Specifications
 Specifies what to fetch in a query.
 
 Lock
 Locks entries so only one transaction can use tham at a time.
 
 Log
 Logs every action so we can redo changes if something crashes.
 
 Pattern
 Functions to create and match glob-like patterns.
 
 Entry
 The in-memory database.
 
 Result
 Handles results returned from S4.
 
 Result Set
 A set of results.
 
 Source Preferences
 Handles source preferences.
 
 Transactions
 Functions dealing with transactions.
 
 UUID
 Functions dealing with UUID.
 
 Value
 The way values are represented in S4.
 

Macros

#define S4_MAGIC   ("s4db")
 
#define S4_MAGIC_LEN   (4)
 
#define S4_VERSION   1
 

Functions

s4_ts4_open (const char *filename, const char **indices, int open_flags)
 Opens an S4 database. More...
 
int s4_close (s4_t *s4)
 Closes an open S4 database. More...
 
void s4_sync (s4_t *s4)
 Writes all changes to disk. More...
 
s4_errno_t s4_errno ()
 Returns the last error number set. More...
 
void s4_set_errno (s4_errno_t err)
 Sets errno to the given error number. More...
 
int _reread_file (s4_t *s4)
 
void _start_sync (s4_t *s4)
 
void _sync (s4_t *s4)
 

Detailed Description

A database backend for XMMS2.

Macro Definition Documentation

#define S4_MAGIC   ("s4db")
#define S4_MAGIC_LEN   (4)
#define S4_VERSION   1

Function Documentation

int _reread_file ( s4_t s4)
void _start_sync ( s4_t s4)

Referenced by _log_write().

void _sync ( s4_t s4)

Referenced by s4_commit().

int s4_close ( s4_t s4)

Closes an open S4 database.

Parameters
s4The database to close

Referenced by CASE(), and main().

s4_errno_t s4_errno ( void  )

Returns the last error number set.

This function is thread safe, error numbers set in one thread will NOT be seen in another thread.

Returns
The last error number set, or S4E_NOERROR if none has been set

Referenced by CASE().

s4_t* s4_open ( const char *  filename,
const char **  indices,
int  open_flags 
)

Opens an S4 database.

The different flags you can pass:

S4_NEW
It will create a new file if one does not already exists. If one exists it will fail and return NULL.

S4_EXISTS
If the file does not exists it will fail and return NULL. s4_errno may be used to get more information about what went wrong.

S4_MEMORY Creates a memory-only database. It will not read any files on startup or write files on shutdown. Use this if you want a temporary database.

Parameters
filenameThe name of the file containing the database
indicesAn array of keys to have indices on
open_flagsZero or more of the flags bitwise-or'd.
Returns
A pointer to an s4_t, or NULL if something went wrong.

Referenced by CASE(), and main().

void s4_set_errno ( s4_errno_t  err)

Sets errno to the given error number.

Parameters
errThe error number to set

Referenced by _lock_exclusive(), _lock_shared(), _log_open(), _oplist_execute(), and s4_commit().

void s4_sync ( s4_t s4)

Writes all changes to disk.

Parameters
s4The database to sync

Referenced by s4_open().