/// <summary>
 /// Store all types that was added in the transaction for the current node
 /// </summary>
 private void CheckTxStateForUpdates()
 {
     if (_read.hasTxStateWithChanges())
     {
         NodeState    nodeState          = _read.txState().getNodeState(_storeCursor.OwningNode);
         LongIterator addedRelationships = nodeState.AddedRelationships;
         while (addedRelationships.hasNext())
         {
             RelationshipState relationshipState = _read.txState().getRelationshipState(addedRelationships.next());
             relationshipState.Accept((relationshipId, typeId, startNodeId, endNodeId) => _txTypes.add(typeId));
         }
     }
 }
예제 #2
0
        /// <summary>
        /// NodeCursor should only see changes that are there from the beginning
        /// otherwise it will not be stable.
        /// </summary>
        private bool HasChanges()
        {
            switch (_hasChanges)
            {
            case Org.Neo4j.Kernel.Impl.Newapi.HasChanges.Maybe:
                bool changes = _read.hasTxStateWithChanges();
                if (changes)
                {
                    if (_single != NO_ID)
                    {
                        _addedNodes = _read.txState().nodeIsAddedInThisTx(_single) ? LongSets.immutable.of(_single).longIterator() : ImmutableEmptyLongIterator.INSTANCE;
                    }
                    else
                    {
                        _addedNodes = _read.txState().addedAndRemovedNodes().Added.freeze().longIterator();
                    }
                    _hasChanges = HasChanges.Yes;
                }
                else
                {
                    _hasChanges = HasChanges.No;
                }
                return(changes);

            case Org.Neo4j.Kernel.Impl.Newapi.HasChanges.Yes:
                return(true);

            case Org.Neo4j.Kernel.Impl.Newapi.HasChanges.No:
                return(false);

            default:
                throw new System.InvalidOperationException("Style guide, why are you making me do this");
            }
        }
        public override void Scan(IndexProgressor progressor, bool providesLabels, int label)
        {
            base.Initialize(progressor);
            if (_read.hasTxStateWithChanges())
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.storageengine.api.txstate.LongDiffSets changes = read.txState().nodesWithLabelChanged(label);
                LongDiffSets changes = _read.txState().nodesWithLabelChanged(label);
                _added   = changes.Augment(ImmutableEmptyLongIterator.INSTANCE);
                _removed = mergeToSet(_read.txState().addedAndRemovedNodes().Removed, changes.Removed);
            }
        }
예제 #4
0
        /// <summary>
        /// RelationshipCursor should only see changes that are there from the beginning
        /// otherwise it will not be stable.
        /// </summary>
        protected internal virtual bool HasChanges()
        {
            if (_checkHasChanges)
            {
                _hasChanges = Read.hasTxStateWithChanges();
                if (_hasChanges)
                {
                    CollectAddedTxStateSnapshot();
                }
                _checkHasChanges = false;
            }

            return(_hasChanges);
        }
예제 #5
0
        public override void Initialize(IndexDescriptor descriptor, IndexProgressor progressor, IndexQuery[] query, IndexOrder indexOrder, bool needsValues)
        {
            Debug.Assert(query != null);
            base.Initialize(progressor);
            _sortedMergeJoin.initialize(indexOrder);

            this._indexOrder  = indexOrder;
            this._needsValues = needsValues;
            this._query       = query;

            if (_read.hasTxStateWithChanges() && query.Length > 0)
            {
                IndexQuery firstPredicate = query[0];
                switch (firstPredicate.Type())
                {
                case exact:
                    // No need to order, all values are the same
                    this._indexOrder = IndexOrder.NONE;
                    SeekQuery(descriptor, query);
                    break;

                case exists:
                    SetNeedsValuesIfRequiresOrder();
                    ScanQuery(descriptor);
                    break;

                case range:
                    Debug.Assert(query.Length == 1);
                    SetNeedsValuesIfRequiresOrder();
                    RangeQuery(descriptor, (IndexQuery.RangePredicate)firstPredicate);
                    break;

                case stringPrefix:
                    Debug.Assert(query.Length == 1);
                    SetNeedsValuesIfRequiresOrder();
                    PrefixQuery(descriptor, (IndexQuery.StringPrefixPredicate)firstPredicate);
                    break;

                case stringSuffix:
                case stringContains:
                    Debug.Assert(query.Length == 1);
                    SuffixOrContainsQuery(descriptor, firstPredicate);
                    break;

                default:
                    throw new System.NotSupportedException("Query not supported: " + Arrays.ToString(query));
                }
            }
        }