Пример #1
0
        protected ITransactionalStorage NewTransactionalStorage(string requestedStorage, bool runInMemory = true, string path = null)
        {
            path = path ?? NewDataPath();

            var settings = new NameValueCollection
                           {
                               {"Raven/RunInMemory", runInMemory.ToString()}
                           };

            ITransactionalStorage storage;

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

            storages.Add(storage);
            storage.Initialize();

            return storage;
        }
Пример #2
0
        protected ITransactionalStorage NewTransactionalStorage(string requestedStorage, bool runInMemory = true, string path = null)
        {
            path = path ?? NewDataPath();

            var configuration = new InMemoryRavenConfiguration
            {
                FileSystemDataDirectory = path,
                Settings = new NameValueCollection
                {
                    { "Raven/RunInMemory", runInMemory.ToString() }
                }
            };

            ITransactionalStorage storage;

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

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

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

            storages.Add(storage);
            storage.Initialize();

            return(storage);
        }