aegif / CmisSync

Synchronize content between a CMIS repository and your desktop. Like Dropbox for Enterprise Content Management!
http://CmisSync.com
163 stars 123 forks source link

Local files: Crawl less often and use FileSystemWatcher instead #122

Closed nicolas-raoul closed 10 years ago

nicolas-raoul commented 11 years ago

http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx

We will still need to crawl when CmisSync is started, and maybe once in a while if we don't trust FileSystemWatcher too much.

ymolinet commented 11 years ago

SparkleControllerBase have a FileSystemWatcter (watcher object) already implemented. We must work on the OnFolderActivity method. Low priority at this time.

nicolas-raoul commented 11 years ago

Well spot Yannick!

ymolinet commented 11 years ago

Current Crawl Method impact hard drive performance with a lot file.

ymolinet commented 11 years ago

OnFolderActivity in SparkleControllerBase watch only the root folder, not subfolder. We must work on HasRemoteChanges and HasLocalChanges instead. HasLocalChanges could use a FileSystemWatcher and compare with CmisDatabase. but how to detect remote changes without crawl the remote folder

ymolinet commented 11 years ago

http://stackoverflow.com/questions/12190247/most-efficient-way-to-detect-changes-of-a-remote-cmis-repository

ymolinet commented 11 years ago

18

nicolas-raoul commented 11 years ago

122 is not as important as #18, because crawling local files is very cheap compared to crawling remote files.

more0401 commented 11 years ago

A suggestion that storing the local Last Modify Time and file size to local database. Unless local Last Modify Time or file size is changed, we will not check for SHA1 check sum.

more0401 commented 11 years ago

If no one is assigned to this issue, I will try to fix it in OpenDataSpace/CmisSync firstly

The first task will be done, and the second task may be optional

nicolas-raoul commented 11 years ago

more0401, thanks a lot for stepping in!

Note: I guess implementing ChangeLog is more important (to save network bandwidth and server resources), but FileSystemWatcher is also a nice thing to add, indeed.

nicolas-raoul commented 11 years ago

Note: Implementation should probably start inside method ControllerBase.OnFolderActivity , and platform-specific code should be written as methods in Controller.cs :-)

more0401 commented 11 years ago

I have done the fix, while it may take some time to merge to OpenDataSpace/CmisSync.git You can preview this work from https://github.com/more0401/CmisSync/ branch gds2/issue122

I add a new file CmisSync.Lib/WatcherStrategy.cs that does the work to sync the FileSystemWatcher changes, which is called by CmisSync.Lib,CmisRepo.SynchronizedFolder.Sync() every 5 seconds.