doc
Data Structures | Typedefs | Functions | Variables
csync statedb internals

Data Structures

struct  csync_progressinfo_s
 

Typedefs

typedef struct csync_progressinfo_s csync_progressinfo_t
 

Functions

int csync_get_statedb_exists (CSYNC *ctx)
 
void csync_set_statedb_exists (CSYNC *ctx, int val)
 
int csync_statedb_close (CSYNC *ctx, const char *statedb, int jwritten)
 
int csync_statedb_create_tables (CSYNC *ctx)
 
int csync_statedb_drop_tables (CSYNC *ctx)
 
void csync_statedb_free_progressinfo (csync_progressinfo_t *pi)
 
c_strlist_tcsync_statedb_get_below_path (CSYNC *ctx, const char *path)
 
csync_progressinfo_tcsync_statedb_get_progressinfo (CSYNC *ctx, uint64_t phash, uint64_t modtime, const char *md5)
 
csync_file_stat_tcsync_statedb_get_stat_by_hash (CSYNC *ctx, uint64_t phash)
 
csync_file_stat_tcsync_statedb_get_stat_by_inode (CSYNC *ctx, uint64_t inode)
 
char * csync_statedb_get_uniqId (CSYNC *ctx, uint64_t jHash, csync_vio_file_stat_t *buf)
 
int csync_statedb_insert (CSYNC *ctx, const char *statement)
 
int csync_statedb_insert_metadata (CSYNC *ctx)
 
int csync_statedb_load (CSYNC *ctx, const char *statedb)
 
c_strlist_tcsync_statedb_query (CSYNC *ctx, const char *statement)
 
int csync_statedb_write (CSYNC *ctx)
 
int csync_statedb_write_progressinfo (CSYNC *ctx, csync_progressinfo_t *pi)
 

Variables

int csync_progressinfo_s::chunk
 
int csync_progressinfo_s::error
 
char * csync_progressinfo_s::error_string
 
char * csync_progressinfo_s::md5
 
uint64_t csync_progressinfo_s::modtime
 
struct csync_progressinfo_scsync_progressinfo_s::next
 
uint64_t csync_progressinfo_s::phash
 
char * csync_progressinfo_s::tmpfile
 
int csync_progressinfo_s::transferId
 

Detailed Description

Typedef Documentation

Function Documentation

int csync_get_statedb_exists ( CSYNC ctx)
void csync_set_statedb_exists ( CSYNC ctx,
int  val 
)
int csync_statedb_close ( CSYNC ctx,
const char *  statedb,
int  jwritten 
)
int csync_statedb_create_tables ( CSYNC ctx)
int csync_statedb_drop_tables ( CSYNC ctx)
void csync_statedb_free_progressinfo ( csync_progressinfo_t pi)
c_strlist_t* csync_statedb_get_below_path ( CSYNC ctx,
const char *  path 
)

Query all files metadata inside and below a path.

Parameters
ctxThe csync context.
pathThe path.

This function queries all metadata of all files inside or below the given path. The result is a linear string list with a multiple of 9 entries. For each result file there are 9 strings which are phash, path, inode, uid, gid, mode, modtime, type and md5 (unique id).

Note that not only the files in the given path are part of the result but also the files in directories below the given path. Ie. if the parameter path is /home/kf/test, we have /home/kf/test/file.txt in the result but also /home/kf/test/homework/another_file.txt

Returns
A stringlist containing a multiple of 9 entries.
csync_progressinfo_t* csync_statedb_get_progressinfo ( CSYNC ctx,
uint64_t  phash,
uint64_t  modtime,
const char *  md5 
)
csync_file_stat_t* csync_statedb_get_stat_by_hash ( CSYNC ctx,
uint64_t  phash 
)
csync_file_stat_t* csync_statedb_get_stat_by_inode ( CSYNC ctx,
uint64_t  inode 
)
char* csync_statedb_get_uniqId ( CSYNC ctx,
uint64_t  jHash,
csync_vio_file_stat_t buf 
)
int csync_statedb_insert ( CSYNC ctx,
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.
int csync_statedb_insert_metadata ( CSYNC ctx)
int csync_statedb_load ( CSYNC ctx,
const char *  statedb 
)

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.
c_strlist_t* csync_statedb_query ( CSYNC ctx,
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.
int csync_statedb_write ( CSYNC ctx)
int csync_statedb_write_progressinfo ( CSYNC ctx,
csync_progressinfo_t pi 
)

Variable Documentation

int csync_progressinfo_s::chunk

Definition at line 119 of file csync_statedb.h.

int csync_progressinfo_s::error

Definition at line 118 of file csync_statedb.h.

char* csync_progressinfo_s::error_string

Definition at line 122 of file csync_statedb.h.

char* csync_progressinfo_s::md5

Definition at line 117 of file csync_statedb.h.

uint64_t csync_progressinfo_s::modtime

Definition at line 116 of file csync_statedb.h.

struct csync_progressinfo_s* csync_progressinfo_s::next

Definition at line 114 of file csync_statedb.h.

uint64_t csync_progressinfo_s::phash

Definition at line 115 of file csync_statedb.h.

char* csync_progressinfo_s::tmpfile

Definition at line 121 of file csync_statedb.h.

int csync_progressinfo_s::transferId

Definition at line 120 of file csync_statedb.h.