Esempio n. 1
0
 public PropertyStore(File file, File idFile, Config configuration, IdGeneratorFactory idGeneratorFactory, PageCache pageCache, LogProvider logProvider, DynamicStringStore stringPropertyStore, PropertyKeyTokenStore propertyKeyTokenStore, DynamicArrayStore arrayPropertyStore, RecordFormats recordFormats, params OpenOption[] openOptions) : base(file, idFile, configuration, IdType.PROPERTY, idGeneratorFactory, pageCache, logProvider, TYPE_DESCRIPTOR, recordFormats.Property(), NO_STORE_HEADER_FORMAT, recordFormats.StoreVersion(), openOptions)
 {
     this._stringStore            = stringPropertyStore;
     this._propertyKeyTokenStore  = propertyKeyTokenStore;
     this._arrayStore             = arrayPropertyStore;
     _allowStorePointsAndTemporal = recordFormats.HasCapability(Capability.POINT_PROPERTIES) && recordFormats.HasCapability(Capability.TEMPORAL_PROPERTIES);
 }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void verifyDynamicSizedStoresCanRebuildIdGeneratorSlowly() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void VerifyDynamicSizedStoresCanRebuildIdGeneratorSlowly()
        {
            // Given we have a store ...
            Config config = Config.defaults(GraphDatabaseSettings.rebuild_idgenerators_fast, "false");

            StoreFactory       storeFactory = new StoreFactory(_testDirectory.databaseLayout(), config, new DefaultIdGeneratorFactory(_fs), PageCacheRule.getPageCache(_fs), _fs, NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY);
            NeoStores          neoStores    = storeFactory.OpenAllNeoStores(true);
            DynamicStringStore store        = neoStores.PropertyStore.StringStore;

            // ... that contain a number of records ...
            DynamicRecord record = new DynamicRecord(1);

            record.SetInUse(true, PropertyType.String.intValue());
            int highestId = 50;

            for (int i = 1; i <= highestId; i++)                 // id '0' is the dynamic store header
            {
                assertThat(store.NextId(), @is((long)i));
                record.Id = i;
                StringBuilder sb = new StringBuilder(i);
                for (int j = 0; j < i; j++)
                {
                    sb.Append('a');
                }
                record.Data = sb.ToString().GetBytes(StandardCharsets.UTF_16);
                store.UpdateRecord(record);
            }
            store.HighestPossibleIdInUse = highestId;

            // ... and some have been deleted
            long?[] idsToFree = new long?[] { 2L, 3L, 5L, 7L };
            record.InUse = false;
            foreach (long toDelete in idsToFree)
            {
                record.Id = toDelete;
                store.UpdateRecord(record);
            }

            // Then when we rebuild the id generator
            store.RebuildIdGenerator();

            // We should observe that the ids above got freed
            IList <long> nextIds = new List <long>();

            nextIds.Add(store.NextId());                 // 2
            nextIds.Add(store.NextId());                 // 3
            nextIds.Add(store.NextId());                 // 5
            nextIds.Add(store.NextId());                 // 7
            nextIds.Add(store.NextId());                 // 51
            assertThat(nextIds, contains(2L, 3L, 5L, 7L, 51L));
            neoStores.Close();
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWriteOutTheDynamicChainBeforeUpdatingThePropertyRecord()
        public virtual void ShouldWriteOutTheDynamicChainBeforeUpdatingThePropertyRecord()
        {
            // given
            PageCache pageCache = PageCacheRule.getPageCache(_fileSystemAbstraction);
            Config    config    = Config.defaults(GraphDatabaseSettings.rebuild_idgenerators_fast, "true");

            DynamicStringStore stringPropertyStore = mock(typeof(DynamicStringStore));

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final PropertyStore store = new PropertyStore(storeFile, idFile, config, new org.neo4j.kernel.impl.core.JumpingIdGeneratorFactory(1), pageCache, org.neo4j.logging.NullLogProvider.getInstance(), stringPropertyStore, mock(PropertyKeyTokenStore.class), mock(DynamicArrayStore.class), org.neo4j.kernel.impl.store.format.RecordFormatSelector.defaultFormat());
            PropertyStore store = new PropertyStore(_storeFile, _idFile, config, new JumpingIdGeneratorFactory(1), pageCache, NullLogProvider.Instance, stringPropertyStore, mock(typeof(PropertyKeyTokenStore)), mock(typeof(DynamicArrayStore)), RecordFormatSelector.defaultFormat());

            store.Initialise(true);

            try
            {
                store.MakeStoreOk();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long propertyRecordId = store.nextId();
                long propertyRecordId = store.NextId();

                PropertyRecord record = new PropertyRecord(propertyRecordId);
                record.InUse = true;

                DynamicRecord dynamicRecord = dynamicRecord();
                PropertyBlock propertyBlock = PropertyBlockWith(dynamicRecord);
                record.PropertyBlock = propertyBlock;

                doAnswer(invocation =>
                {
                    PropertyRecord recordBeforeWrite = store.GetRecord(propertyRecordId, store.NewRecord(), FORCE);
                    assertFalse(recordBeforeWrite.inUse());
                    return(null);
                }).when(stringPropertyStore).updateRecord(dynamicRecord);

                // when
                store.UpdateRecord(record);

                // then verify that our mocked method above, with the assert, was actually called
                verify(stringPropertyStore).updateRecord(dynamicRecord);
            }
            finally
            {
                store.Close();
            }
        }
Esempio n. 4
0
 public LabelTokenStore(File file, File idFile, Config config, IdGeneratorFactory idGeneratorFactory, PageCache pageCache, LogProvider logProvider, DynamicStringStore nameStore, RecordFormats recordFormats, params OpenOption[] openOptions) : base(file, idFile, config, IdType.LABEL_TOKEN, idGeneratorFactory, pageCache, logProvider, nameStore, TYPE_DESCRIPTOR, recordFormats.LabelToken(), recordFormats.StoreVersion(), openOptions)
 {
 }
Esempio n. 5
0
 public TokenStore(File file, File idFile, Config configuration, IdType idType, IdGeneratorFactory idGeneratorFactory, PageCache pageCache, LogProvider logProvider, DynamicStringStore nameStore, string typeDescriptor, RecordFormat <RECORD> recordFormat, string storeVersion, params OpenOption[] openOptions) : base(file, idFile, configuration, idType, idGeneratorFactory, pageCache, logProvider, typeDescriptor, recordFormat, NO_STORE_HEADER_FORMAT, storeVersion, openOptions)
 {
     this._nameStore = nameStore;
 }