Class VersionAgnosticMigrationManager<T>
- java.lang.Object
-
- software.xdev.micromigration.microstream.versionagnostic.VersionAgnosticMigrationManager<T>
-
- Type Parameters:
T
- The actually used MicroStream EmbeddedStorageManager
public class VersionAgnosticMigrationManager<T> extends java.lang.Object
Manages a given object and keeps the version for it.Can be used to keep the version of the MicroStream-Root-Object and therefor keep the whole datastore versioned.
VersionAgnostic
because it should be independent from the actual MicroStream implementation used.- Author:
- Johannes Rabauer
-
-
Constructor Summary
Constructors Constructor Description VersionAgnosticMigrationManager(java.util.function.Supplier<MigrationVersion> currentVersionGetter, java.util.function.Consumer<MigrationVersion> currentVersionSetter, java.util.function.Consumer<MigrationVersion> currentVersionStorer, MicroMigrater migrater, VersionAgnosticMigrationEmbeddedStorageManager<?,T> storageManager)
VersionAgnosticMigrationManager(VersionedAndKeeperOfHistory versionedObject, MicroMigrater migrater, VersionAgnosticMigrationEmbeddedStorageManager<?,T> storageManager)
Simple Constructor.VersionAgnosticMigrationManager(Versioned versionedObject, MicroMigrater migrater, VersionAgnosticMigrationEmbeddedStorageManager<?,T> storageManager)
Simple Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
migrate(java.lang.Object objectToMigrate)
Migrates the given object to the newest possible version, defined by theMicroMigrater
.
-
-
-
Constructor Detail
-
VersionAgnosticMigrationManager
public VersionAgnosticMigrationManager(java.util.function.Supplier<MigrationVersion> currentVersionGetter, java.util.function.Consumer<MigrationVersion> currentVersionSetter, java.util.function.Consumer<MigrationVersion> currentVersionStorer, MicroMigrater migrater, VersionAgnosticMigrationEmbeddedStorageManager<?,T> storageManager)
Much more complicated constructor thanVersionAgnosticMigrationManager(software.xdev.micromigration.version.Versioned,software.xdev.micromigration.migrater.MicroMigrater,software.xdev.micromigration.microstream.versionagnostic.VersionAgnosticMigrationEmbeddedStorageManager<?,T>)
.- Parameters:
currentVersionGetter
- which supplies the current version of the object to update.currentVersionSetter
- which sets the new version of the object in some membervariable. This Consumer is not supposed to store the version, but only save it in some membervariable to be stored after.currentVersionStorer
- which is supposed to store the new version of the object somewhere in the datastore.migrater
- does the actual migration with the givenVersionAgnosticMigrationScript
storageManager
- for theVersionAgnosticMigrationScript
s to use. Is not used for the storing of the new version.
-
VersionAgnosticMigrationManager
public VersionAgnosticMigrationManager(Versioned versionedObject, MicroMigrater migrater, VersionAgnosticMigrationEmbeddedStorageManager<?,T> storageManager)
Simple Constructor.- Parameters:
versionedObject
- which provides getter and setter for the current version. This object will be stored after theVersionAgnosticMigrationScript
s are executed.migrater
- does the actual migration with the givenVersionAgnosticMigrationScript
storageManager
- for theVersionAgnosticMigrationScript
s to use. Is not used for the storing of the new version.
-
VersionAgnosticMigrationManager
public VersionAgnosticMigrationManager(VersionedAndKeeperOfHistory versionedObject, MicroMigrater migrater, VersionAgnosticMigrationEmbeddedStorageManager<?,T> storageManager)
Simple Constructor.- Parameters:
versionedObject
- which provides getter and setter for the current version. This object will be stored after theVersionAgnosticMigrationScript
s are executed.migrater
- does the actual migration with the givenVersionAgnosticMigrationScript
storageManager
- for theVersionAgnosticMigrationScript
s to use. Is not used for the storing of the new version.
-
-
Method Detail
-
migrate
public void migrate(java.lang.Object objectToMigrate)
Migrates the given object to the newest possible version, defined by theMicroMigrater
.- Parameters:
objectToMigrate
- is given to theMicroMigrater
for migrating upon
-
-