https://msdn.microsoft.com/en-US/library/bb902813(v=sql.110).aspx

Sync Framework includes a file synchronization provider that extends the UnmanagedSyncProviderWrapper object (for managed code) orIKnowledgeSyncProvider interface (for unmanaged code)

to simplify creation of an application that synchronizes files and folders among file systems.

Creating and Initializing the Provider

Managed code An application creates a FileSyncProvider object. Paths and configuration options are specified in the constructor.

托管代码,创建FileSyncProvider对象,在构造函数中指定路径和配置选项

Unmanaged code An application creates an IFileSyncProvider object by passing CLSID_FileSyncProvider and IID_IFileSyncProvider toCoCreateInstance.

Paths and configuration options are specified by calling the Initialize method.

The paths that are specified when the provider is constructed or initialized define the root folder to synchronize, and the folder and file name in which the synchronization metadata is stored.

Optionally, the application can also specify a folder to store temporary files and a folder to store files that are updated because of a conflict.

These must be valid paths and must exist before the provider is initialized.

 Note

For all methods in the file synchronization provider, paths cannot exceed MAX_PATH.

A set of configuration flags can be specified when the provider is constructed or initialized.

These flags modify the behavior of the provider in various ways, such as to improve change detection by calculating a hash value for each file, or to move deleted files to the recycle bin instead of permanently deleting them.

These flags are represented by FileSyncOptions (for managed code) or FILESYNC_INIT_FLAGS (for unmanaged code).

After source and destination providers have been created and initialized, they can be passed to a synchronization session and synchronization can be started.

File Attributes

Sync Framework recognizes only the following file and folder attributes:

  • FILE_ATTRIBUTE_DIRECTORY

  • FILE_ATTRIBUTE_READONLY

  • FILE_ATTRIBUTE_HIDDEN

  • FILE_ATTRIBUTE_SYSTEM

  • FILE_ATTRIBUTE_TEMPORARY

Other file attributes are ignored and are not propagated传送.

Security and Encryption

The provider does not perform any authentication on the folders that are involved in synchronization.

The application must authenticate the folders that are used before it passes them to the provider.

Security information, such as the Discretionary Access Control List (DACL), is not propagated.

It is up to the application or user to correctly secure the destination folders to help prevent unauthorized access.

Files in an encrypted folder are decrypted before they are sent and will not be encrypted in the destination folder.

Be aware that this means that even if the source folder is encrypted, the files will still not be encrypted when they are sent.

To help prevent unauthorized access or tampering篡改, the communication channel between the provider and the folder must be trusted.

Synchronization metadata and temporary files are stored in folders specified when the provider is initialized.

These folders must be appropriately secured and the temporary folder cleaned up to avoid unwanted information disclosure, because these files might contain user data.

Consistency Guarantee

Sync Framework guarantees that, when the file synchronization provider applies a change, if all contents of a file stream cannot be applied then no content will be.

This is done in part by opening the files in exclusive share mode.

This means that the file cannot be opened or deleted by any other application until its handle is closed.

For more information, see the CreateFile function in the Microsoft Win32 documentation.

If the file cannot be opened in exclusive share mode it will be skipped.

The skip will be recorded in the metadata so that it can be processed appropriately in future sessions.

Metadata Storage 

The file synchronization provider uses the metadata storage service to store all synchronization metadata in a custom data store.

The metadata store is one file.

This file can be stored with the files and folders that are to be synchronized or in another location that is specified when the provider is initialized.

For more information about metadata storage service components, see Sync Framework Metadata Storage Service.

Backing up and Restoring a File System Replica

When a file system replica is restored from a backup, problems can occur with synchronization.

For example, local changes made after the restore might not propagate传输 to other replicas.

This can occur because the tick count used to assign versions to changes on the source replica may cause changes to be detected as obsolete废弃的 by other replicas.

To ensure that this situation does not occur, when a file system replica is restored from a backup,

discard the synchronization metadata and treat the replica as a new replica, assigning it a new replica ID.

The file synchronization provider can then create synchronization metadata for the replica and synchronize it correctly with other replicas in the community.

Getting Started Synchronizing Files的更多相关文章

  1. How to: Synchronize Files by Using Managed Code

    The examples in this topic focus on the following Sync Framework types: FileSyncProvider FileSyncOpt ...

  2. Total Commander 8.52 Beta 1

    Total Commander 8.52 Beta 1http://www.ghisler.com/852_b1.php 10.08.15 Release Total Commander 8.52 b ...

  3. A replacement solution to using Google Drive in Ubuntu

    Grive2 Get dependencies You need to get the dependency libraries along with their development (-dev ...

  4. Introducing Microsoft Sync Framework: Sync Services for File Systems

    https://msdn.microsoft.com/en-us/sync/bb887623 Introduction to Microsoft Sync Framework File Synchro ...

  5. 由于losf引起的pxc启动报错处理

    PXC主节点启动完成后,再启动node1,error日志报错: 2017-05-02T15:23:42.830888Z 0 [ERROR] WSREP: Failed to read 'ready & ...

  6. Linux系统实时数据同步inotify+rsync

    一.inotify简介 inotify是Linux内核的一个功能,它能监控文件系统的变化,比如删除.读.写和卸载等操作.它监控到这些事件的发生后会默认往标准输出打印事件信息.要使用inotify,Li ...

  7. Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ...

    Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define ... 这个错误是因为有两个相 ...

  8. The type javax.ws.rs.core.MediaType cannot be resolved. It is indirectly referenced from required .class files

    看到了http://stackoverflow.com/questions/5547162/eclipse-error-indirectly-referenced-from-required-clas ...

  9. 未能写入输出文件“c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\106f9ae8\cc0e1

    在本地开发环境没问题,但是发布到服务器出现:未能写入输出文件"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.Ne ...

随机推荐

  1. Hibernate exercise 54

    针对马士兵的Hibernate讲解第54讲的练习: 1) 学生.课程.分数的设计,并用Hibernate操作 在实际中,一般是先手动写SQL(可以优化)去创建表和关系,再设置Hibernate配置为u ...

  2. 数据类型的处理(提取自FMDB)

    if ((!obj) || ((NSNull *)obj == [NSNull null])) { sqlite3_bind_null(pStmt, idx); } // FIXME - someda ...

  3. spring mvc注解@RequestParam

    在spring mvc 的使用过程中 获取 页面传来的参数的时候,我平时都习惯  @RequestParam String name,突然有一天我发现 直接在方法参数后面写 String name , ...

  4. 【转载】MySQL索引原理及慢查询优化

    原文链接:美团点评技术团队:http://tech.meituan.com/mysql-index.html MySQL凭借着出色的性能.低廉的成本.丰富的资源,已经成为绝大多数互联网公司的首选关系型 ...

  5. 快钱报错:javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name解决

    jdk1.7提示:javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name //方案1:设置系统属性:System. ...

  6. MAC OS下使用Xcode进行GLSL编程的配置过程

    整理自之前使用的163博客原创文章. GLSL项目中需要使用GLEW库,因此先要安装GLEW库和在Xcode中配置GLEW.要使GLEW在Xcode中被正确链接,又需要通过MacPorts来安装GLE ...

  7. Delphi托盘类 收集

    收集的两个托盘程序: 1. 托盘区就是在windows的状态栏下方显示时钟.输入法状态的地方, 要把你的程序显示在托盘区: 下面是一个托盘类,只要把下面粘贴到文本文件中,改成TrayIcon.pas, ...

  8. cf div2 238 c

    C. Unusual Product time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  9. 大一暑假为期五周的ACM实验室培训结束了(2013.8.24)

    没想到,我的大学里第一个暑假,9周的时间只有最初的两周在家待着,接下来的7周将会在学校度过. 说真的,这是我上学以来,第一次真正好好利用的假期.在这五周里,周一.三.五下午学长都会给我们讲点知识,之后 ...

  10. POJ 3114 Countries in War(强联通分量+Tarjan)

    题目链接 题意 : 给你两个城市让你求最短距离,如果两个城市位于同一强连通分量中那距离为0. 思路 :强连通分量缩点之后,求最短路.以前写过,总感觉记忆不深,这次自己敲完再写了一遍. #include ...