Beispiel #1
0
        public void LockByCreatingSyncConfiguration(string fileName, FileSystemInfo sourceFileSystem, IStorageActionsAccessor accessor)
        {
            var syncLock = new SynchronizationLock
            {
                SourceFileSystem = sourceFileSystem,
                FileLockedAt = DateTime.UtcNow
            };

            accessor.SetConfig(RavenFileNameHelper.SyncLockNameForFile(fileName), JsonExtensions.ToJObject(syncLock));

            log.Debug("File '{0}' was locked", fileName);
        }
Beispiel #2
0
        public void LockByCreatingSyncConfiguration(string fileName, ServerInfo sourceServer, IStorageActionsAccessor accessor)
        {
            var syncLock = new SynchronizationLock
            {
                SourceServer = sourceServer,
                FileLockedAt = DateTime.UtcNow
            };

            accessor.SetConfig(RavenFileNameHelper.SyncLockNameForFile(fileName), JsonExtensions.ToJObject(syncLock));

            log.Debug("File '{0}' was locked", fileName);
        }
Beispiel #3
0
		public void LockByCreatingSyncConfiguration(string fileName, ServerInfo sourceServer, IStorageActionsAccessor accessor)
		{
			var syncLock = new SynchronizationLock
			{
				SourceServer = sourceServer,
				FileLockedAt = DateTime.UtcNow
			};

			accessor.SetConfig(RavenFileNameHelper.SyncLockNameForFile(fileName), syncLock.AsConfig());

			log.Debug("File '{0}' was locked", fileName);
		}
Beispiel #4
0
        private void SaveSynchronizationSourceInformation(ServerInfo sourceServer, Guid lastSourceEtag, IStorageActionsAccessor accessor)
        {
            var lastSynchronizationInformation = GetLastSynchronization(sourceServer.Id, accessor);

            if (Buffers.Compare(lastSynchronizationInformation.LastSourceFileEtag.ToByteArray(), lastSourceEtag.ToByteArray()) > 0)
            {
                return;
            }

            var synchronizationSourceInfo = new SourceSynchronizationInformation
            {
                LastSourceFileEtag  = lastSourceEtag,
                SourceServerUrl     = sourceServer.FileSystemUrl,
                DestinationServerId = Storage.Id
            };

            var key = SynchronizationConstants.RavenSynchronizationSourcesBasePath + "/" + sourceServer.Id;

            accessor.SetConfig(key, JsonExtensions.ToJObject(synchronizationSourceInfo));

            Log.Debug("Saved last synchronized file ETag {0} from {1} ({2})", lastSourceEtag, sourceServer.FileSystemUrl, sourceServer.Id);
        }
		private void SaveSynchronizationSourceInformation(ServerInfo sourceServer, Guid lastSourceEtag,
														  IStorageActionsAccessor accessor)
		{
			var lastSynchronizationInformation = GetLastSynchronization(sourceServer.Id, accessor);
			if (Buffers.Compare(lastSynchronizationInformation.LastSourceFileEtag.ToByteArray(), lastSourceEtag.ToByteArray()) >
				0)
			{
				return;
			}

			var synchronizationSourceInfo = new SourceSynchronizationInformation
			{
				LastSourceFileEtag = lastSourceEtag,
				SourceServerUrl = sourceServer.FileSystemUrl,
				DestinationServerId = Storage.Id
			};

			var key = SynchronizationConstants.RavenSynchronizationSourcesBasePath + "/" + sourceServer.Id;

			accessor.SetConfig(key, synchronizationSourceInfo.AsConfig());

			Log.Debug("Saved last synchronized file ETag {0} from {1} ({2})", lastSourceEtag, sourceServer.FileSystemUrl, sourceServer.Id);
		}
		private void SaveSynchronizationReport(string fileName, IStorageActionsAccessor accessor, SynchronizationReport report)
		{
			var name = RavenFileNameHelper.SyncResultNameForFile(fileName);
			accessor.SetConfig(name, report.AsConfig());
		}
Beispiel #7
0
        private void SaveSynchronizationReport(string fileName, IStorageActionsAccessor accessor, SynchronizationReport report)
        {
            var name = RavenFileNameHelper.SyncResultNameForFile(fileName);

            accessor.SetConfig(name, JsonExtensions.ToJObject(report));
        }
		private void SaveSynchronizationReport(string fileName, IStorageActionsAccessor accessor, SynchronizationReport report)
		{
			var name = RavenFileNameHelper.SyncResultNameForFile(fileName);
			accessor.SetConfig(name, JsonExtensions.ToJObject(report));
		}
Beispiel #9
0
 public static void SetConfigurationValue <T>(this IStorageActionsAccessor accessor, string key, T objectToSave)
 {
     accessor.SetConfig(key, JsonExtensions.ToJObject(objectToSave));
 }