private static File GetFileDirectory(File storeDir, IndexEntityType type) { File path = new File(storeDir, "lucene"); string extra = type.nameToLowerCase(); return(new File(path, extra)); }
/// <summary> /// Get an applier suitable for the specified IndexCommand. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private TransactionApplier applier(org.neo4j.kernel.impl.index.IndexCommand command) throws java.io.IOException private TransactionApplier Applier(IndexCommand command) { // Have we got an applier for this index? string indexName = _defineCommand.getIndexName(command.IndexNameId); IDictionary <string, TransactionApplier> applierByIndex = ApplierByIndexMap(command); TransactionApplier applier = applierByIndex[indexName]; if (applier == null) { // We don't. Have we got an applier for the provider of this index? IndexEntityType entityType = IndexEntityType.byId(command.EntityType); IDictionary <string, string> config = _indexConfigStore.get(entityType.entityClass(), indexName); if (config == null) { // This provider doesn't even exist, return an EMPTY handler, i.e. ignore these changes. // Could be that the index provider is temporarily unavailable? return(TransactionApplier_Fields.Empty); } string providerName = config[PROVIDER]; applier = ApplierByProvider[providerName]; if (applier == null) { // We don't, so create the applier applier = _applierLookup.newApplier(providerName, _mode.needsIdempotencyChecks()); applier.VisitIndexDefineCommand(_defineCommand); ApplierByProvider[providerName] = applier; } // Also cache this applier for this index applierByIndex[indexName] = applier; } return(applier); }
public override bool CheckIndexExistence(IndexEntityType entityType, string indexName, IDictionary <string, string> config) { IDictionary <string, string> configuration = _indexConfigStore.get(entityType.entityClass(), indexName); if (configuration == null) { return(false); } string providerName = configuration[Org.Neo4j.Graphdb.index.IndexManager_Fields.PROVIDER]; IndexImplementation provider = _providerLookup.getProviderByName(providerName); assertConfigMatches(provider, indexName, configuration, config); return(true); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private CommitContext commitContext(org.neo4j.kernel.impl.index.IndexCommand command) throws org.neo4j.internal.kernel.api.exceptions.explicitindex.ExplicitIndexNotFoundKernelException private CommitContext CommitContext(IndexCommand command) { IDictionary <string, CommitContext> contextMap = CommitContextMap(command.EntityType); string indexName = _definitions.getIndexName(command.IndexNameId); CommitContext context = contextMap[indexName]; if (context == null) { IndexIdentifier identifier = new IndexIdentifier(IndexEntityType.byId(command.EntityType), indexName); // TODO the fact that we look up index type from config here using the index store // directly should be avoided. But how can we do it in, say recovery? // The `dataSource.getType()` call can throw an exception if the index is concurrently deleted. // To avoid bubbling an exception during commit, we instead ignore the commands related to that index, // and proceed as if the index never existed, and thus cannot accept any modifications. IndexType type = _dataSource.getType(identifier, _recovery); context = new CommitContext(_dataSource, identifier, type, _recovery); contextMap[indexName] = context; } return(context); }
public override bool CheckIndexExistence(IndexEntityType entityType, string indexName, IDictionary <string, string> config) { return(_txState.checkIndexExistence(entityType, indexName, config)); }
public override void DeleteIndex(IndexEntityType entityType, string indexName) { _txState.deleteIndex(entityType, indexName); }
public override void CreateIndex(IndexEntityType node, string name, IDictionary <string, string> config) { _txState.createIndex(node, name, config); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public boolean visitIndexCreateCommand(org.neo4j.kernel.impl.index.IndexCommand.CreateCommand command) throws java.io.IOException public override bool VisitIndexCreateCommand(IndexCommand.CreateCommand command) { _indexConfigStore.setIfNecessary(IndexEntityType.byId(command.EntityType).entityClass(), _defineCommand.getIndexName(command.IndexNameId), command.Config); return(Applier(command).visitIndexCreateCommand(command)); }
public override void CreateIndex(IndexEntityType entityType, string indexName, IDictionary <string, string> config) { IndexCommand.CreateCommand command = new IndexCommand.CreateCommand(); command.Init(Definitions().getOrAssignIndexNameId(indexName), entityType.id(), config); AddCommand(indexName, command); }
public override void DeleteIndex(IndexEntityType entityType, string indexName) { IndexCommand.DeleteCommand command = new IndexCommand.DeleteCommand(); command.Init(Definitions().getOrAssignIndexNameId(indexName), entityType.id()); AddCommand(indexName, command, true); }