doc
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
csync_statedb.h
Go to the documentation of this file.
1
/*
2
* libcsync -- a library to sync a directory with another
3
*
4
* Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org>
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
*/
20
21
/**
22
* @file csync_private.h
23
*
24
* @brief Private interface of csync
25
*
26
* @defgroup csyncstatedbInternals csync statedb internals
27
* @ingroup csyncInternalAPI
28
*
29
* @{
30
*/
31
32
#ifndef _CSYNC_STATEDB_H
33
#define _CSYNC_STATEDB_H
34
35
#include "
c_lib.h
"
36
#include "
csync_private.h
"
37
38
void
csync_set_statedb_exists
(
CSYNC
*ctx,
int
val);
39
40
int
csync_get_statedb_exists
(
CSYNC
*ctx);
41
42
/**
43
* @brief Load the statedb.
44
*
45
* This function tries to load the statedb. If it doesn't exists it creates
46
* the sqlite3 database, but doesn't create the tables. This will be done when
47
* csync gets destroyed.
48
*
49
* @param ctx The csync context.
50
* @param statedb Path to the statedb file (sqlite3 db).
51
*
52
* @return 0 on success, less than 0 if an error occured with errno set.
53
*/
54
int
csync_statedb_load
(
CSYNC
*ctx,
const
char
*statedb);
55
56
int
csync_statedb_write
(
CSYNC
*ctx);
57
58
int
csync_statedb_close
(
CSYNC
*ctx,
const
char
*statedb,
int
jwritten);
59
60
csync_file_stat_t
*
csync_statedb_get_stat_by_hash
(
CSYNC
*ctx, uint64_t
phash
);
61
62
csync_file_stat_t
*
csync_statedb_get_stat_by_inode
(
CSYNC
*ctx, uint64_t
inode
);
63
64
/**
65
* @brief A generic statedb query.
66
*
67
* @param ctx The csync context.
68
* @param statement The SQL statement to execute
69
*
70
* @return A stringlist of the entries of a column. An emtpy stringlist if
71
* nothing has been found. NULL on error.
72
*/
73
c_strlist_t
*
csync_statedb_query
(
CSYNC
*ctx,
const
char
*statement);
74
75
/**
76
* @brief Insert function for the statedb.
77
*
78
* @param ctx The csync context.
79
* @param statement The SQL statement to insert into the statedb.
80
*
81
* @return The rowid of the most recent INSERT on success, 0 if the query
82
* wasn't successful.
83
*/
84
int
csync_statedb_insert
(
CSYNC
*ctx,
const
char
*statement);
85
86
int
csync_statedb_create_tables
(
CSYNC
*ctx);
87
88
int
csync_statedb_drop_tables
(
CSYNC
*ctx);
89
90
int
csync_statedb_insert_metadata
(
CSYNC
*ctx);
91
92
/**
93
* }@
94
*/
95
#endif
/* _CSYNC_STATEDB_H */
96
/* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
Generated by
1.8.1