Skip to content

Commit

Permalink
add moveCost
Browse files Browse the repository at this point in the history
  • Loading branch information
qoo332001 committed Aug 16, 2022
1 parent 5703206 commit a3abf0c
Show file tree
Hide file tree
Showing 3 changed files with 1,036 additions and 0 deletions.
54 changes: 54 additions & 0 deletions app/src/main/java/org/astraea/app/cost/HasMoveCost.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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 org.astraea.app.cost;

import java.util.Map;
import org.astraea.app.admin.ClusterBean;
import org.astraea.app.admin.ClusterInfo;

public interface HasMoveCost extends CostFunction {
/**
* score migrate cost from originClusterInfo to newClusterInfo .
*
* @param originClusterInfo the clusterInfo before migrate
* @param newClusterInfo the mocked clusterInfo generate from balancer
* @param clusterBean cluster metrics
* @return the score of migrate cost
*/
ClusterCost clusterCost(
ClusterInfo originClusterInfo, ClusterInfo newClusterInfo, ClusterBean clusterBean);

/**
* @param originClusterInfo he clusterInfo before migrate
* @param newClusterInfo the mocked clusterInfo generate from balancer
* @param clusterBean cluster metrics
* @return Check if the migrate plan exceeds the available hardware resources
*/
boolean overflow(
ClusterInfo originClusterInfo, ClusterInfo newClusterInfo, ClusterBean clusterBean);

/**
* @param originClusterInfo
* @param newClusterInfo
* @return total migrate size of the plan
*/
Map<MoveCost.ReplicaMigrateInfo, Long> totalMigrateSize(
ClusterInfo originClusterInfo, ClusterInfo newClusterInfo, ClusterBean clusterBean);

double estimatedMigrateTime(
ClusterInfo originClusterInfo, ClusterInfo newClusterInfo, ClusterBean clusterBean);
}
Loading

0 comments on commit a3abf0c

Please sign in to comment.