Rename should_update_etag to should_update_metadata

This should avoid some confusion
This commit is contained in:
Olivier Goffart 2015-07-09 15:05:37 +02:00
parent 992d375e90
commit 45180a024d
9 changed files with 24 additions and 23 deletions

View file

@ -434,7 +434,7 @@ static int _csync_treewalk_visitor(void *obj, void *data) {
trav.inode = cur->inode;
trav.error_status = cur->error_status;
trav.should_update_etag = cur->should_update_etag;
trav.should_update_metadata = cur->should_update_metadata;
if( other_node ) {
csync_file_stat_t *other_stat = (csync_file_stat_t*)other_node->data;

View file

@ -247,7 +247,7 @@ struct csync_tree_walk_file_s {
enum csync_instructions_e instruction;
/* For directories: If the etag has been updated and need to be writen on the db */
int should_update_etag;
int should_update_metadata;
const char *rename_path;
const char *etag;

View file

@ -185,7 +185,8 @@ struct csync_file_stat_s {
mode_t mode; /* u32 */
int type; /* u32 */
int child_modified;/*bool*/
int should_update_etag; /*bool */
int should_update_metadata; /*bool: specify that the etag, or the remote perm or fileid has
changed and need to be updated on the db even for INSTRUCTION_NONE */
int has_ignored_files; /*bool: specify that a directory, or child directory contains ignored files */
char *destpath; /* for renames */

View file

@ -185,7 +185,7 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
// For new directories we always want to update the etag once
// the directory has been propagated. Otherwise the directory
// could appear locally without being added to the database.
cur->should_update_etag = true;
cur->should_update_metadata = true;
}
} else if (other->instruction == CSYNC_INSTRUCTION_NONE
|| cur->type == CSYNC_FTW_TYPE_DIR) {
@ -195,7 +195,7 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
csync_vio_set_file_id( other->file_id, cur->file_id );
}
other->inode = cur->inode;
other->should_update_etag = true;
other->should_update_metadata = true;
cur->instruction = CSYNC_INSTRUCTION_NONE;
} else if (other->instruction == CSYNC_INSTRUCTION_REMOVE) {
other->instruction = CSYNC_INSTRUCTION_RENAME;
@ -205,7 +205,7 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
csync_vio_set_file_id( other->file_id, cur->file_id );
}
other->inode = cur->inode;
other->should_update_etag = true;
other->should_update_metadata = true;
cur->instruction = CSYNC_INSTRUCTION_NONE;
} else if (other->instruction == CSYNC_INSTRUCTION_NEW) {
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "OOOO=> NEW detected in other tree!");
@ -268,9 +268,9 @@ static int _csync_merge_algorithm_visitor(void *obj, void *data) {
/* update DB with new etag from remote */
if (ctx->current == LOCAL_REPLICA) {
other->should_update_etag = true;
other->should_update_metadata = true;
} else {
cur->should_update_etag = true;
cur->should_update_metadata = true;
}
} else if(ctx->current == REMOTE_REPLICA) {
cur->instruction = CSYNC_INSTRUCTION_CONFLICT;

View file

@ -314,7 +314,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
if (metadata_differ) {
/* file id or permissions has changed. Which means we need to update them in the DB. */
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "Need to update metadata for: %s", path);
st->should_update_etag = true;
st->should_update_metadata = true;
}
st->instruction = CSYNC_INSTRUCTION_NONE;
} else {
@ -802,7 +802,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
&& ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL) {
ctx->current_fs->instruction = CSYNC_INSTRUCTION_NONE;
if (ctx->current == REMOTE_REPLICA) {
ctx->current_fs->should_update_etag = true;
ctx->current_fs->should_update_metadata = true;
}
}
@ -820,7 +820,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
if (flag == CSYNC_FTW_FLAG_DIR && ctx->current_fs
&& (ctx->current_fs->instruction == CSYNC_INSTRUCTION_EVAL ||
ctx->current_fs->instruction == CSYNC_INSTRUCTION_NEW)) {
ctx->current_fs->should_update_etag = true;
ctx->current_fs->should_update_metadata = true;
}
ctx->current_fs = previous_fs;

View file

@ -332,7 +332,7 @@ void OwncloudPropagator::start(const SyncFileItemVector& items)
// NOTE: Currently this means that we don't update those etag at all in this sync,
// but it should not be a problem, they will be updated in the next sync.
for (int i = 0; i < directories.size(); ++i) {
directories[i].second->_item->_should_update_etag = false;
directories[i].second->_item->_should_update_metadata = false;
}
} else {
PropagateDirectory* currentDirJob = directories.top().second;
@ -636,7 +636,7 @@ void PropagateDirectory::finalize()
_item->_file = _item->_renameTarget;
}
if (_item->_should_update_etag && _item->_instruction != CSYNC_INSTRUCTION_REMOVE) {
if (_item->_should_update_metadata && _item->_instruction != CSYNC_INSTRUCTION_REMOVE) {
if (PropagateRemoteMkdir* mkdir = qobject_cast<PropagateRemoteMkdir*>(_firstJob.data())) {
// special case from MKDIR, get the fileId from the job there
if (_item->_fileId.isEmpty() && !mkdir->_item->_fileId.isEmpty()) {

View file

@ -127,7 +127,7 @@ void PropagateLocalMkdir::start()
}
// Insert the directory into the database. The correct etag will be set later,
// once all contents have been propagated, because should_update_etag is true.
// once all contents have been propagated, because should_update_metadata is true.
// Adding an entry with a dummy etag to the database still makes sense here
// so the database is aware that this folder exists even if the sync is aborted
// before the correct etag is stored.

View file

@ -348,7 +348,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
if (file->remotePerm && file->remotePerm[0]) {
item->_remotePerm = QByteArray(file->remotePerm);
}
item->_should_update_etag = item->_should_update_etag || file->should_update_etag;
item->_should_update_metadata = item->_should_update_metadata || file->should_update_metadata;
// record the seen files to be able to clean the journal later
_seenFiles.insert(item->_file);
@ -428,7 +428,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
int re = 0;
switch(file->instruction) {
case CSYNC_INSTRUCTION_NONE:
if (remote && item->_should_update_etag && !item->_isDirectory && item->_instruction == CSYNC_INSTRUCTION_NONE) {
if (remote && item->_should_update_metadata && !item->_isDirectory && item->_instruction == CSYNC_INSTRUCTION_NONE) {
// Update the database now already: New fileid or Etag or RemotePerm
// Or for files that were detected as "resolved conflict".
// They should have been a conflict because they both were new, or both
@ -441,9 +441,9 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
item->_modtime = file->other.modtime;
_journal->setFileRecord(SyncJournalFileRecord(*item, _localPath + item->_file));
item->_should_update_etag = false;
item->_should_update_metadata = false;
}
if (item->_isDirectory && (remote || file->should_update_etag)) {
if (item->_isDirectory && (remote || file->should_update_metadata)) {
// Because we want still to update etags of directories
dir = SyncFileItem::None;
} else {
@ -975,7 +975,7 @@ void SyncEngine::checkForPermission()
break;
} if (!(*it)->_isDirectory && !perms.contains("W")) {
qDebug() << "checkForPermission: RESTORING" << (*it)->_file;
(*it)->_should_update_etag = true;
(*it)->_should_update_metadata = true;
(*it)->_instruction = CSYNC_INSTRUCTION_CONFLICT;
(*it)->_direction = SyncFileItem::Down;
(*it)->_isRestoration = true;
@ -997,7 +997,7 @@ void SyncEngine::checkForPermission()
}
if (!perms.contains("D")) {
qDebug() << "checkForPermission: RESTORING" << (*it)->_file;
(*it)->_should_update_etag = true;
(*it)->_should_update_metadata = true;
(*it)->_instruction = CSYNC_INSTRUCTION_NEW;
(*it)->_direction = SyncFileItem::Down;
(*it)->_isRestoration = true;
@ -1016,7 +1016,7 @@ void SyncEngine::checkForPermission()
}
qDebug() << "checkForPermission: RESTORING" << (*it)->_file;
(*it)->_should_update_etag = true;
(*it)->_should_update_metadata = true;
(*it)->_instruction = CSYNC_INSTRUCTION_NEW;
(*it)->_direction = SyncFileItem::Down;

View file

@ -65,7 +65,7 @@ public:
SyncFileItem() : _type(UnknownType), _direction(None), _isDirectory(false),
_hasBlacklistEntry(false), _status(NoStatus),
_isRestoration(false), _should_update_etag(false),
_isRestoration(false), _should_update_metadata(false),
_httpErrorCode(0), _requestDuration(0), _affectedItems(1),
_instruction(CSYNC_INSTRUCTION_NONE), _modtime(0), _size(0), _inode(0)
{
@ -139,7 +139,7 @@ public:
// Variables usefull to report to the user
Status _status BITFIELD(4);
bool _isRestoration BITFIELD(1); // The original operation was forbidden, and this is a restoration
bool _should_update_etag BITFIELD(1);
bool _should_update_metadata BITFIELD(1);
quint16 _httpErrorCode;
QString _errorString; // Contains a string only in case of error
QByteArray _responseTimeStamp;