Example #1
0
	    public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState receivedTransportState = null)
		{
			ExtensionsState = new AtomicDictionary<object>();

		    Name = name;
			ResourceName = string.Concat(Abstractions.Data.Constants.FileSystem.UrlPrefix, "/", name);
			this.systemConfiguration = systemConfiguration;

			systemConfiguration.Container.SatisfyImportsOnce(this);

            transportState = receivedTransportState ?? new TransportState();

            storage = CreateTransactionalStorage(systemConfiguration);

            sigGenerator = new SigGenerator();
            fileLockManager = new FileLockManager();			        
   
            BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024);
            conflictDetector = new ConflictDetector();
            conflictResolver = new ConflictResolver(storage, new CompositionContainer(systemConfiguration.Catalog));

            notificationPublisher = new NotificationPublisher(transportState);
            synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration);

            metricsCounters = new MetricsCountersManager();

            search = new IndexStorage(name, systemConfiguration);

            conflictArtifactManager = new ConflictArtifactManager(storage, search);

			Tasks = new TaskActions(this, Log);
			Files = new FileActions(this, Log);
			Synchronizations = new SynchronizationActions(this, Log);

			AppDomain.CurrentDomain.ProcessExit += ShouldDispose;
			AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
		}
Example #2
0
        public RavenFileSystem(InMemoryRavenConfiguration config, string name, TransportState receivedTransportState = null)
        {
            ExtensionsState = new AtomicDictionary<object>();

            Name = name;
            ResourceName = string.Concat(Abstractions.Data.Constants.FileSystem.UrlPrefix, "/", name);
            configuration = config;

            try
            {
                ValidateStorage();

                configuration.Container.SatisfyImportsOnce(this);

                transportState = receivedTransportState ?? new TransportState();

                storage = CreateTransactionalStorage(configuration);

                sigGenerator = new SigGenerator();
                fileLockManager = new FileLockManager();			        
   
                BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024);
                conflictDetector = new ConflictDetector();
                conflictResolver = new ConflictResolver(storage, new CompositionContainer(configuration.Catalog));

                notificationPublisher = new NotificationPublisher(transportState);
                synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, configuration);

                metricsCounters = new MetricsCountersManager();

                search = new IndexStorage(name, configuration);

                conflictArtifactManager = new ConflictArtifactManager(storage, search);

                Tasks = new TaskActions(this, Log);
                Files = new FileActions(this, Log);
                Synchronizations = new SynchronizationActions(this, Log);

                AppDomain.CurrentDomain.ProcessExit += ShouldDispose;
                AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
            }
            catch (Exception e)
            {
                Log.ErrorException(string.Format("Could not create file system '{0}'", Name ?? "unknown name"), e);
                try
                {
                    Dispose();
                }
                catch (Exception ex)
                {
                    Log.FatalException("Failed to dispose when already getting an error in file system ctor", ex);
                }
                throw;
            }
        }