internal void PutUniquenessConstraint(ConstraintRule rule) { IndexBackedConstraintDescriptor constraintDescriptor = ( IndexBackedConstraintDescriptor )rule.ConstraintDescriptor; _uniquenessConstraintsById.put(rule.Id, constraintDescriptor); _constraintsByLabelThenProperty.add(constraintDescriptor); }
internal virtual void AddSchemaRule(SchemaRule rule) { if (rule is ConstraintRule) { ConstraintRule constraintRule = ( ConstraintRule )rule; ConstraintRuleById.put(constraintRule.Id, constraintRule); ConstraintsConflict.Add(ConstraintSemantics.readConstraint(constraintRule)); } else if (rule is StoreIndexDescriptor) { CapableIndexDescriptor index = IndexProviderMap.withCapabilities(( StoreIndexDescriptor )rule); IndexDescriptorById.put(index.Id, index); SchemaDescriptor schemaDescriptor = index.Schema(); IndexDescriptorsConflict[schemaDescriptor] = index; IndexDescriptorsByName[rule.Name] = index; foreach (int entityTokenId in schemaDescriptor.EntityTokenIds) { //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: ISet <CapableIndexDescriptor> forLabel = IndexDescriptorsByLabel.getIfAbsentPut(entityTokenId, HashSet <object>::new); forLabel.Add(index); } foreach (int propertyId in index.Schema().PropertyIds) { //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: IList <CapableIndexDescriptor> indexesForProperty = IndexByProperty.getIfAbsentPut(propertyId, List <object>::new); indexesForProperty.Add(index); } } }
public override void AcquireShared(LockTracer tracer, ResourceType resourceType, params long[] resourceIds) { _stateHolder.incrementActiveClients(this); try { MutableLongObjectMap <LockResource> localLocks = LocalShared(resourceType); foreach (long resourceId in resourceIds) { LockResource resource = localLocks.get(resourceId); if (resource != null) { resource.AcquireReference(); } else { resource = new LockResource(resourceType, resourceId); if (_manager.getReadLock(tracer, resource, _lockTransaction)) { localLocks.put(resourceId, resource); } else { throw new LockClientStoppedException(this); } } } } finally { _stateHolder.decrementActiveClients(); } }
public override bool TrySharedLock(ResourceType resourceType, long resourceId) { _stateHolder.incrementActiveClients(this); try { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.map.primitive.MutableLongObjectMap<LockResource> localLocks = localShared(resourceType); MutableLongObjectMap <LockResource> localLocks = LocalShared(resourceType); LockResource resource = localLocks.get(resourceId); if (resource != null) { resource.AcquireReference(); return(true); } else { resource = new LockResource(resourceType, resourceId); if (_manager.tryReadLock(resource, _lockTransaction)) { localLocks.put(resourceId, resource); return(true); } else { return(false); } } } finally { _stateHolder.decrementActiveClients(); } }
public void PutIndexProxy(IndexProxy indexProxy) { StoreIndexDescriptor descriptor = indexProxy.Descriptor; SchemaDescriptor schema = descriptor.Schema(); _indexesById.put(descriptor.Id, indexProxy); _indexesByDescriptor[schema] = indexProxy; _indexIdsByDescriptor.put(schema, descriptor.Id); AddDescriptorToLookups(schema); }
internal virtual void ChangeProperty(int propertyKeyId, Value value) { if (_addedProperties != null && _addedProperties.containsKey(propertyKeyId)) { _addedProperties.put(propertyKeyId, value); return; } if (_changedProperties == null) { _changedProperties = CollectionsFactory.newValuesMap(); } _changedProperties.put(propertyKeyId, value); if (_removedProperties != null) { _removedProperties.remove(propertyKeyId); } }
private void Put(int count, ValuesMap actualMap, MutableLongObjectMap <Value> expectedMap) { for (int i = 0; i < count * 2; i++) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long key = rnd.nextLong(count); long key = _rnd.nextLong(count); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.values.storable.Value value = rnd.randomValues().nextValue(); Value value = _rnd.randomValues().nextValue(); actualMap.Put(key, value); expectedMap.put(key, value); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public IndexAccessors(org.neo4j.kernel.impl.api.index.IndexProviderMap providers, org.neo4j.kernel.impl.store.RecordStore<org.neo4j.kernel.impl.store.record.DynamicRecord> schemaStore, org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig samplingConfig) throws java.io.IOException public IndexAccessors(IndexProviderMap providers, RecordStore <DynamicRecord> schemaStore, IndexSamplingConfig samplingConfig) { IEnumerator <StoreIndexDescriptor> indexes = (new SchemaStorage(schemaStore)).indexesGetAll(); for ( ; ;) { try { //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: if (indexes.hasNext()) { // we intentionally only check indexes that are online since // - populating indexes will be rebuilt on next startup // - failed indexes have to be dropped by the user anyways //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: StoreIndexDescriptor indexDescriptor = indexes.next(); if (indexDescriptor.IndexWithoutOwningConstraint) { _notOnlineIndexRules.Add(indexDescriptor); } else { if (InternalIndexState.ONLINE == Provider(providers, indexDescriptor).getInitialState(indexDescriptor)) { _onlineIndexRules.Add(indexDescriptor); } else { _notOnlineIndexRules.Add(indexDescriptor); } } } else { break; } } catch (Exception) { // ignore; inconsistencies of the schema store are specifically handled elsewhere. } } foreach (StoreIndexDescriptor indexRule in _onlineIndexRules) { long indexId = indexRule.Id; _accessors.put(indexId, Provider(providers, indexRule).getOnlineAccessor(indexRule, samplingConfig)); } }
internal override void Add(TxDataHolder holder, EntityId entityId, string key, object value) { try { EnsureLuceneDataInstantiated(); long id = entityId.Id(); Document document = FindDocument(id); bool add = false; if (document == null) { document = IndexType.NewDocument(entityId); document.add(new StoredField(TX_STATE_KEY, _txStateValue)); _cachedDocuments.put(id, document); add = true; } if (string.ReferenceEquals(key, null) && value == null) { // Set a special "always hit" flag document.add(new StringField(ORPHANS_KEY, ORPHANS_VALUE, Store.NO)); AddOrphan(null); } else if (value == null) { // Set a special "always hit" flag document.add(new StringField(ORPHANS_KEY, key, Store.NO)); AddOrphan(key); } else { Index.type.addToDocument(document, key, value); } if (add) { _writer.addDocument(document); } else { _writer.updateDocument(Index.type.idTerm(id), document); } InvalidateSearcher(); } catch (IOException e) { throw new Exception(e); } }
internal virtual void Add(R record) { _map.put(record.Id, record); }