Пример #1
0
		public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState recievedTransportState = null)
		{
		    this.Name = name;
			this.systemConfiguration = systemConfiguration;

		    var storageType = systemConfiguration.FileSystem.DefaultStorageTypeName;

            storage = CreateTransactionalStorage(storageType, systemConfiguration);
			search = new IndexStorage(systemConfiguration.FileSystem.IndexStoragePath, systemConfiguration.Settings);
			sigGenerator = new SigGenerator();
			var replicationHiLo = new SynchronizationHiLo(storage);
			var sequenceActions = new SequenceActions(storage);
			transportState = recievedTransportState ?? new TransportState();
			notificationPublisher = new NotificationPublisher(transportState);
			fileLockManager = new FileLockManager();
			storage.Initialize();
			search.Initialize();
			var uuidGenerator = new UuidGenerator(sequenceActions);
			historian = new Historian(storage, replicationHiLo, uuidGenerator);
			BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024);
			conflictArtifactManager = new ConflictArtifactManager(storage, search);
			conflictDetector = new ConflictDetector();
			conflictResolver = new ConflictResolver(storage, new CompositionContainer(systemConfiguration.Catalog));
			synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration);
			storageOperationsTask = new StorageOperationsTask(storage, search, notificationPublisher);
            metricsCounters = new MetricsCountersManager();

			AppDomain.CurrentDomain.ProcessExit += ShouldDispose;
			AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
		}
Пример #2
0
		public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState receivedTransportState = null)
		{
			ExtensionsState = new AtomicDictionary<object>();

		    Name = 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);
            storageOperationsTask = new StorageOperationsTask(storage, DeleteTriggers, search, notificationPublisher); 

			AppDomain.CurrentDomain.ProcessExit += ShouldDispose;
			AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
		}        
Пример #3
0
        public TransactionalStorage(string path, NameValueCollection settings)
        {
            this.path = path;
            this.settings = settings;

            bufferPool = new BufferPool(2L * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit)
        }
Пример #4
0
        public TransactionalStorage(InMemoryRavenConfiguration configuration)
        {
	        this.configuration = configuration;
	        path = configuration.FileSystemDataDirectory.ToFullPath();
	        settings = configuration.Settings;

            bufferPool = new BufferPool(2L * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit)
        }
Пример #5
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);

                TimerManager = new ResourceTimerManager();

                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;
            }
        }
Пример #6
0
 public ReadFileToDatabase(BufferPool bufferPool, ITransactionalStorage storage, OrderedPartCollection<AbstractFilePutTrigger> putTriggers, Stream inputStream, string filename, RavenJObject headers)
 {
     this.bufferPool = bufferPool;
     this.inputStream = inputStream;
     this.storage = storage;
     this.putTriggers = putTriggers;
     this.filename = filename;
     this.headers = headers;
     buffer = bufferPool.TakeBuffer(StorageConstants.MaxPageSize);
     md5Hasher = Encryptor.Current.CreateHash();
 }
Пример #7
0
		public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, TransportState transportState, string name)
		{
		    this.Name = name;
			this.systemConfiguration = systemConfiguration;

		    var storageType = systemConfiguration.DefaultFileSystemStorageTypeName;
            if (string.Equals(InMemoryRavenConfiguration.VoronTypeName, storageType, StringComparison.OrdinalIgnoreCase) == false)
            {
                if (Directory.Exists(systemConfiguration.FileSystemDataDirectory) &&
                        Directory.EnumerateFileSystemEntries(systemConfiguration.FileSystemDataDirectory).Any())
                    throw new InvalidOperationException(
                        string.Format(
                            "We do not allow to run on a storage engine other then Voron, while we are in the early pre-release phase of RavenDB 3.0. You are currently running on {0}",
                            storageType));

                Trace.WriteLine("Forcing filesystem to run on Voron - pre release behavior only, mind " + Path.GetFileName(Path.GetDirectoryName(systemConfiguration.FileSystemDataDirectory)));
                storageType = InMemoryRavenConfiguration.VoronTypeName;
            }

            storage = CreateTransactionalStorage(storageType, systemConfiguration.FileSystemDataDirectory, systemConfiguration.Settings);
			search = new IndexStorage(systemConfiguration.FileSystemIndexStoragePath, systemConfiguration.Settings);
			sigGenerator = new SigGenerator();
			var replicationHiLo = new SynchronizationHiLo(storage);
			var sequenceActions = new SequenceActions(storage);
			this.transportState = transportState;
			notificationPublisher = new NotificationPublisher(transportState);
			fileLockManager = new FileLockManager();
			storage.Initialize();
			search.Initialize();
			var uuidGenerator = new UuidGenerator(sequenceActions);
			historian = new Historian(storage, replicationHiLo, uuidGenerator);
			BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024);
			conflictArtifactManager = new ConflictArtifactManager(storage, search);
			conflictDetector = new ConflictDetector();
			conflictResolver = new ConflictResolver();
			synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration);
			storageOperationsTask = new StorageOperationsTask(storage, search, notificationPublisher);
            metricsCounters = new MetricsCountersManager();

			AppDomain.CurrentDomain.ProcessExit += ShouldDispose;
			AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
		}
Пример #8
0
			public ReadFileToDatabase(BufferPool bufferPool, ITransactionalStorage storage, Stream inputStream, string filename)
			{
				this.bufferPool = bufferPool;
				this.inputStream = inputStream;
				this.storage = storage;
				this.filename = filename;
				buffer = bufferPool.TakeBuffer(StorageConstants.MaxPageSize);
			    md5Hasher = Encryptor.Current.CreateHash();
			}