00001 /* 00002 * libcsync -- a library to sync a directory with another 00003 * 00004 * Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef _CSYNC_PROPAGATE_H 00022 #define _CSYNC_PROPAGATE_H 00023 00024 #include <sys/types.h> 00025 00026 /** 00027 * @file csync_reconcile.h 00028 * 00029 * @brief Propagation 00030 * 00031 * It uses the calculated records to apply them on the current replica. The 00032 * propagator uses a two-phase-commit mechanism to simulate an atomic 00033 * filesystem operation. 00034 * 00035 * In the first phase we copy the file to a temporary file on the opposite 00036 * replica. This has the advantage that we can check if file which has been 00037 * copied to the opposite replica has been transferred successfully. If the 00038 * connection gets interrupted during the transfer we still have the original 00039 * states of the file. This means no data will be lost. 00040 * 00041 * In the second phase the file on the opposite replica will be overwritten by 00042 * the temporary file. 00043 * 00044 * After a successful propagation we have to merge the trees to reflect the 00045 * current state of the filesystem tree. This updated tree will be written as a 00046 * journal into the state database. It will be used during the update detection 00047 * of the next synchronization. See above for a description of the state 00048 * database during synchronization. 00049 * 00050 * @defgroup csyncPropagationInternals csync propagation internals 00051 * @ingroup csyncInternalAPI 00052 * 00053 * @{ 00054 */ 00055 00056 #define C_FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) 00057 #define C_DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) 00058 00059 /** 00060 * @brief Propagate all files. 00061 * 00062 * @param ctx The csync context to use for propagation. 00063 * 00064 * @return 0 on success, < 0 on error. 00065 */ 00066 int csync_propagate_files(CSYNC *ctx); 00067 00068 int csync_propagate_rename_file(CSYNC *ctx, csync_file_stat_t *st); 00069 00070 int csync_init_progress(CSYNC *ctx); 00071 00072 void csync_finalize_progress(CSYNC *ctx); 00073 00074 /** 00075 * }@ 00076 */ 00077 #endif /* _CSYNC_PROPAGATE_H */ 00078 00079 /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */