/// <summary>
        /// Select record format for the given store directory.
        /// <para>
        /// <b>Note:</b> package private only for testing.
        ///
        /// </para>
        /// </summary>
        /// <param name="databaseLayout"> directory with the store </param>
        /// <param name="fs"> file system used to access store files </param>
        /// <param name="pageCache"> page cache to read store files </param>
        /// <returns> record format of the given store or <code>null</code> if <seealso cref="DatabaseLayout.metadataStore()"/> file not
        /// found or can't be read </returns>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Nullable static RecordFormats selectForStore(org.neo4j.io.layout.DatabaseLayout databaseLayout, org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.pagecache.PageCache pageCache, org.neo4j.logging.LogProvider logProvider)
        internal static RecordFormats SelectForStore(DatabaseLayout databaseLayout, FileSystemAbstraction fs, PageCache pageCache, LogProvider logProvider)
        {
            File neoStoreFile = databaseLayout.MetadataStore();

            if (fs.FileExists(neoStoreFile))
            {
                try
                {
                    long value = MetaDataStore.getRecord(pageCache, neoStoreFile, STORE_VERSION);
                    if (value != MetaDataRecordFormat.FIELD_NOT_PRESENT)
                    {
                        string storeVersion = MetaDataStore.versionLongToString(value);

                        foreach (RecordFormats format in AllFormats())
                        {
                            if (format.StoreVersion().Equals(storeVersion))
                            {
                                Info(logProvider, "Selected " + format + " record format from store " + databaseLayout.DatabaseDirectory());
                                return(format);
                            }
                        }
                    }
                }
                catch (IOException e)
                {
                    Info(logProvider, "Unable to read store format: " + e.Message);
                }
            }
            return(null);
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public java.util.Optional<String> getVersion(java.io.File neostoreFile) throws java.io.IOException
        public virtual Optional <string> GetVersion(File neostoreFile)
        {
            long record = MetaDataStore.getRecord(_pageCache, neostoreFile, STORE_VERSION);

            if (record == MetaDataRecordFormat.FIELD_NOT_PRESENT)
            {
                return(null);
            }
            return(MetaDataStore.versionLongToString(record));
        }