Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void SetUp()
        {
            _life = new LifeSupport();
            PageCache       pageCache       = Storage.pageCache();
            DatabaseLayout  databaseLayout  = Storage.directory().databaseLayout();
            Config          config          = Config.defaults(GraphDatabaseSettings.default_schema_provider, EMPTY.ProviderDescriptor.name());
            NullLogProvider nullLogProvider = NullLogProvider.Instance;
            StoreFactory    storeFactory    = new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(Storage.fileSystem()), pageCache, Storage.fileSystem(), nullLogProvider, EmptyVersionContextSupplier.EMPTY);

            _neoStores = storeFactory.OpenAllNeoStores(true);
            _neoStores.Counts.start();
            CountsComputer.recomputeCounts(_neoStores, pageCache, databaseLayout);
            _nodeStore         = _neoStores.NodeStore;
            _relationshipStore = _neoStores.RelationshipStore;
            PropertyStore propertyStore = _neoStores.PropertyStore;
            JobScheduler  scheduler     = JobSchedulerFactory.createScheduler();
            Dependencies  dependencies  = new Dependencies();

            dependencies.SatisfyDependency(EMPTY);
            DefaultIndexProviderMap providerMap = new DefaultIndexProviderMap(dependencies, config);

            _life.add(providerMap);
            _indexingService = IndexingServiceFactory.createIndexingService(config, scheduler, providerMap, new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, _neoStores), SchemaUtil.idTokenNameLookup, empty(), nullLogProvider, nullLogProvider, IndexingService.NO_MONITOR, new DatabaseSchemaState(nullLogProvider), false);
            _propertyPhysicalToLogicalConverter = new PropertyPhysicalToLogicalConverter(_neoStores.PropertyStore);
            _life.add(_indexingService);
            _life.add(scheduler);
            _life.init();
            _life.start();
            _propertyCreator = new PropertyCreator(_neoStores.PropertyStore, new PropertyTraverser());
            _recordAccess    = new DirectRecordAccess <PropertyRecord, PrimitiveRecord>(_neoStores.PropertyStore, Loaders.propertyLoader(propertyStore));
        }
Ejemplo n.º 2
0
        public RecordStorageEngine(DatabaseLayout databaseLayout, Config config, PageCache pageCache, FileSystemAbstraction fs, LogProvider logProvider, LogProvider userLogProvider, TokenHolders tokenHolders, SchemaState schemaState, ConstraintSemantics constraintSemantics, JobScheduler scheduler, TokenNameLookup tokenNameLookup, LockService lockService, IndexProviderMap indexProviderMap, IndexingService.Monitor indexingServiceMonitor, DatabaseHealth databaseHealth, ExplicitIndexProvider explicitIndexProvider, IndexConfigStore indexConfigStore, IdOrderingQueue explicitIndexTransactionOrdering, IdGeneratorFactory idGeneratorFactory, IdController idController, Monitors monitors, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, OperationalMode operationalMode, VersionContextSupplier versionContextSupplier)
        {
            this._tokenHolders   = tokenHolders;
            this._schemaState    = schemaState;
            this._lockService    = lockService;
            this._databaseHealth = databaseHealth;
            this._explicitIndexProviderLookup      = explicitIndexProvider;
            this._indexConfigStore                 = indexConfigStore;
            this._constraintSemantics              = constraintSemantics;
            this._explicitIndexTransactionOrdering = explicitIndexTransactionOrdering;

            this._idController = idController;
            StoreFactory factory = new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, fs, logProvider, versionContextSupplier);

            _neoStores = factory.OpenAllNeoStores(true);

            try
            {
                _schemaCache   = new SchemaCache(constraintSemantics, Collections.emptyList(), indexProviderMap);
                _schemaStorage = new SchemaStorage(_neoStores.SchemaStore);

                NeoStoreIndexStoreView neoStoreIndexStoreView = new NeoStoreIndexStoreView(lockService, _neoStores);
                bool readOnly = config.Get(GraphDatabaseSettings.read_only) && operationalMode == OperationalMode.single;
                monitors.AddMonitorListener(new LoggingMonitor(logProvider.GetLog(typeof(NativeLabelScanStore))));
                _labelScanStore = new NativeLabelScanStore(pageCache, databaseLayout, fs, new FullLabelStream(neoStoreIndexStoreView), readOnly, monitors, recoveryCleanupWorkCollector);

                _indexStoreView        = new DynamicIndexStoreView(neoStoreIndexStoreView, _labelScanStore, lockService, _neoStores, logProvider);
                this._indexProviderMap = indexProviderMap;
                _indexingService       = IndexingServiceFactory.createIndexingService(config, scheduler, indexProviderMap, _indexStoreView, tokenNameLookup, Iterators.asList(_schemaStorage.loadAllSchemaRules()), logProvider, userLogProvider, indexingServiceMonitor, schemaState, readOnly);

                _integrityValidator = new IntegrityValidator(_neoStores, _indexingService);
                _cacheAccess        = new BridgingCacheAccess(_schemaCache, schemaState, tokenHolders);

                _explicitIndexApplierLookup = new Org.Neo4j.Kernel.Impl.Api.ExplicitIndexApplierLookup_Direct(explicitIndexProvider);

                _labelScanStoreSync = new WorkSync <Supplier <LabelScanWriter>, LabelUpdateWork>(_labelScanStore.newWriter);

                _commandReaderFactory = new RecordStorageCommandReaderFactory();
                _indexUpdatesSync     = new WorkSync <IndexingUpdateService, IndexUpdatesWork>(_indexingService);

                _denseNodeThreshold = config.Get(GraphDatabaseSettings.dense_node_threshold);
                _recordIdBatchSize  = config.Get(GraphDatabaseSettings.record_id_batch_size);
            }
            catch (Exception failure)
            {
                _neoStores.close();
                throw failure;
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void launchCustomIndexPopulation(java.util.Map<String,int> labelNameIdMap, int propertyId, Runnable customAction) throws Exception
        private void LaunchCustomIndexPopulation(IDictionary <string, int> labelNameIdMap, int propertyId, ThreadStart customAction)
        {
            NeoStores      neoStores      = NeoStores;
            LabelScanStore labelScanStore = LabelScanStore;
            ThreadToStatementContextBridge transactionStatementContextBridge = TransactionStatementContextBridge;

            using (Transaction transaction = EmbeddedDatabase.beginTx(), KernelTransaction ktx = transactionStatementContextBridge.GetKernelTransactionBoundToThisThread(true))
            {
                DynamicIndexStoreView storeView = DynamicIndexStoreViewWrapper(customAction, neoStores, labelScanStore);

                IndexProviderMap providerMap     = IndexProviderMap;
                JobScheduler     scheduler       = JobScheduler;
                TokenNameLookup  tokenNameLookup = new SilentTokenNameLookup(ktx.TokenRead());

                NullLogProvider nullLogProvider = NullLogProvider.Instance;
                _indexService = IndexingServiceFactory.createIndexingService(Config.defaults(), scheduler, providerMap, storeView, tokenNameLookup, GetIndexRules(neoStores), nullLogProvider, nullLogProvider, IndexingService.NO_MONITOR, SchemaState, false);
                _indexService.start();

                _rules = CreateIndexRules(labelNameIdMap, propertyId);

                _indexService.createIndexes(_rules);
                transaction.Success();
            }
        }