Class MigrationManager


  • public class MigrationManager
    extends java.lang.Object
    Manages 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 client
        lockPath - base path for locks used by the manager
        metaDataPath - base path to store the meta data
        executor - the executor to use
        lockMax - 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, MigrationException is thrown.
        Parameters:
        set - the migration set being applied
        operationHashesInOrder - 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