All Downloads are FREE. Search and download functionalities are using the official Maven repository.

alluxio.master.lineage.checkpoint.CheckpointPlanner Maven / Gradle / Ivy

/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.master.lineage.checkpoint;

import alluxio.Configuration;
import alluxio.Constants;
import alluxio.master.file.meta.FileSystemMasterView;
import alluxio.master.lineage.meta.LineageStoreView;
import alluxio.util.CommonUtils;

import com.google.common.base.Throwables;

/**
 * Generates plans for lineage checkpointing.
 */
public interface CheckpointPlanner {

  /**
   * Factory for {@link CheckpointPlanner}.
   */
  class Factory {

    private Factory() {} // prevent instantiation

    /**
     * @param conf Alluxio configuration to determine the planner type
     * @param lineageStoreView a view of the lineage store
     * @param fileSystemMasterView a view of the file system master
     * @return the generated planner
     */
    public static CheckpointPlanner create(Configuration conf,
        LineageStoreView lineageStoreView, FileSystemMasterView fileSystemMasterView) {
      try {
        return CommonUtils.createNewClassInstance(
            conf.getClass(Constants.MASTER_LINEAGE_CHECKPOINT_CLASS),
            new Class[] {LineageStoreView.class, FileSystemMasterView.class},
            new Object[] {lineageStoreView, fileSystemMasterView});
      } catch (Exception e) {
        throw Throwables.propagate(e);
      }
    }
  }

  /**
   * Generates a plan to decide what lineages to checkpoint.
   *
   * 

* This method returns null if the planner fails to propose a feasible plan to find the lineages * to checkpoint. If the checkpoint plan has no lineages, it indicates that the planner has no * actions to take and the requirement is already met. *

* * @param lineageStoreView a readonly view of the lineage store * @param fileSystemMasterView a readonly view of the file system master * @return a plan (possibly empty) to checkpoint the lineages, or null if no plan is feasible */ CheckpointPlan generatePlan(LineageStoreView lineageStoreView, FileSystemMasterView fileSystemMasterView); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy