doc
csync_propagate.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 #ifndef _CSYNC_PROPAGATE_H
22 #define _CSYNC_PROPAGATE_H
23 
24 #include <sys/types.h>
25 
26 /**
27  * @file csync_reconcile.h
28  *
29  * @brief Propagation
30  *
31  * It uses the calculated records to apply them on the current replica. The
32  * propagator uses a two-phase-commit mechanism to simulate an atomic
33  * filesystem operation.
34  *
35  * In the first phase we copy the file to a temporary file on the opposite
36  * replica. This has the advantage that we can check if file which has been
37  * copied to the opposite replica has been transferred successfully. If the
38  * connection gets interrupted during the transfer we still have the original
39  * states of the file. This means no data will be lost.
40  *
41  * In the second phase the file on the opposite replica will be overwritten by
42  * the temporary file.
43  *
44  * After a successful propagation we have to merge the trees to reflect the
45  * current state of the filesystem tree. This updated tree will be written as a
46  * journal into the state database. It will be used during the update detection
47  * of the next synchronization. See above for a description of the state
48  * database during synchronization.
49  *
50  * @defgroup csyncPropagationInternals csync propagation internals
51  * @ingroup csyncInternalAPI
52  *
53  * @{
54  */
55 
56 #define C_FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
57 #define C_DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
58 
59 /**
60  * @brief Propagate all files.
61  *
62  * @param ctx The csync context to use for propagation.
63  *
64  * @return 0 on success, < 0 on error.
65  */
67 
69 
70 int csync_init_progress(CSYNC *ctx);
71 
73 
74 /**
75  * }@
76  */
77 #endif /* _CSYNC_PROPAGATE_H */
78 
79 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
void csync_finalize_progress(CSYNC *ctx)
int csync_init_progress(CSYNC *ctx)
int csync_propagate_files(CSYNC *ctx)
Propagate all files.
csync public structure
Definition: csync_private.h:88
int csync_propagate_rename_file(CSYNC *ctx, csync_file_stat_t *st)