Exemplo n.º 1
0
        public override void EndOfEntity()
        {
            // Make sure we have an ID
            if (_nodeRecord.Id == NULL_REFERENCE.longValue())
            {
                _nodeRecord.Id = _nodeIds.next();
            }

            // Compose the labels
            if (!_hasLabelField)
            {
                long[] labelIds = _labelTokenRepository.getOrCreateIds(_labels, _labelsCursor);
                InlineNodeLabels.putSorted(_nodeRecord, labelIds, null, _nodeStore.DynamicLabelStore);
            }
            _labelsCursor = 0;

            // Write data to stores
            _nodeRecord.NextProp = CreateAndWritePropertyChain();
            _nodeRecord.InUse    = true;
            _nodeStore.updateRecord(_nodeRecord);
            _nodeCount++;
            _nodeRecord.clear();
            _nodeRecord.Id = NULL_REFERENCE.longValue();
            _hasLabelField = false;
            base.EndOfEntity();
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDeleteIdGeneratorsWhenOpeningExistingStore() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDeleteIdGeneratorsWhenOpeningExistingStore()
        {
            // given
            long expectedHighId;

            using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), PageCacheTracer.NULL, Storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
            {
                stores.CreateNew();
                RelationshipStore  relationshipStore = stores.RelationshipStore;
                RelationshipRecord record            = relationshipStore.NewRecord();
                long no = NULL_REFERENCE.longValue();
                record.Initialize(true, no, 1, 2, 0, no, no, no, no, true, true);
                record.Id      = relationshipStore.NextId();
                expectedHighId = relationshipStore.HighId;
                relationshipStore.UpdateRecord(record);
                // fiddle with the highId
                relationshipStore.HighId = record.Id + 999;
            }

            // when
            using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), PageCacheTracer.NULL, Storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
            {
                stores.PruneAndOpenExistingStore(Predicates.alwaysTrue(), Predicates.alwaysTrue());

                // then
                assertEquals(expectedHighId, stores.RelationshipStore.HighId);
            }
        }
Exemplo n.º 3
0
        public virtual SchemaRecord Initialize(ICollection <DynamicRecord> records)
        {
            Initialize(true);
            IEnumerator <DynamicRecord> iterator = records.GetEnumerator();
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            long id = iterator.hasNext() ? iterator.next().Id : NULL_REFERENCE.intValue();

            Id            = id;
            this._records = records;
            return(this);
        }
Exemplo n.º 4
0
 public virtual RelationshipGroupRecord Initialize(bool inUse, int type, long firstOut, long firstIn, long firstLoop, long owningNode, long next)
 {
     base.Initialize(inUse);
     this._type       = type;
     this._firstOut   = firstOut;
     this._firstIn    = firstIn;
     this._firstLoop  = firstLoop;
     this._owningNode = owningNode;
     this._next       = next;
     this._prev       = NULL_REFERENCE.intValue();
     return(this);
 }
Exemplo n.º 5
0
        protected internal static IList <RelationshipGroupRecord> Groups(params Group[] groups)
        {
            IList <RelationshipGroupRecord> records = new List <RelationshipGroupRecord>();

            foreach (Group group in groups)
            {
                for (int i = 0; i < group.Count; i++)
                {
                    RelationshipGroupRecord record = new RelationshipGroupRecord(NULL_REFERENCE.longValue());
                    record.OwningNode = group.OwningNode;
                    record.Next       = group.Count - i - 1;                        // count: how many come after it (importer does this)
                    records.Add(record);
                }
            }
            return(records);
        }
Exemplo n.º 6
0
 private static RelationshipRecord Relationship(long id, long startNodeId, long endNodeId)
 {
     return((new RelationshipRecord(id)).initialize(true, Record.NO_NEXT_PROPERTY.longValue(), startNodeId, endNodeId, 0, NULL_REFERENCE.longValue(), NULL_REFERENCE.longValue(), NULL_REFERENCE.longValue(), NULL_REFERENCE.longValue(), false, false));
 }
Exemplo n.º 7
0
 public override void Clear()
 {
     Initialize(false, NULL_REFERENCE.intValue(), NULL_REFERENCE.intValue(), NULL_REFERENCE.intValue(), NULL_REFERENCE.intValue(), NULL_REFERENCE.intValue(), NULL_REFERENCE.intValue());
     _prev = NULL_REFERENCE.intValue();
 }
Exemplo n.º 8
0
 public RelationshipGroupRecord(long id, int type, long firstOut, long firstIn, long firstLoop, long owningNode, bool inUse) : this(id, type, firstOut, firstIn, firstLoop, owningNode, NULL_REFERENCE.intValue(), inUse)
 {
 }