protected ITransactionalStorage NewTransactionalStorage(string requestedStorage, bool runInMemory = true, string path = null)
        {
            path = path ?? NewDataPath();

			var configuration = new InMemoryRavenConfiguration
			{
				FileSystem =
				{
					DataDirectory = path
				},
				Settings = new NameValueCollection
				           {
					           { Constants.RunInMemory, runInMemory.ToString() }
				           }
			};

            ITransactionalStorage storage;

            switch (requestedStorage)
            {
                case "esent":
					storage = new Raven.Database.FileSystem.Storage.Esent.TransactionalStorage(configuration);
                    break;
                case "voron":
					storage = new Raven.Database.FileSystem.Storage.Voron.TransactionalStorage(configuration);
                    break;
                default:
                    throw new NotSupportedException(string.Format("Given storage type ({0}) is not supported.", requestedStorage));
            }

            storages.Add(storage);
			storage.Initialize(new OrderedPartCollection<AbstractFileCodec>());

            return storage;
        }
Exemplo n.º 2
0
        protected ITransactionalStorage NewTransactionalStorage(string requestedStorage, bool runInMemory = true, string path = null)
        {
            path = path ?? NewDataPath();

            var configuration = new InMemoryRavenConfiguration
            {
                FileSystem =
                {
                    DataDirectory = path
                },
                Settings = new NameValueCollection
                {
                    { Constants.RunInMemory, runInMemory.ToString() }
                }
            };

            ITransactionalStorage storage;

            switch (requestedStorage)
            {
            case "esent":
                storage = new Raven.Database.FileSystem.Storage.Esent.TransactionalStorage(configuration);
                break;

            case "voron":
                storage = new Raven.Database.FileSystem.Storage.Voron.TransactionalStorage(configuration);
                break;

            default:
                throw new NotSupportedException(string.Format("Given storage type ({0}) is not supported.", requestedStorage));
            }

            storages.Add(storage);
            storage.Initialize(new UuidGenerator(), new OrderedPartCollection <AbstractFileCodec>());

            return(storage);
        }