Class MigrationManager
- java.lang.Object
-
- org.apache.curator.x.async.migrations.MigrationManager
-
public class MigrationManager extends java.lang.ObjectManages migrations
-
-
Constructor Summary
Constructors Constructor Description MigrationManager(AsyncCuratorFramework client, java.lang.String lockPath, java.lang.String metaDataPath, java.util.concurrent.Executor executor, java.time.Duration lockMax)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<Migration>filter(MigrationSet set, java.util.List<byte[]> operationHashesInOrder)Can be overridden to change how the comparison to previous migrations is done.java.util.concurrent.CompletionStage<java.lang.Void>migrate(MigrationSet set)Process the given migration set
-
-
-
Constructor Detail
-
MigrationManager
public MigrationManager(AsyncCuratorFramework client, java.lang.String lockPath, java.lang.String metaDataPath, java.util.concurrent.Executor executor, java.time.Duration lockMax)
- Parameters:
client- the curator clientlockPath- base path for locks used by the managermetaDataPath- base path to store the meta dataexecutor- the executor to uselockMax- max time to wait for locks
-
-
Method Detail
-
migrate
public java.util.concurrent.CompletionStage<java.lang.Void> migrate(MigrationSet set)
Process the given migration set- Parameters:
set- the set- Returns:
- completion stage. If there is a migration-specific error, the stage will be completed
exceptionally with
MigrationException.
-
filter
protected java.util.List<Migration> filter(MigrationSet set, java.util.List<byte[]> operationHashesInOrder) throws MigrationException
Can be overridden to change how the comparison to previous migrations is done. The default version ensures that the meta data from previous migrations matches the current migration set exactly (by order and version). If there is a mismatch,MigrationExceptionis thrown.- Parameters:
set- the migration set being appliedoperationHashesInOrder- previous operation hashes (may be empty)- Returns:
- the list of actual migrations to perform. The filter can return any value here or an empty list.
- Throws:
MigrationException- errors
-
-