Wednesday, July 19, 2017

We were discussing document libraries and file synchronization service. This service provide incremental synchronization between two file system locations. Changes are detected from the last synchronization.
It stores metadata about the synchronization which describes where and when the item was changed, giving a snapshot of every file and folder in the replica. For files, the comparison is done on the file size, file times, file attributes, file name and optionally a hash of the file contents. For folders, the comparison is done on folder attributes and folder names.
Since change detection evaluates all files, a large number of files in the replica may degrade performance. Users are notified with progress during the synchronization operation with the help of events raised from managed code execution or from callbacks in the unmanaged code. If the progress is displayed during preview mode, the changes are not committed. If the users modify different file system replicas and they get out of sync, a process of  conflict resolution is performed. The conflict resolution is deterministic. It does not matter which replica initiates the conflict resolution. In all cases, it avoids data loss and applies the most recent update or preserves different files.
The callbacks and events don't just come helpful for progress or preview, they are also helpful for error handling and recovery.  These enable graceful error handling per file during the synchronization of a set of files.Errors may come from locked files, changes after change detection, access denied, insufficient disk space, etc. If an error  is encountered, the file is skipped so that the rest of the synchronization proceeds. The application gets the file details and error information which it may use to re-synchronize after fixing up the problem. If the entire synchronization operation fails, the application may get a proper error code. For example, a replica in use error code is given  when there are concurrent synchronization operations on the same replica.
The file synchronization provider is designed to handle concurrent operations by applications. Changes to the file will not be synchronized until the next synchronization session so that concurrent changes to the source or destination is not lost. Each file synchronization is atomic so that the user does not end up with a partially correct copy of the file.
#codingexercise
void InOrderTraversal(Node root, ref List<Node> lasttwo)
{
if (root == null) return;
InOrderTraversal(root.left, ref lasttwo);
ShiftAndAdd(root, ref lasttwo);
InOrderTraversal(root.right, ref lasttwo);
}
void ShiftAndAdd(Node root, ref List<Node> lasttwo)
{
if (lasttwo.Count < 2) {lasttwo.Add(root); return;}
lasttwo[0] = lasttwo[1];
lasttwo[1] = root;
return;
}

1 comment:

  1. there are many mobile application development company but only few are good and this blog need to convert into a beautiful website.

    ReplyDelete