コード例 #1
0
        public void IncomingSynchronizationStarted(string fileName, FileSystemInfo sourceFileSystemInfo, Guid sourceFileETag, SynchronizationType type)
        {
            var activeForDestination = activeIncomingSynchronizations.GetOrAdd(sourceFileSystemInfo.Url,
                                                       new ConcurrentDictionary<string, SynchronizationDetails>());

            var syncDetails = new SynchronizationDetails
            {
                DestinationUrl = sourceFileSystemInfo.Url,
                FileETag = sourceFileETag,
                FileName = fileName,
                Type = type
            };

            if (activeForDestination.TryAdd(fileName, syncDetails))
            {
                Log.Debug("File '{0}' with ETag {1} was added to an incoming active synchronization queue for a destination {2}",
                          fileName,
                          sourceFileETag, sourceFileSystemInfo.Url);
            }
        }
コード例 #2
0
        private void CreateSyncingConfiguration(string fileName, Guid etag, string destinationFileSystemUrl, SynchronizationType synchronizationType)
        {
            try
            {
                var name = RavenFileNameHelper.SyncNameForFile(fileName, destinationFileSystemUrl);

                var details = new SynchronizationDetails
                {
                    DestinationUrl = destinationFileSystemUrl,
                    FileName = fileName,
                    FileETag = etag,
                    Type = synchronizationType
                };

                storage.Batch(accessor => accessor.SetConfig(name, JsonExtensions.ToJObject(details)));
            }
            catch (Exception e)
            {
                Log.WarnException(
                    string.Format("Could not create syncing configurations for a file {0} and destination {1}", fileName, destinationFileSystemUrl),
                    e);
            }
        }