doc
Functions
csync statedb internals

Functions

int csync_get_statedb_exists (CSYNC *ctx)
 
void csync_set_statedb_exists (CSYNC *ctx, int val)
 
int csync_statedb_close (const char *statedb, sqlite3 *db, int jwritten)
 
int csync_statedb_create_tables (sqlite3 *db)
 
int csync_statedb_drop_tables (sqlite3 *db)
 
csync_file_stat_tcsync_statedb_get_stat_by_hash (sqlite3 *db, uint64_t phash)
 
csync_file_stat_tcsync_statedb_get_stat_by_inode (sqlite3 *db, ino_t inode)
 
int csync_statedb_insert (sqlite3 *db, const char *statement)
 
int csync_statedb_insert_metadata (CSYNC *ctx, sqlite3 *db)
 
int csync_statedb_load (CSYNC *ctx, const char *statedb, sqlite3 **pdb)
 
c_strlist_tcsync_statedb_query (sqlite3 *db, const char *statement)
 
int csync_statedb_write (CSYNC *ctx, sqlite3 *db)
 

Detailed Description

Function Documentation

◆ csync_get_statedb_exists()

int csync_get_statedb_exists ( CSYNC ctx)

◆ csync_set_statedb_exists()

void csync_set_statedb_exists ( CSYNC ctx,
int  val 
)

◆ csync_statedb_close()

int csync_statedb_close ( const char *  statedb,
sqlite3 *  db,
int  jwritten 
)

◆ csync_statedb_create_tables()

int csync_statedb_create_tables ( sqlite3 *  db)

◆ csync_statedb_drop_tables()

int csync_statedb_drop_tables ( sqlite3 *  db)

◆ csync_statedb_get_stat_by_hash()

csync_file_stat_t* csync_statedb_get_stat_by_hash ( sqlite3 *  db,
uint64_t  phash 
)

◆ csync_statedb_get_stat_by_inode()

csync_file_stat_t* csync_statedb_get_stat_by_inode ( sqlite3 *  db,
ino_t  inode 
)

◆ csync_statedb_insert()

int csync_statedb_insert ( sqlite3 *  db,
const char *  statement 
)

Insert function for the statedb.

Parameters
ctxThe csync context.
statementThe SQL statement to insert into the statedb.
Returns
The rowid of the most recent INSERT on success, 0 if the query wasn't successful.

◆ csync_statedb_insert_metadata()

int csync_statedb_insert_metadata ( CSYNC ctx,
sqlite3 *  db 
)

◆ csync_statedb_load()

int csync_statedb_load ( CSYNC ctx,
const char *  statedb,
sqlite3 **  pdb 
)

Load the statedb.

This function tries to load the statedb. If it doesn't exists it creates the sqlite3 database, but doesn't create the tables. This will be done when csync gets destroyed.

Parameters
ctxThe csync context.
statedbPath to the statedb file (sqlite3 db).
Returns
0 on success, less than 0 if an error occured with errno set.

◆ csync_statedb_query()

c_strlist_t* csync_statedb_query ( sqlite3 *  db,
const char *  statement 
)

A generic statedb query.

Parameters
ctxThe csync context.
statementThe SQL statement to execute
Returns
A stringlist of the entries of a column. An emtpy stringlist if nothing has been found. NULL on error.

◆ csync_statedb_write()

int csync_statedb_write ( CSYNC ctx,
sqlite3 *  db 
)