示例#1
0
        public ITransactionalStorage NewTransactionalStorage(string requestedStorage = null, string dataDir = null, string tempDir = null, bool?runInMemory = null, OrderedPartCollection <AbstractDocumentCodec> documentCodecs = null)
        {
            ITransactionalStorage newTransactionalStorage;
            string storageType = GetDefaultStorageType(requestedStorage);

            var dataDirectory      = dataDir ?? NewDataPath();
            var ravenConfiguration = new RavenConfiguration
            {
                DataDirectory           = dataDirectory,
                FileSystemDataDirectory = Path.Combine(dataDirectory, "FileSystem"),
                RunInMemory             = storageType.Equals("esent", StringComparison.OrdinalIgnoreCase) == false && (runInMemory ?? true),
            };

            ravenConfiguration.Settings["Raven/Voron/TempPath"] = tempDir;

            if (storageType == "voron")
            {
                newTransactionalStorage = new Raven.Storage.Voron.TransactionalStorage(ravenConfiguration, () => { });
            }
            else
            {
                newTransactionalStorage = new Raven.Storage.Esent.TransactionalStorage(ravenConfiguration, () => { });
            }

            newTransactionalStorage.Initialize(new SequentialUuidGenerator {
                EtagBase = 0
            }, documentCodecs ?? new OrderedPartCollection <AbstractDocumentCodec>());
            return(newTransactionalStorage);
        }
        public AttachmentsStorageActions(Table attachmentsTable,
                                         Reference<WriteBatch> writeBatch, 
                                         Reference<SnapshotReader> snapshot, 
                                         IUuidGenerator uuidGenerator, 
                                         TableStorage tableStorage,
                                         Raven.Storage.Voron.TransactionalStorage transactionalStorage, 
                                         IBufferPool bufferPool)
            :base(snapshot, bufferPool)
        {
            this.attachmentsTable = attachmentsTable;
            this.writeBatch = writeBatch;
            this.uuidGenerator = uuidGenerator;
            this.tableStorage = tableStorage;
            this.transactionalStorage = transactionalStorage;

            metadataIndex = tableStorage.Attachments.GetIndex(Tables.Attachments.Indices.Metadata);
        }
示例#3
0
        public AttachmentsStorageActions(Table attachmentsTable,
                                         Reference <WriteBatch> writeBatch,
                                         Reference <SnapshotReader> snapshot,
                                         IUuidGenerator uuidGenerator,
                                         TableStorage tableStorage,
                                         Raven.Storage.Voron.TransactionalStorage transactionalStorage,
                                         IBufferPool bufferPool)
            : base(snapshot, bufferPool)
        {
            this.attachmentsTable     = attachmentsTable;
            this.writeBatch           = writeBatch;
            this.uuidGenerator        = uuidGenerator;
            this.tableStorage         = tableStorage;
            this.transactionalStorage = transactionalStorage;

            metadataIndex = tableStorage.Attachments.GetIndex(Tables.Attachments.Indices.Metadata);
        }
示例#4
0
        public ITransactionalStorage NewTransactionalStorage(string requestedStorage = null, string dataDir = null, string tempDir = null, bool? runInMemory = null, OrderedPartCollection<AbstractDocumentCodec> documentCodecs = null, Action onCommit = null)
        {
            ITransactionalStorage newTransactionalStorage;
            string storageType = GetDefaultStorageType(requestedStorage);

            var dataDirectory = dataDir ?? NewDataPath();
            var ravenConfiguration = new RavenConfiguration
            {
                DataDirectory = dataDirectory,
                RunInMemory = storageType.Equals("esent", StringComparison.OrdinalIgnoreCase) == false && (runInMemory ?? true),
            };

            ravenConfiguration.FileSystem.DataDirectory = Path.Combine(dataDirectory, "FileSystem");
            ravenConfiguration.Storage.Voron.TempPath = tempDir;

            Action onCommitNotification = () =>
            {
                if (onCommit != null)
                    onCommit();
            };

            if (storageType == "voron")
                newTransactionalStorage = new Raven.Storage.Voron.TransactionalStorage(ravenConfiguration, onCommitNotification, () => { }, () => { }, () => { });
            else
                newTransactionalStorage = new Raven.Storage.Esent.TransactionalStorage(ravenConfiguration, onCommitNotification, () => { }, () => { }, () => { });

            newTransactionalStorage.Initialize(new SequentialUuidGenerator { EtagBase = 0 }, documentCodecs ?? new OrderedPartCollection<AbstractDocumentCodec>());
            return newTransactionalStorage;
        }