Exemple #1
0
 internal virtual void InstantiateTree(RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, System.Action <PageCursor> headerWriter)
 {
     EnsureDirectoryExist();
     GBPTree.Monitor monitor = TreeMonitor();
     Tree = new GBPTree <KEY, VALUE>(PageCache, StoreFile, Layout, 0, monitor, NO_HEADER_READER, headerWriter, recoveryCleanupWorkCollector, _readOnly);
     AfterTreeInstantiation(Tree);
 }
Exemple #2
0
 /// <param name="crashGenerationCleaner"> <seealso cref="CrashGenerationCleaner"/> to use for cleaning. </param>
 /// <param name="gbpTreeLock"> <seealso cref="GBPTreeLock"/> to be released when job has either successfully finished or failed. </param>
 /// <param name="monitor"> <seealso cref="GBPTree.Monitor"/> to report to </param>
 /// <param name="indexFile"> Target file </param>
 internal GBPTreeCleanupJob(CrashGenerationCleaner crashGenerationCleaner, GBPTreeLock gbpTreeLock, GBPTree.Monitor monitor, File indexFile)
 {
     this._crashGenerationCleaner = crashGenerationCleaner;
     this._gbpTreeLock            = gbpTreeLock;
     this._monitor   = monitor;
     this._indexFile = indexFile;
     this._needed    = true;
 }
        /// <returns> true if instantiated tree needs to be rebuilt. </returns>
        private bool InstantiateTree()
        {
            _monitors.addMonitorListener(TreeMonitor());
            GBPTree.Monitor monitor      = _monitors.newMonitor(typeof(GBPTree.Monitor));
            MutableBoolean  isRebuilding = new MutableBoolean();

            Header.Reader readRebuilding = headerData => isRebuilding.setValue(headerData.get() == _needsRebuilding);
            try
            {
                _index = new GBPTree <LabelScanKey, LabelScanValue>(_pageCache, _storeFile, new LabelScanLayout(), _pageSize, monitor, readRebuilding, _needsRebuildingWriter, _recoveryCleanupWorkCollector, _readOnly);
                return(isRebuilding.Value);
            }
            catch (TreeFileNotFoundException e)
            {
                throw new System.InvalidOperationException("Label scan store file could not be found, most likely this database needs to be recovered, file:" + _storeFile, e);
            }
        }