public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit) { this.configuration = configuration; this.onCommit = onCommit; documentCacher = new DocumentCacher(configuration); exitLockDisposable = new DisposableAction(() => Monitor.Exit(this)); }
public DocumentStorageActions( JET_INSTANCE instance, string database, TableColumnsCache tableColumnsCache, OrderedPartCollection<AbstractDocumentCodec> documentCodecs, IUuidGenerator uuidGenerator, IDocumentCacher cacher, TransactionalStorage transactionalStorage) { this.tableColumnsCache = tableColumnsCache; this.documentCodecs = documentCodecs; this.uuidGenerator = uuidGenerator; this.cacher = cacher; this.transactionalStorage = transactionalStorage; try { session = new Session(instance); transaction = new Transaction(session); Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None); } catch (Exception) { Dispose(); throw; } }
public void ClearCaches() { var oldDocumentCacher = documentCacher; documentCacher = CreateDocumentCacher(configuration); oldDocumentCacher.Dispose(); }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit, Action onStorageInaccessible, Action onNestedTransactionEnter, Action onNestedTransactionExit) { configuration.Container.SatisfyImportsOnce(this); if (configuration.CacheDocumentsInMemory == false) { documentCacher = new NullDocumentCacher(); } else { documentCacher = new DocumentCacher(configuration); } database = configuration.DataDirectory; this.configuration = configuration; this.onCommit = onCommit; path = database; if (Path.IsPathRooted(database) == false) { path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database); } database = Path.Combine(path, "Data"); RecoverFromFailedCompact(database); new TransactionalStorageConfigurator(configuration, this).LimitSystemCache(); uniquePrefix = Interlocked.Increment(ref instanceCounter) + "-" + Base62Util.Base62Random(); CreateInstance(out instance, uniquePrefix + "-" + database); this.onNestedTransactionEnter = onNestedTransactionEnter; this.onNestedTransactionExit = onNestedTransactionExit; }
public DocumentStorageActions( JET_INSTANCE instance, string database, TableColumnsCache tableColumnsCache, OrderedPartCollection <AbstractDocumentCodec> documentCodecs, IUuidGenerator uuidGenerator, IDocumentCacher cacher, TransactionalStorage transactionalStorage) { this.tableColumnsCache = tableColumnsCache; this.documentCodecs = documentCodecs; this.uuidGenerator = uuidGenerator; this.cacher = cacher; this.transactionalStorage = transactionalStorage; try { session = new Session(instance); transaction = new Transaction(session); Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None); } catch (Exception) { Dispose(); throw; } }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit) { this.configuration = configuration; this.onCommit = onCommit; documentCacher = new DocumentCacher(configuration); exitLockDisposable = new DisposableAction(() => Monitor.Exit(this)); bufferPool = new BufferPool(configuration.Storage.Voron.MaxBufferPoolSize * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit) }
public DocumentStorageActions( JET_INSTANCE instance, string database, TableColumnsCache tableColumnsCache, OrderedPartCollection <AbstractDocumentCodec> documentCodecs, IUuidGenerator uuidGenerator, IDocumentCacher cacher, EsentTransactionContext transactionContext, TransactionalStorage transactionalStorage) { this.tableColumnsCache = tableColumnsCache; this.documentCodecs = documentCodecs; this.uuidGenerator = uuidGenerator; this.cacher = cacher; this.transactionalStorage = transactionalStorage; this.transactionContext = transactionContext; try { if (transactionContext == null) { session = new Session(instance); transaction = new Transaction(session); sessionAndTransactionDisposer = () => { if (transaction != null) { transaction.Dispose(); } if (session != null) { session.Dispose(); } }; } else { session = transactionContext.Session; transaction = transactionContext.Transaction; var disposable = transactionContext.EnterSessionContext(); sessionAndTransactionDisposer = disposable.Dispose; } Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None); } catch (Exception ex) { logger.WarnException("Error when trying to open a new DocumentStorageActions", ex); try { Dispose(); } catch (Exception e) { logger.WarnException("Error on dispose when the ctor threw an exception, resources may have leaked", e); } throw; } }
public DocumentsStorageActions(TableStorage storage, IUuidGenerator generator, OrderedPartCollection <AbstractDocumentCodec> documentCodecs, IDocumentCacher documentCacher) { this.storage = storage; this.generator = generator; this.documentCodecs = documentCodecs; this.documentCacher = documentCacher; }
public DocumentStorageActions( JET_INSTANCE instance, string database, TableColumnsCache tableColumnsCache, OrderedPartCollection<AbstractDocumentCodec> documentCodecs, IUuidGenerator uuidGenerator, IDocumentCacher cacher, EsentTransactionContext transactionContext, TransactionalStorage transactionalStorage) { this.tableColumnsCache = tableColumnsCache; this.documentCodecs = documentCodecs; this.uuidGenerator = uuidGenerator; this.cacher = cacher; this.transactionalStorage = transactionalStorage; this.transactionContext = transactionContext; try { if (transactionContext == null) { session = new Session(instance); transaction = new Transaction(session); sessionAndTransactionDisposer = () => { if(transaction != null) transaction.Dispose(); if(session != null) session.Dispose(); }; } else { session = transactionContext.Session; transaction = transactionContext.Transaction; var disposable = transactionContext.EnterSessionContext(); sessionAndTransactionDisposer = disposable.Dispose; } Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None); } catch (Exception ex) { logger.WarnException("Error when trying to open a new DocumentStorageActions", ex); try { Dispose(); } catch (Exception e) { logger.WarnException("Error on dispose when the ctor threw an exception, resources may have leaked", e); } throw; } }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit, Action onStorageInaccessible) { this.configuration = configuration; this.onCommit = onCommit; this.onStorageInaccessible = onStorageInaccessible; RecoverFromFailedCompact(configuration.DataDirectory); documentCacher = new DocumentCacher(configuration); exitLockDisposable = new DisposableAction(() => Monitor.Exit(this)); bufferPool = new BufferPool(configuration.Storage.Voron.MaxBufferPoolSize * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit) }
public StorageActionsAccessor(TableStorage storage, IUuidGenerator generator, OrderedPartCollection<AbstractDocumentCodec> documentCodecs, IDocumentCacher documentCacher) { General = new GeneralStorageActions(storage); Attachments = new AttachmentsStorageActions(storage, generator); Transactions = new TransactionStorageActions(storage, generator, documentCodecs); Documents = new DocumentsStorageActions(storage, Transactions, generator, documentCodecs, documentCacher); Indexing = new IndexingStorageActions(storage); MappedResults = new MappedResultsStorageAction(storage, generator); Queue = new QueueStorageActions(storage, generator); Tasks = new TasksStorageActions(storage, generator); Staleness = new StalenessStorageActions(storage); }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit) { documentCacher = new DocumentCacher(configuration); database = configuration.DataDirectory; this.configuration = configuration; this.onCommit = onCommit; path = database; if (Path.IsPathRooted(database) == false) path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database); database = Path.Combine(path, "Data"); new TransactionalStorageConfigurator(configuration).LimitSystemCache(); Api.JetCreateInstance(out instance, database + Guid.NewGuid()); }
public TransactionalStorage(RavenConfiguration configuration, Action onCommit, Action onStorageInaccessible, Action onNestedTransactionEnter, Action onNestedTransactionExit) { this.configuration = configuration; this.onCommit = onCommit; this.onStorageInaccessible = onStorageInaccessible; RecoverFromFailedCompact(configuration.Core.DataDirectory); documentCacher = new DocumentCacher(configuration); exitLockDisposable = new DisposableAction(() => Monitor.Exit(this)); bufferPool = new BufferPool( configuration.Storage.MaxBufferPoolSize.GetValue(SizeUnit.Bytes), int.MaxValue); // 2GB max buffer size (voron limit) this.onNestedTransactionEnter = onNestedTransactionEnter; this.onNestedTransactionExit = onNestedTransactionExit; }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit) { documentCacher = new DocumentCacher(configuration); database = configuration.DataDirectory; this.configuration = configuration; this.onCommit = onCommit; path = database; if (Path.IsPathRooted(database) == false) { path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database); } database = Path.Combine(path, "Data"); new TransactionalStorageConfigurator(configuration).LimitSystemCache(); Api.JetCreateInstance(out instance, database + Guid.NewGuid()); }
public DocumentsStorageActions(IUuidGenerator uuidGenerator, OrderedPartCollection <AbstractDocumentCodec> documentCodecs, IDocumentCacher documentCacher, Reference <WriteBatch> writeBatch, Reference <SnapshotReader> snapshot, TableStorage tableStorage, IBufferPool bufferPool) : base(snapshot, bufferPool) { this.uuidGenerator = uuidGenerator; this.documentCodecs = documentCodecs; this.documentCacher = documentCacher; this.writeBatch = writeBatch; this.tableStorage = tableStorage; metadataIndex = tableStorage.Documents.GetIndex(Tables.Documents.Indices.Metadata); }
private IDocumentCacher CreateDocumentCacher(InMemoryRavenConfiguration configuration) { if (configuration.CacheDocumentsInMemory == false) { documentCacher = new NullDocumentCacher(); } else if (configuration.CustomMemoryCacher != null) { documentCacher = configuration.CustomMemoryCacher(configuration); } else { documentCacher = new DocumentCacher(configuration); } return(documentCacher); }
public DocumentsStorageActions(IUuidGenerator uuidGenerator, OrderedPartCollection<AbstractDocumentCodec> documentCodecs, IDocumentCacher documentCacher, Reference<WriteBatch> writeBatch, Reference<SnapshotReader> snapshot, TableStorage tableStorage, IBufferPool bufferPool) : base(snapshot, bufferPool) { this.uuidGenerator = uuidGenerator; this.documentCodecs = documentCodecs; this.documentCacher = documentCacher; this.writeBatch = writeBatch; this.tableStorage = tableStorage; metadataIndex = tableStorage.Documents.GetIndex(Tables.Documents.Indices.Metadata); }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit) { configuration.Container.SatisfyImportsOnce(this); documentCacher = new DocumentCacher(configuration); database = configuration.DataDirectory; this.configuration = configuration; this.onCommit = onCommit; path = database; if (Path.IsPathRooted(database) == false) path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, database); database = Path.Combine(path, "Data"); RecoverFromFailedCompact(database); new TransactionalStorageConfigurator(configuration, this).LimitSystemCache(); uniquePrefix = Interlocked.Increment(ref instanceCounter) + "-" + Base62Util.Base62Random(); CreateInstance(out instance, uniquePrefix + "-" + database); }
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit) { this.configuration = configuration; this.onCommit = onCommit; documentCacher = new DocumentCacher(configuration); }
public void ClearCaches() { var oldDocumentCacher = documentCacher; documentCacher = new DocumentCacher(configuration); oldDocumentCacher.Dispose(); }
public StorageActionsAccessor(IUuidGenerator generator, OrderedPartCollection <AbstractDocumentCodec> documentCodecs, IDocumentCacher documentCacher, Reference <WriteBatch> writeBatchReference, Reference <SnapshotReader> snapshotReference, TableStorage storage, TransactionalStorage transactionalStorage, IBufferPool bufferPool) { Documents = new DocumentsStorageActions(generator, documentCodecs, documentCacher, writeBatchReference, snapshotReference, storage, bufferPool); Queue = new QueueStorageActions(storage, generator, snapshotReference, writeBatchReference, bufferPool); Tasks = new TasksStorageActions(storage, generator, snapshotReference, writeBatchReference, bufferPool); Staleness = new StalenessStorageActions(storage, snapshotReference, writeBatchReference, bufferPool); Attachments = new AttachmentsStorageActions(storage.Attachments, writeBatchReference, snapshotReference, generator, storage, transactionalStorage, bufferPool); var generalStorageActions = new GeneralStorageActions(storage, writeBatchReference, snapshotReference, bufferPool, this); General = generalStorageActions; Lists = new ListsStorageActions(storage, generator, snapshotReference, writeBatchReference, bufferPool, generalStorageActions); Indexing = new IndexingStorageActions(storage, generator, snapshotReference, writeBatchReference, this, bufferPool, generalStorageActions); MapReduce = new MappedResultsStorageActions(storage, generator, documentCodecs, snapshotReference, writeBatchReference, bufferPool, this, transactionalStorage.GetScheduledReductionsPerViewAndLevel(), generalStorageActions); }
public StorageActionsAccessor(TableStorage storage, IUuidGenerator generator, OrderedPartCollection <AbstractDocumentCodec> documentCodecs, IDocumentCacher documentCacher) { General = new GeneralStorageActions(storage); Attachments = new AttachmentsStorageActions(storage, generator); Transactions = new TransactionStorageActions(storage, generator, documentCodecs); Documents = new DocumentsStorageActions(storage, Transactions, generator, documentCodecs, documentCacher); Indexing = new IndexingStorageActions(storage); MappedResults = new MappedResultsStorageAction(storage, generator); Queue = new QueueStorageActions(storage, generator); Tasks = new TasksStorageActions(storage, generator); Staleness = new StalenessStorageActions(storage); }