Esempio n. 1
0
 public SynchronizationThread(NoteRepository repository, ISynchronizationFeedback[] synclistener, ConflictResolutionStrategyConfig strat, IAlephDispatcher disp)
 {
     repo             = repository;
     listener         = synclistener.ToList();
     conflictStrategy = ConflictResolutionStrategyHelper.ToInterfaceType(strat);
     dispatcher       = disp;
     _comChannel      = new ManualResetEvent(false);
 }
        public RawFolderRepository(NoteRepository r, IAlephDispatcher disp, AppSettings s)
        {
            _repo           = r;
            _dispatcher     = disp;
            _invSyncRequest = DelayedCombiningInvoker.Create(() => disp.BeginInvoke(SyncNow), 5 * 1000, 30 * 1000);

            _enabled = s.UseRawFolderRepo;
            _path    = s.RawFolderRepoPath;

            _filewatcherEnabled = s.RawFolderRepoUseFileWatcher;
            _encoding           = EncodingEnumHelper.ToEncoding(s.RawFolderRepoEncoding);
            _searchDepth        = s.RawFolderRepoMaxDirectoryDepth;

            _syncModifications = s.RawFolderRepoAllowModification;
            _syncCreation      = s.RawFolderRepoAllowCreation;
            _syncDeletion      = s.RawFolderRepoAllowDeletion;
        }
        public SynchronizationThread(NoteRepository repository, IEnumerable <ISynchronizationFeedback> synclistener, AppSettings settings, IAlephDispatcher disp)
        {
            _repo     = repository;
            _listener = synclistener.ToList();

            _conflictStrategy = ConflictResolutionStrategyHelper.ToInterfaceType(settings.ConflictResolution);
            _noteDownloadEnableMultithreading    = repository.SupportsDownloadMultithreading;
            _noteDownloadParallelismLevel        = settings.NoteDownloadParallelismLevel;
            _noteDownloadParallelismThreshold    = settings.NoteDownloadParallelismThreshold;
            _noteNewDownloadEnableMultithreading = repository.SupportsNewDownloadMultithreading;
            _noteNewDownloadParallelismLevel     = settings.NoteNewDownloadParallelismLevel;
            _noteNewDownloadParallelismThreshold = settings.NoteNewDownloadParallelismThreshold;
            _noteUploadEnableMultithreading      = repository.SupportsUploadMultithreading;
            _noteUploadParallelismLevel          = settings.NoteUploadParallelismLevel;
            _noteUploadParallelismThreshold      = settings.NoteUploadParallelismThreshold;

            _dispatcher = disp;
            _comChannel = new ManualResetEvent(false);
        }
Esempio n. 4
0
        public NoteRepository(string path, ISynchronizationFeedback fb, AppSettings cfg, RemoteStorageAccount acc, IAlephDispatcher disp)
        {
            _pathLocalBase   = path;
            _pathLocalFolder = Path.Combine(path, acc.ID.ToString("B"));
            _pathLocalData   = Path.Combine(path, acc.ID.ToString("B") + ".xml");
            _conn            = acc.Plugin.CreateRemoteStorageConnection(cfg.CreateProxy(), acc.Config, cfg.GetHierachicalConfig());
            _account         = acc;
            _appconfig       = cfg;
            _listener        = fb;
            _dispatcher      = disp;
            _thread          = new SynchronizationThread(this, new[] { this, fb }, cfg, _dispatcher);

            _invSaveNotesLocal     = DelayedCombiningInvoker.Create(() => _dispatcher.BeginInvoke(SaveAllDirtyNotes), 10 * 1000, 1 * 60 * 1000);
            _invSaveNotesRemote    = DelayedCombiningInvoker.Create(() => _dispatcher.BeginInvoke(SyncNow), 45 * 1000, 15 * 60 * 1000);
            _invSaveNotesGitBackup = DelayedCombiningInvoker.Create(() => _dispatcher.BeginInvoke(CommitToLocalGitBackup), 10 * 1000, 15 * 60 * 1000);

            _rawFilesystemRepo = new RawFolderRepository(this, disp, cfg);

            _notes.CollectionChanged += NoteCollectionChanged;
        }