Interface Version
- All Known Implementing Classes:
AbstractVersion
,Version1
,Version2
,Version3
public interface Version
Represents a data model version of the rrd4j database files.
Note: does not represent the version of the rrd db which you can set via
RrdDef.setVersion(int)
.
Versions are built to run after another. e.g. if someone writes a version 4 this version need to migrate data from version 3.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.rrd4j.core.RrdDb
Creates a new database with the givenVersion.CreateDatabaseConfig
.int
Gets the version number of thisVersion
.org.rrd4j.core.RrdDb
migrate
(org.rrd4j.core.RrdDb oldDb, Version.CreateDatabaseConfig config) Migrates the old database into a new one by creating a temporary file database of theVersion.CreateDatabaseConfig
.static Comparator
<Version> Creates aComparator
, which sorts the versions by its version number ascending.
-
Method Details
-
numberComparator
Creates aComparator
, which sorts the versions by its version number ascending. The number can be obtained withgetVersion()
.- Returns:
- the
Comparator
-
getVersion
int getVersion()Gets the version number of thisVersion
.- Returns:
- the version number
-
createNewDb
Creates a new database with the givenVersion.CreateDatabaseConfig
.- Parameters:
config
- the configuration to create the database- Returns:
- the created database
- Throws:
IOException
- on I/O-Error
-
migrate
org.rrd4j.core.RrdDb migrate(org.rrd4j.core.RrdDb oldDb, Version.CreateDatabaseConfig config) throws IOException Migrates the old database into a new one by creating a temporary file database of theVersion.CreateDatabaseConfig
.- Parameters:
oldDb
- the old database instance of the previous versionconfig
- theVersion.CreateDatabaseConfig
to create a new database- Returns:
- the migrated data in the new database
- Throws:
IOException
- on I/O-Error
-