rafaelweingartner commented on a change in pull request #2584: Enhance and 
cleanup DatabaseUpgradeChecker
URL: https://github.com/apache/cloudstack/pull/2584#discussion_r183029094
 
 

 ##########
 File path: engine/schema/src/com/cloud/upgrade/DatabaseVersionHierarchy.java
 ##########
 @@ -0,0 +1,185 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.upgrade;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.cloudstack.utils.CloudStackVersion;
+
+import com.cloud.upgrade.dao.DbUpgrade;
+
+/**
+ * @since 4.11.1.0
+ */
+public final class DatabaseVersionHierarchy {
+    private final ImmutableList<VersionNode> hierarchy;
+
+    private DatabaseVersionHierarchy(ImmutableList<VersionNode> hierarchy) {
+        this.hierarchy = hierarchy;
+    }
+
+    public static DatabaseVersionHierarchyBuilder builder() {
+        return new DatabaseVersionHierarchyBuilder();
+    }
+
+    /**
+     * Check if current hierarchy of Database Versions contains 
<code>version</code>.
+     *
+     * @param version The version to check if hierarchy contains it
+     *
+     * @return true if hierarchy contains the version, false if not
+     */
+    public boolean contains(final CloudStackVersion version) {
+        return toList().contains(version);
+    }
+
+    /**
+     * Calculates an  upgrade path for the  passed <code>fromVersion</code>.  
If the  <code>fromVersion</code>
+     * doesn't exist in list  of  available <code>VersionNode</code> 
hierarchy,  then calculation assumes that
+     * the <code>fromVersion</code> required no schema migrations or data 
conversions and no  upgrade path was
 
 Review comment:
   Isn't these documentation duplicated?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to