001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.tool;
019
020import java.util.Map;
021import java.util.concurrent.ExecutorService;
022import org.apache.hadoop.conf.Configuration;
023import org.apache.yetus.audience.InterfaceAudience;
024
025@InterfaceAudience.Public
026public interface Canary {
027
028  static Canary create(Configuration conf, ExecutorService executor) {
029    return new CanaryTool(conf, executor);
030  }
031
032  @InterfaceAudience.Private
033  static Canary create(Configuration conf, ExecutorService executor, CanaryTool.Sink sink) {
034    return new CanaryTool(conf, executor, sink);
035  }
036
037  /**
038   * Run Canary in Region mode.
039   * @param targets -- list of monitor tables.
040   * @return the exit code of the Canary tool.
041   */
042  public int checkRegions(String[] targets) throws Exception;
043
044  /**
045   * Runs Canary in Region server mode.
046   * @param targets -- list of monitor tables.
047   * @return the exit code of the Canary tool.
048   */
049  public int checkRegionServers(String[] targets) throws Exception;
050
051  /**
052   * Runs Canary in Zookeeper mode.
053   * @return the exit code of the Canary tool.
054   */
055  public int checkZooKeeper() throws Exception;
056
057  public Map<String, String> getReadFailures();
058
059  public Map<String, String> getWriteFailures();
060}