Search in sources :

Example 6 with Result

use of org.neo4j.kernel.impl.storemigration.StoreVersionCheck.Result in project neo4j by neo4j.

the class UpgradableDatabase method hasCurrentVersion.

public boolean hasCurrentVersion(File storeDir) {
    File neoStore = new File(storeDir, MetaDataStore.DEFAULT_NAME);
    Result result = storeVersionCheck.hasVersion(neoStore, format.storeVersion());
    switch(result.outcome) {
        case ok:
        case // let's assume the db is empty
        missingStoreFile:
            return true;
        case storeVersionNotFound:
        case unexpectedStoreVersion:
        case attemptedStoreDowngrade:
            return false;
        default:
            throw new IllegalArgumentException("Unknown outcome: " + result.outcome.name());
    }
}
Also used : File(java.io.File) Result(org.neo4j.kernel.impl.storemigration.StoreVersionCheck.Result)

Aggregations

Result (org.neo4j.kernel.impl.storemigration.StoreVersionCheck.Result)6 File (java.io.File)4 IOException (java.io.IOException)2 Test (org.junit.Test)1 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)1 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 StoreChannel (org.neo4j.io.fs.StoreChannel)1 PageCache (org.neo4j.io.pagecache.PageCache)1 Config (org.neo4j.kernel.configuration.Config)1 ConfiguringPageCacheFactory (org.neo4j.kernel.impl.pagecache.ConfiguringPageCacheFactory)1 RecordFormats (org.neo4j.kernel.impl.store.format.RecordFormats)1 DatabaseNotCleanlyShutDownException (org.neo4j.kernel.impl.storemigration.StoreUpgrader.DatabaseNotCleanlyShutDownException)1 UnexpectedUpgradingStoreFormatException (org.neo4j.kernel.impl.storemigration.StoreUpgrader.UnexpectedUpgradingStoreFormatException)1 UnexpectedUpgradingStoreVersionException (org.neo4j.kernel.impl.storemigration.StoreUpgrader.UnexpectedUpgradingStoreVersionException)1 UpgradeMissingStoreFilesException (org.neo4j.kernel.impl.storemigration.StoreUpgrader.UpgradeMissingStoreFilesException)1 UpgradingStoreVersionNotFoundException (org.neo4j.kernel.impl.storemigration.StoreUpgrader.UpgradingStoreVersionNotFoundException)1 StoreVersionCheck (org.neo4j.kernel.impl.storemigration.StoreVersionCheck)1 MigrationProgressMonitor (org.neo4j.kernel.impl.storemigration.monitoring.MigrationProgressMonitor)1 PhysicalLogFiles (org.neo4j.kernel.impl.transaction.log.PhysicalLogFiles)1 ReadableClosablePositionAwareChannel (org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel)1